maven deploy時報錯

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project admin: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

pom文件沒有配置distributionManagement:

發佈倉庫一般分爲Releases版和snapshot版,所以要配置2個倉庫地址 

<distributionManagement>
    <repository>
        <id>nexus-releases</id>
        <name>corp nexus-releases</name>
        <url>http://你的nexusIP:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus-snapshot</id>
        <name>corp nexus-snapshot</name>
        <url>http://你的nexusIP:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

在setting.xml中添加配置:

<servers>
    <!-- 發佈Releases版的賬號,ID要與distributionManagement中的Releases ID一致 -->
    <server>
        <id>nexus-releases</id>
        <username>admin</username>
        <password>******</password>
    </server>
    <!-- 發佈snapshot版的賬號,ID要與distributionManagement中的snapshot ID一致 -->
    <server>
        <id>nexus-snapshot</id>
        <username>admin</username>
        <password>******</password>
    </server>
</servers>

默認密碼是 deployment123,也可以自定義密碼,然後去Nexus後臺修改對應的密碼,在登陸後界面左側Security下的Users下修改密碼。其實本人已經配置了上面這些內容,但依然報錯的原因其實是我的項目是多模塊的,我只在一個模塊的pom裏配置了distributionManagement,但是我卻用另一個模塊打包,當然會報錯。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章