nexus3 搭建maven远程仓库
右上角
下载maven
http://maven.apache.org/download.cgi
下载nexus
https://www.sonatype.com/download-oss-sonatype
下载nexus版本为: nexus-3.8.0-02-win64.zip
解压后目录如图
进入到bin目录下,如图
执行:nexus.exe /run 启动 nexus
启动后访问:http://localhost:8081/ 界面如图
右上角登录:默认用户名密码为 admin/admin123
登录后界面多了设置操作如下图:
maven 配置使用nexus
settings.xml中设置
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.3.20:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://192.168.3.20:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
最后激活profile
新建一个maven项目发现开始从nexus远程仓库开始下载依赖包
将本地项目部署至nexus远程仓库
项目中pom文件做如下配置
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Releases Repository</name>
<url>http://127.0.0.1:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshots Repository</name>
<url>http://127.0.0.1:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
settings.xml中做如下配置
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
切记此处配置的 id应与上面pom中配置的id保持一致
执行 mvn deploy即可将项目部署至nexus远程仓库