maven探究四:在maven中配置nexus作为私服仓库
2017-04-19 16:02
405 查看
让maven项目使用nexus作为远程仓库有两种方式,第一种是在项目的pom.xml中进行更改,让单个项目使用nexus仓库;另一种是通过修改maven的配置文件settings.xml进行更改,让所有项目都使用nexus仓库。第一种方式需要针对每个项目都进行配置,较为繁琐。故建议选择第二种配置方式,一次性到位。
进入maven安装目录的conf文件夹打开,修改settings.xml文件。
<profile>
<id>nexusprofile</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus repository</name>
<url>http://192.168.x.x:8181/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexusprofile</activeProfile>
</activeProfiles>注意: <activeProfile>标签的目的是激活上面的profile配置功能,一定要加上。 而且标签中的内容一定要和profile当中的id保持一致。
配置成功后,maven工程在下载依赖的时候,会自动从nexus私服当中下载,如果nexus当中没有,则nexus会自动从maven中央仓库下载,并缓存在nexus当中。
进入maven安装目录的conf文件夹打开,修改settings.xml文件。
<profile>
<id>nexusprofile</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus repository</name>
<url>http://192.168.x.x:8181/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexusprofile</activeProfile>
</activeProfiles>注意: <activeProfile>标签的目的是激活上面的profile配置功能,一定要加上。 而且标签中的内容一定要和profile当中的id保持一致。
配置成功后,maven工程在下载依赖的时候,会自动从nexus私服当中下载,如果nexus当中没有,则nexus会自动从maven中央仓库下载,并缓存在nexus当中。
相关文章推荐
- maven仓库--私服(Nexus的配置使用)
- nexus(Maven仓库私服)的安装、配置、使用和仓库迁移
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服 Nexus的配置使用
- nexus(Maven仓库私服)的安装、配置、使用和仓库迁移
- Nexus OSS私服仓库的安装和配置以及与Maven整合配置
- maven 安装 配置 私服 中央仓库 nexus 快照版本 正式版本 吐血整理
- 让Maven项目使用Nexus作为远程仓库的settings.xml配置
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)
- nexus(Maven仓库私服)的安装、配置、使用和仓库迁移
- Nexus OSS私服仓库的安装和配置以及与Maven整合配置
- maven仓库--私服(Nexus的配置使用)
- maven仓库--私服(Nexus的配置使用)