内部 nexus リポジトリにデプロイするプロジェクトを設定しようとしているときに、現在問題が発生しています。私は一般的にMavenに慣れていないので、ディストリビューション管理の設定方法について、私が本当に理解していないことがあると思います。
基本的な問題は、「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 に正しい設定があり、実際にスナップショットを正常にデプロイしています。
問題は、スナップショットを許可しないように構成されているリリース リポジトリにもスナップショットをデプロイしようとすることです。
「mvn deploy」からの出力には、次のものが含まれます。
[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