项目根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 >
注意:
不要在settingss中放置私人仓库配置.在xml中,项目建设应尽量减少对环境的依赖,以便在各种编译环境中快速成功编译,无需设置环境,减少环境配置时间,节省不必要的时间浪费
如果必须在settings中进行settings.xml配置私有仓库,如archetype项目的本地或环境建设,在settingss中.在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>