转:
http://blog.csdn.net/shenshen123jun/article/details/9084293
<localRepository>D:\Maven\repository</localRepository>
<servers>
<server>
<id>nexus-releases</id>
<username>hunan</username>
<password>hunan</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>hunan</username>
<password>hunan</password>
</server>
</servers>
<mirror>
<id>nexus-mirror</id>
<url>http://localhost:8081/nexus/content/repositories/central/</url>
<mirrorOf>*</mirrorOf>
</mirror>
<profiles>
<profile>
<id>nexus-profile</id>
<repositories>
<repository>
<id>nexus-repository</id>
<url>http://nexus-mirror</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus-plugin-repository</id>
<url>http://nexus-mirror</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus-profile</activeProfile>
</activeProfiles>
如果开发中需要发布jar到Maven私服,提供给其他开发者下载,则需要在pom.xml文件中申明如下:
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Internal Releases Repository</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Internal Snapshots Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>