nexus Maven私服的相关配置

Maven私服中如需本地上传Maven私服内容则需在  setting.xml中配置如下:

<server>
  <id>nexus-releases</id>
  <username>admin</username>
  <password>q.123456</password>
</server>
<server>
  <id>nexus-snapshots</id>
  <username>admin</username>
  <password>q.123456</password>
</server>

在pom.xml中如需使用 Maven 私服代理下载 :

<repositories>
    <repository>
        <id>nexus</id>
        <name>Nexus Repository</name>
        <url>http://192.168.27.137:8081/repository/maven-public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
        <name>Nexus Plugin Repository</name>
        <url>http://192.168.27.137:8081/repository/maven-public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>

如上  若需上传则应在pom.xml中配置如下,    注意: id 应一致

<distributionManagement>
    <repository>
        <id>nexus-releases</id>
        <name>Nexus Release Repository</name>
        <url>http://192.168.27.137:8081/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus-snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://192.168.27.137:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

 

posted @ 2016-02-28 13:46  X-POWER  阅读(485)  评论(0)    收藏  举报