2021年8月4日 星期三

[研究] Apache Maven 3.8.1 (tar.gz) 安裝 (CentOS 8.4 x64_86)

[研究] Apache Maven 3.8.1 (tar.gz) 安裝 (CentOS 8.4 x64_86)

2021-08-04

介紹
http://maven.apache.org/

Maven是一個專案的開發,管理和綜合工具。

下載
http://maven.apache.org/download.cgi

參考
http://maven.apache.org/download.cgi#Installation

使用教學
http://maven.apache.org/guides/getting-started/index.html
http://maven.apache.org/guides/index.html

安裝步驟簡述 (Java 路徑要依據實際去修改)


sudo yum -y install java-11
alternatives --list 
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile 

cd /opt
sudo wget https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
sudo tar zxvf apache-maven-3.8.1-bin.tar.gz
export MAVEN_HOME=/opt/apache-maven-3.8.1
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile 

mvn -v

詳細安裝過程

檢查有哪修Java版本可安裝 


[john@localhost opt]$ yum list | grep openjdk
java-1.8.0-openjdk.x86_64                              1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-accessibility.x86_64                1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-demo.x86_64                         1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-devel.x86_64                        1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-headless.x86_64                     1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-headless-slowdebug.x86_64           1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-javadoc.noarch                      1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-javadoc-zip.noarch                  1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-slowdebug.x86_64                    1:1.8.0.302.b08-0.el8_4                           appstream 
java-1.8.0-openjdk-src.x86_64                          1:1.8.0.302.b08-0.el8_4                           appstream 
java-11-openjdk.x86_64                                 1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-demo.x86_64                            1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-devel.x86_64                           1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-headless.x86_64                        1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-javadoc.x86_64                         1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-javadoc-zip.x86_64                     1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-jmods.x86_64                           1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-src.x86_64                             1:11.0.12.0.7-0.el8_4                             appstream 
java-11-openjdk-static-libs.x86_64                     1:11.0.12.0.7-0.el8_4                             appstream 
[john@localhost opt]$ 

安裝 Java 11


[john@localhost ~]$ sudo yum -y install java-11  

顯示安裝路徑 


[john@localhost ~]$ alternatives --list
libnssckbi.so.x86_64  	auto  	/usr/lib64/pkcs11/p11-kit-trust.so
python                	auto  	/usr/libexec/no-python
ifup                  	auto  	/usr/libexec/nm-ifup
ld                    	auto  	/usr/bin/ld.bfd
python3               	auto  	/usr/bin/python3.6
print                 	auto  	/usr/bin/lpr.cups
cifs-idmap-plugin     	auto  	/usr/lib64/cifs-utils/cifs_idmap_sss.so
nmap                  	auto  	/usr/bin/ncat
xinputrc              	auto  	/etc/X11/xinit/xinput.d/ibus.conf
mkisofs               	auto  	/usr/bin/genisoimage
libwbclient.so.0.15-64	auto  	/usr/lib64/samba/wbclient/libwbclient.so.0.15
java                  	auto  	/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64/bin/java
jre_openjdk           	auto  	/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
jre_11                	auto  	/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
jre_11_openjdk        	auto  	/usr/lib/jvm/jre-11-openjdk-11.0.12.0.7-0.el8_4.x86_64

[john@localhost ~]$ 

顯示安裝路徑,另一方式 


[john@localhost ~]$ alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 
failed to create /var/lib/alternatives/java.new: Permission denied
[john@localhost ~]$ 

設定環境變數 JAVA_HOME (某些軟體需要) 


[john@localhost ~]$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
[john@localhost ~]$ export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[john@localhost ~]$ export PATH=$PATH:$JAVA_HOME/bin
[john@localhost ~]$ source /etc/profile 

下載 Maven,設定環境變數 (某些軟體需要)  


cd /opt
sudo wget https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
sudo tar zxvf apache-maven-3.8.1-bin.tar.gz
export MAVEN_HOME=/opt/apache-maven-3.8.1
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile 

測試1


[john@localhost ~]$ /opt/apache-maven-3.8.1/bin/mvn -v
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /opt/apache-maven-3.8.1
Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-305.3.1.el8.x86_64", arch: "amd64", family: "unix"
[john@localhost ~]$ 

測試1 (不指定 mvn 路徑) 


[john@localhost ~]$ mvn -v
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /opt/apache-maven-3.8.1
Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-305.3.1.el8.x86_64", arch: "amd64", family: "unix"
[john@localhost ~]$ 

(完)


相關

[研究] Apache Maven 3.8.1 (tar.gz) 安裝 (CentOS 8.4 x64_86)

[研究] Apache Maven 3.5.4 (yum) 安裝 (CentOS 8.4 x64_86)

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.1 x64_86)
http://shaurong.blogspot.com/2015/05/apache-maven-305-yum-centos-71-x6486.html

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.0 x64_86)
http://shaurong.blogspot.com/2014/08/apache-maven-305-yum-centos-70-x6486.html

[研究] Apache Maven 3.1.1 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/11/apache-maven-311-centos-64-x64.html
http://forum.icst.org.tw/phpbb/viewtopic.php?t=80036

[研究] Apache Maven 3.0.3 (yum) 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.tw/2013/11/apache-maven-303-yum-centos-64-x64.html

相關

[研究] Apache Maven 3.6.3 安裝 (Windows 2019)

[研究] Apache Maven 3.5.3 安裝 (Windows 2016)
https://shaurong.blogspot.com/2018/06/apache-maven-353-windows-2016.html

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.1 x64_86)
http://shaurong.blogspot.com/2015/05/apache-maven-305-yum-centos-71-x6486.html

[研究] Apache Maven 3.5.3 安裝 (Windows 2016)
http://shaurong.blogspot.com/2018/06/apache-maven-353-windows-2016.html

[研究] Apache Maven 3.2.2 (tar.gz)安裝 (CentOS 7.0 x64_86)
http://shaurong.blogspot.com/2014/08/apache-maven-322-targz-centos-70-x6486.html

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.0 x64_86)
http://shaurong.blogspot.com/2014/08/apache-maven-305-yum-centos-70-x6486.html

[研究] Apache Maven 3.1.1 (tar.gz)安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/11/apache-maven-311-centos-64-x64.html

[研究] Apache Maven 3.1.0 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/07/apache-maven-310-centos-64-x64.html

[研究] Apache Maven 3.0.3 (yum) 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/11/apache-maven-303-yum-centos-64-x64.html

沒有留言:

張貼留言