maven發佈jar到nexus

項目的pom.xml中指定要部署的倉庫地址:服務器

<distributionManagement>
    <repository>
        <id>nexus-releases</id>
        <name>Nexus Internal Releases Repository</name>
        <url>http://192.168.1.226:88/content/repositories/releases/</url>
    </repository>

    <snapshotRepository>
        <id>nexus-snapshots</id>
        <name>Nexus Internal Snapshots Repository</name>
        <url>http://192.168.1.226:88/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

可在nexus的Repositories中的summary中copy:url

輸入圖片說明

在用戶目錄/.m2/settings.xml中添加配置code

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

提示,此處用戶名和密碼可從nexus服務器上獲取, id須要同發佈工廠中的id保持一致。server

Nexus配置:xml

點擊Security,找到eployment用戶,再右鍵Set Password 設置密碼,此處設置爲admin123。 啓用Releases的發佈權限圖片

相關文章
相關標籤/搜索