Maven把项目发布到私服

第一步:在需要发布的项目的pom.xml文件中添加如下配置

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Releases</name>
        <!-- releases版本私服地址 -->
        <url>http://192.168.2.186:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Nexus Snapshots</name>
        <!-- snapshots版本私服地址 -->
        <url>http://192.168.2.186:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

第二步:在maven的settings.xml配置文件中添加私服的用户名与密码

<servers>  
    <server>  
        <id>releases</id>  
        <username>admin</username>  
        <password>admin123</password>  
    </server>  
    <server>  
        <id>snapshots</id>  
        <username>admin</username>  
        <password>admin123</password>  
    </server>
</servers>

第三步:对需要发布的maven项目运行deploy命令

猜你喜欢

转载自blog.csdn.net/u010695008/article/details/51791832