我在嘗試設置項目以部署到內部聯繫存儲庫時目前遇到問題。由於我對整個Maven都比較陌生,因此我認爲在如何建立分銷管理方面我並沒有真正理解的東西。爲什麼Maven(錯誤地?)將我的SNAPSHOT部署到版本庫和快照庫?
基本問題是,當我執行「mvn deploy」時,工件已成功部署到快照存儲庫,但Maven也試圖將其部署到發佈存儲庫,因爲它應該是失敗的。我對當前配置的理解是,它不應該將其部署到發佈存儲庫。
我已經包含了各種配置元素下方,但如果我其實應該是管理與配置文件中的部分,以便建立快照只定義,併發布版本只定義我想知道。
對此的任何幫助/澄清將不勝感激。
我在我的POM配電管理的以下內容:
<distributionManagement>
<repository>
<id>internal-releases</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>internal-snapshots</id>
<name>Internal Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
其他地方我有以下設置爲允許使用這些存儲庫中獲得文物POM:
<repositories>
<repository>
<id>internal-releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>internal-snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- other repos, etc, etc -->
</repositories>
我在我的settings.xml中有正確的設置來提供證書,以便能夠發佈到我的計算機上運行的此測試nexus實例,並且實際上它正在成功部署快照。
的問題是,它也試圖部署快照釋放存儲庫,它被配置爲禁止快照。
從「MVN部署」輸出包括以下內容:
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from internal-snapshots
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-8.war
405K uploaded (service-1.0.0-20101104.170338-8.war)
[INFO] Retrieving previous metadata from internal-snapshots
[INFO] Uploading repository metadata for: 'snapshot com.internal:service:1.0.0-SNAPSHOT'
[INFO] Retrieving previous metadata from internal-snapshots
[INFO] Uploading repository metadata for: 'artifact com.internal:service'
[INFO] Uploading project information for service 1.0.0-20101104.170338-8
[INFO] [deploy:deploy-file {execution: default}]
[INFO] Retrieving previous build number from remote-repository
[INFO] repository metadata for: 'snapshot com.internal:service:1.0.0-SNAPSHOT' could not be found on repository: remote-repository, so will be created
Uploading: http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Failed to transfer file: http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar. Return code is: 400
Nexus的日誌包含以下(因爲我希望它):
jvm 1 | 2010-11-04 13:03:39 INFO [p-759477796-118] - o.s.n.p.m.m.M2Repos~ - Storing of item releases:/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar is forbidden by Maven Repository policy. Because releases is a RELEASE repository
jvm 1 | 2010-11-04 13:03:39 ERROR [p-759477796-118] - o.s.n.r.ContentPlex~ - Got exception during processing request "PUT http://localhost:8081/nexus/content/repositories/releases/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar": Storing of item releases:/com/internal/service/1.0.0-SNAPSHOT/service-1.0.0-20101104.170338-1.jar is forbidden by Maven Repository policy. Because releases is a RELEASE repository
的神器版本是1.0.0,快照,因此沒有。 – imaginaryboy 2010-11-06 02:52:56
這個答案應該是一個評論,我想 – 2016-03-11 16:11:17