提交到nexus時候報錯:
Downloading: http://nexus.easypeng.lab:8082/nexus/content/repositories/snapshots/com/easypeng/framework/template/framework-template/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.easypeng.framework.template:framework-template:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http://nexus.easypeng.lab:8082/nexus/content/repositories/snapshots/): Connect to nexus.easypeng.lab:8082 [nexus.easypeng.lab/127.0.0.1] failed: Connection refused: connect
端口號錯誤
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project framework-template: Failed to deploy artifacts: Could not transfer artifact com.easypeng.framework.template:framework-template:war:1.0-20170721.105730-3 from/to snapshots1 (http://nexus.easypeng.lab:8081/nexus/content/repositories/snapshots/): Failed to transfer file: http://nexus.easypeng.lab:8081/nexus/content/repositories/snapshots/com/easypeng/framework/template/framework-template/1.0-SNAPSHOT/framework-template-1.0-20170721.105730-3.war. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
setting.xml 和pom.xml 文件的id 不一致
原來是沒有配置認證。
maven目錄conf的setting.xml裏,
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
用戶名和密碼都是nexus的。再次deploy即可。
**注意這裏的id要和pom.xml裏遠程deploy的地址對應一致,我的pom.xml裏配置:**
<!-- 配置遠程發佈到私服,mvn deploy -->
<distributionManagement>
<repository>
<id>releases</id>
<name>Nexus Release Repository</name>
<url>http://10.1.81.199:8081/nexu
s/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://10.1.81.199:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
如果這裏不配置,會報錯:
報錯:Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project Git-demo: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
nexus maven setting 和pom 文件配置
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.