搭建Maven和Nexus環境
下載Maven和Nexus
apache-maven-3.3.9
nexus-2.12.0-01
解壓nexus,進入目錄
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>
安裝服務
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>nexus.bat install
啟動服務
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>nexus.bat start
wrapper | Starting the nexus service...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | nexus started.
訪問如下地址測試Nexus私服是否安裝成功
http://127.0.0.1:8081/nexus
管理員的預設密碼是
admin/admin123
同步Maven中央庫的索引檔案
修改配置,下載遠端的索引
然後Repair索引.
可以看到正在執行的RepairIndex的任務.
在專案的pom.xml檔案中,配置私服地址
或者拷貝maven/conf/settings.xml檔案到使用者家目錄的.m2資料夾下
修改該檔案
如果需要從本地釋出jar包到私服
需要先在私服上建立一個賬號
設定使用者,注意許可權
然後在專案的pom中加入如下配置
然後修改家目錄.m2檔案下的settings.xml檔案
標紅的ID需要一致.
這時候執行如下命令
E:\workspace\test>mvn clean deploy
就可以將jar包直接釋出在私服了.
參考:
http://tianweili.github.io/blog/2015/03/17/linux-nexus-maven-private-server/
apache-maven-3.3.9
nexus-2.12.0-01
解壓nexus,進入目錄
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>
安裝服務
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>nexus.bat install
啟動服務
D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin>nexus.bat start
wrapper | Starting the nexus service...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | Waiting to start...
wrapper | nexus started.
訪問如下地址測試Nexus私服是否安裝成功
http://127.0.0.1:8081/nexus
管理員的預設密碼是
admin/admin123
同步Maven中央庫的索引檔案
修改配置,下載遠端的索引
然後Repair索引.
可以看到正在執行的RepairIndex的任務.
在專案的pom.xml檔案中,配置私服地址
-
<repositories>
-
<repository>
-
<id>nexus</id>
-
<name>Team Nexus Repository</name>
-
<url>http://localhost:8081/nexus/content/groups/public</url>
-
</repository>
-
</repositories>
-
<pluginRepositories>
-
<pluginRepository>
-
<id>nexus</id>
-
<name>Team Nexus Repository</name>
-
<url>http://localhost:8081/nexus/content/groups/public</url>
-
</pluginRepository>
- </pluginRepositories>
或者拷貝maven/conf/settings.xml檔案到使用者家目錄的.m2資料夾下
修改該檔案
-
<mirrors>
-
<mirror>
-
<id>central</id>
-
<mirrorOf>*</mirrorOf> <!-- * 表示讓所有倉庫使用該映象-->
-
<name>central-mirror</name>
-
<url>http://localhost:8081/nexus/content/groups/public/</url>
-
</mirror>
- </mirrors>
如果需要從本地釋出jar包到私服
需要先在私服上建立一個賬號
設定使用者,注意許可權
然後在專案的pom中加入如下配置
-
<distributionManagement>
-
<repository>
-
<id>deployment</id>
-
<name>Nexus Release Repository</name>
-
<url>http://127.0.0.1:8081/nexus/content/repositories/releases</url>
-
</repository>
-
<snapshotRepository>
-
<id>deployment</id>
-
<name>Nexus Snapshot Repository</name>
-
<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots</url>
-
</snapshotRepository>
- </distributionManagement>
然後修改家目錄.m2檔案下的settings.xml檔案
-
<servers>
-
<server>
-
<id>deployment</id>
-
<username>dev</username>
-
<password>123456</password>
-
</server>
- </servers>
標紅的ID需要一致.
這時候執行如下命令
E:\workspace\test>mvn clean deploy
就可以將jar包直接釋出在私服了.
參考:
http://tianweili.github.io/blog/2015/03/17/linux-nexus-maven-private-server/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-1973387/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Maven 環境搭建Maven
- MAVEN環境搭建Maven
- docker搭建Nexus搭建Maven私服DockerMaven
- 基於Jenkins+Maven+Gitea+Nexus從0到1搭建CICD環境JenkinsMavenGit
- 使用Maven+Nexus+Jenkins+Svn+Tomcat+Sonar搭建持續整合環境(一)MavenJenkinsTomcat
- 使用Maven+Nexus+Jenkins+Svn+Tomcat+Sonar搭建持續整合環境(二)MavenJenkinsTomcat
- Maven環境搭建和介紹Maven
- Maven基礎:Maven環境搭建及基本使用(1)Maven
- Maven私服Nexus3.x環境構建操作記錄MavenS3
- maven學習(中)- 私服nexus搭建Maven
- 使用Nexus搭建Maven本地倉庫Maven
- maven 學習總結(九)——使用Nexus搭建Maven私服Maven
- Linux下用nexus搭建maven私服LinuxMaven
- TestNG+Maven+IDEA環境搭建+測試MavenIdea
- IDEA使用Maven搭建spark開發環境(scala)IdeaMavenSpark開發環境
- Nexus私有maven庫部署和使用Maven
- Windows環境下安裝NexusWindows
- AndroidStudio+Nexus3.x搭建Maven私服AndroidS3Maven
- Jenkins之Nexus搭建Maven私有倉庫教程JenkinsMaven
- VSCode+Maven+Hadoop開發環境搭建VSCodeMavenHadoop開發環境
- 多環境支援-Maven和Spring的ProfileMavenSpring
- 基於 idea+maven 的 jmeter 開發環境搭建IdeaMavenJMeter開發環境
- Jenkins+Maven+SVN快速搭建持續整合環境(轉)JenkinsMaven
- Android業務元件化之Gradle和Sonatype Nexus搭建私有maven倉庫Android元件化GradleMaven
- 環境搭建
- Eclipse配置maven環境EclipseMaven
- Maven環境下MyBatisGenerator 配置MavenMyBatis
- JDK環境配置 maven環境配置 eclipse關聯+maven+svn+tomcatJDKMavenEclipseTomcat
- Elasticsearch快速入門和環境搭建Elasticsearch
- CentOS 7.3搭建LAMP環境和WordpressCentOSLAMP
- hadoop之旅5-idea通過maven搭建hdfs環境HadoopIdeaMaven
- Maven 學習筆記——Maven環境配置(1)Maven筆記
- windows環境下Django環境搭建WindowsDjango
- ZooKeeper 系列(二)—— Zookeeper單機環境和叢集環境搭建
- Maven 打包釋出到nexusMaven
- 基於滴滴雲 CentOS 伺服器搭建 Nexus Maven 私庫CentOS伺服器Maven
- react環境搭建React
- LNMP 環境搭建LNMP