搭建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
- 基於Jenkins+Maven+Gitea+Nexus從0到1搭建CICD環境JenkinsMavenGit
- Linux下用nexus搭建maven私服LinuxMaven
- AndroidStudio+Nexus3.x搭建Maven私服AndroidS3Maven
- TestNG+Maven+IDEA環境搭建+測試MavenIdea
- VSCode+Maven+Hadoop開發環境搭建VSCodeMavenHadoop開發環境
- Jenkins之Nexus搭建Maven私有倉庫教程JenkinsMaven
- Nexus私有maven庫部署和使用Maven
- Windows環境下安裝NexusWindows
- Maven 環境配置Maven
- hadoop之旅5-idea通過maven搭建hdfs環境HadoopIdeaMaven
- 基於 idea+maven 的 jmeter 開發環境搭建IdeaMavenJMeter開發環境
- Eclipse配置maven環境EclipseMaven
- Maven多環境配置Maven
- 基於滴滴雲 CentOS 伺服器搭建 Nexus Maven 私庫CentOS伺服器Maven
- Maven環境下MyBatisGenerator 配置MavenMyBatis
- 環境搭建
- Nexus的搭建
- Ubuntu 18.04.1 搭建Java環境和HelloWorldUbuntuJava
- Elasticsearch快速入門和環境搭建Elasticsearch
- ZooKeeper 系列(二)—— Zookeeper單機環境和叢集環境搭建
- Linux 環境下安裝 Nexus 私服儲存庫Linux
- linux環境下搭建Jenkins持續整合(Jenkins+git+shell+maven+tomact)LinuxJenkinsGitMavenMac
- 『網際網路架構』軟體架構-環境搭建maven(三)架構Maven
- Maven私有倉庫-Nexus3MavenS3
- 搭建lnmp環境LNMP
- 搭建gym環境
- Linuxg環境搭建Linux
- JDK環境搭建JDK
- Angular環境搭建Angular
- anaconda 環境搭建
- ReactNative環境搭建React
- swoft 環境搭建
- Flutter環境搭建Flutter
- 搭建Java環境Java
- Supervisor 環境搭建
- react環境搭建React
- FNA環境搭建
- FNA 環境搭建