【記錄一下】linux 安裝maven 私服

1、 maven 下載,或者官方下

https://maven.apache.org/download.cgi#

鏈接:https://pan.baidu.com/s/1uI4Wh7NVTXj6rK66ZAP-nQ 
提取碼:aovs 

複製這段內容後打開百度網盤手機App,操作更方便哦

2、解壓縮maven’

tar -zxvf apache-maven-3.5.2-bin.tar.gz 

3、我這裏將maven解壓縮之後的路徑爲:/opt/mavenDir

4、配置maven環境變量

vi /etc/profile

添加環境變量

export JAVA_HOME=/usr/local/java/jdk1.8.0_181  
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  

export M3_HOME=/opt/apache-maven-3.6.3
export PATH=${JAVA_HOME}/bin:${M3_HOME}/bin:$PATH

編輯之後記得使用命令是改動生效。

source /etc/profile

5、驗證結果
在任意路徑下執行mvn -version驗證命令是否有效。

mvn -v

Maven 私有庫和本地庫的安裝與配置:


鏈接:https://pan.baidu.com/s/1t34HTulagWCF7hptPtDLXQ 
提取碼:25fc 
複製這段內容後打開百度網盤手機App,操作更方便哦

或者 docker https://cloud.tencent.com/developer/article/1478468
解壓

tar -zxvf nexus-2.11.2-03-bundle.tar.gz
cd nexus-3.23.0-03/bin/
#啓動nexus 
./nexus start   
./nexus stop

#查看進程
ps aux|grep nexus

#設置開機啓動
cp /opt/nexus-3.23.0-03/bin/nexus /etc/init.d/
cd /etc/init.d/
chkconfig nexus on

訪問:http://XXX.XXX.XX.XX:8081/

安裝完成

配置maven setting.xml文件apache-maven-3.6.3/conf

  <servers>
	<server>
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
 </servers>

pom 文件配置

<distributionManagement>
		<!--快照倉庫-->
		<snapshotRepository>
			<id>nexus</id>
			<name>maven-snapshots-repository</name>
			<url>http://1xx0.76.98.1xx:8081/repository/maven-releases/</url>
		</snapshotRepository>
		<!--發行倉庫-->
		<repository>
			<!--與maven set server的id一致-->
			<id>nexus</id>
			<name>maven-releases-repository</name>
		<!--	倉庫地址,從nexus中可以找到-->
			<url>http://1xx.76.98.1xx:8081/repository/maven-snapshots//</url>
		</repository>
	</distributionManagement>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章