ITeye博客

maven本地配置规范

1028826685 · 2018-06-26 17:34 · Maven · 互联网 · Markdown

关于私有仓库配置

放在项目根pom.xml文件中

 

 

<repositories>

<repository>

<id>internal repository</id>

<name>Local repository</name>

         

<url>https://xxx/artifactory/libs-snapshot-local</url>

<snapshots>

<enabled>true</enabled>

<updatePolicy>interval:30</updatePolicy>

<checksumPolicy>warn</checksumPolicy>

</snapshots>

</repository>

</repositories>

注意:

私有库配置不要放在settings.xml中,项目构建要尽量减少对环境的依赖,这样在多种编译环境,都可以快速的成功编译,而不需要对环境做各种设置,减少环境配置时间,节省无谓时间浪费

 

如果有必须在settings.xml中配置私有仓库情况,如:archetype项目的本地或构建环境构建,在settings.xml下使用profile形式加载私有库配置

 

 

<profiles>

<profile>

<id>archetype</id>

<repositories>

<repository>

<id>archetype</id>

<url>http://xxx/libs-snapshot-local</url>

<releases>

<enabled>true</enabled>

<checksumPolicy>fail</checksumPolicy>

</releases>

<snapshots>

<enabled>true</enabled>

<checksumPolicy>warn</checksumPolicy>

</snapshots>

</repository>

</repositories>

</profile>

</profiles>

 

添加阿里云加速镜像~/.m2/settings.xml 镜像配置

编辑 ~/.m2/settings.xml , 在<settings></settings>下加入下面配置

 

 

<mirrors>

<mirror>

<id>nexus-aliyun</id>

<mirrorOf>central</mirrorOf>

<name>Nexus aliyun</name>

<url>http://maven.aliyun.com/nexus/content/groups/public/</url>

</mirror>

</mirrors>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。