1.准備條件
找到maven的安裝目錄--》conf目錄--》settings.xml文件,例如:D:\apache-maven-3.5.3\conf
2.倉庫配置
第一,本地倉庫
找到settings標簽,緊挨着它就是被注釋掉的localRepository標簽,在這個位置配置<localRepository></localRepository>並設置倉庫位置即可。例如:
<!-- 指定maven本地倉庫位置 --> <localRepository>D:\repository-maven</localRepository>
第二,中央倉庫
找到mirrors標簽,緊挨着它就是被注釋掉的mirror標簽,在這個位置配置<mirror></mirror>並設置倉庫位置即可。例如:
<!-- 指定中央倉庫 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<!-- <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> -->
<mirrorOf>central</mirrorOf>
</mirror>
第三,私庫
找到profiles標簽,緊挨着它就是被注釋掉的profile標簽,在這個位置配置<profile></profile>並設置倉庫位置。例如:
<!--私服倉庫配置-->
<profile>
<id>profile-nexus</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://192.168.57.182:8081/nexus/content/groups/public/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://192.168.57.182:8081/nexus/content/groups/public/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</pluginRepository>
</pluginRepositories>
</profile>
並且,需要在profiles標簽體外添加activeProfiles標簽,引用該私服
</profiles>
<!--私服倉庫配置-->
<activeProfiles>
<activeProfile>profile-nexus</activeProfile>
<activeProfile>nexus</activeProfile>
</activeProfiles>
jar包下載順序:
本地倉庫--》nexus私服倉庫--》線上的中央倉庫
