您的位置:首页 > 其它

maven学习-settings配置

2016-01-11 00:36 507 查看
1.在settings中配置以上内容,意思是,如果需要下载新包先去私库下载,如果私库没有,私库会从中央库下载到私库,然后本地读取私库内容。

<profiles>
<profile>
<id>nexusProfile</id>
<repositories>
<!-- 私有库地址-->
<repository>
<id>nexus</id>
<url>http://192.168.1.175:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>


2.maven本地仓库路径

<localRepository>D:\Development tools\maven\windows\3.3.9\repository</localRepository>


3.配置权限,使用默认用户

<servers>
<server>
<id>nexus-releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>


4.覆盖所有路径配置,因为Central(中央工厂)默认的snapshots为false,所以覆盖它

<profiles>
<profile>
<id>centralProfile</id>
<repositories>
<!-- 私有库地址-->
<repository>
<id>central</id>
<url>http://*</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>


5.激活profile

<activeProfiles>

<activeProfile>centralProfile</activeProfile>
</activeProfiles>


6.配置镜像,想load私库或者中央库的jar包,必须经过私库,如果私库没有,私库从中央库load,然后本地库load私库

注明:mirrorOf也可以用*来标识,*标识所有

<mirrors>
<id>nexusMirrors</id>
<mirrorOf>nexus,central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://192.168.1.175:8081/nexus/content/groups/public/</url>
</mirrors>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: