一 下载apache-maven-3.2.5
将maven中的D:\Software\apache-maven-3.2.5\conf\settings.xml拷贝到C:\Users\admin.m2中(也可以不用拷贝).
二 修改setting.xml文件
- 在servers节点下增加以下内容
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
- 在mirrors节点下增加以下内容
<mirror>
<id>central</id>
<mirrorOf>*</mirrorOf> <!-- * 表示让所有仓库使用该镜像-->
<name>central-mirror</name>
<url>http://192.168.1.36:8081/nexus/content/groups/public/</url>
</mirror>
三 修改项目中的pom.xml文件
在pom.xml的project节点下,增加以下内容
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://192.168.1.36:8081/nexus/content/repositories/snapshots/</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://192.168.1.36:8081/nexus/content/repositories/releases/</url>
</repository>
</distributionManagement>
这样配置完成后就可以从私服download文件和deploy到私服中,以SNAPSHOT结尾的会默认加入到http://192.168.1.36:8081/nexus/content/repositories/snapshots/仓库中
以RELEASES结尾的会默认加入http://192.168.1.36:8081/nexus/content/repositories/releases/中.
默认从http://192.168.1.36:8081/nexus/content/repositories/central/中download jar文件.
这样我们就可以开始使用maven管理项目了