私は困惑しています。ant および maven-ant-tasks を使用して、スナップショット アーティファクト (Maven 以外) をビルドし、リモート ネクサス リポジトリにデプロイしています。ビルド プロセスは、リポジトリの URL を指定します。これは、実行される ant ターゲットです。
<target name="shared_resources_war_deploy" depends="shared_resources_war">
<artifact:pom id="sharedResourcesPom" file="${resourcesdir}/shared-resources-pom.xml" />
<echo message="**************************${nexus.url}*************************" />
<artifact:deploy file="${resourcesdir}/shared-resources.war">
<remoteRepository url="${nexus.url}">
<authentication username="${nexusUserName}" password="${nexusUserPassword}" />
</remoteRepository>
<pom refid="sharedResourcesPom"/>
</artifact:deploy>
</target>
結果は次のようになります。
shared_resources_war_deploy:
[echo] **************************http://${nexusIP}:8081/nexus/content/repositories/snapshots*************************
[artifact:deploy] Deploying to http://${nexusIP}:8081/nexus/content/groups/public
[artifact:deploy] [INFO] Retrieving previous build number from nexus
[artifact:deploy] Uploading: com/xactsites/shared-resources/13.1.19-SNAPSHOT/shared-resources-13.1.19-20121211.172831-28.war to repository nexus at http://${nexusIP}:8081/nexus/content/groups/public
[artifact:deploy] Transferring 2K from nexus
[artifact:deploy] An error has occurred while processing the Maven artifact tasks.
[artifact:deploy] Diagnosis:
[artifact:deploy]
[artifact:deploy] Error deploying artifact 'com.xactsites:shared-resources:war': Error deploying artifact: Failed to transfer file: http://${nexusIP}:8081/nexus/content/groups/public/com/xactsites/shared-resources/13.1.19-SNAPSHOT/shared-resources-13.1.19-20121211.172831-28.war. Return code is: 400
[artifact:deploy]
BUILD FAILED
C:\Users\11_1_15\build.xml:561: The following error occurred while executing this line:
C:\Users\11_1_15\build.xml:551: Error deploying artifact 'com.xactsites:shared-resources:war': Error deploying artifact: Failed to transfer file: http://${nexusIP}:8081/nexus/content/groups/public/com/xactsites/shared-resources/13.1.19-SNAPSHOT/shared-resources-13.1.19-20121211.172831-28.war. Return code is: 400
私の理解を超えた何らかの理由で、maven は、指定されたスナップショット リポジトリではなく、パブリック リポジトリ (nexus では許可されていません) にデプロイしようとしています (nexus.url 変数に注意してください)。ビルド ファイルのどこにパブリック URL が指定されているかはわかりません。
さらに興味深いことに、あるマシンで同じビルド スクリプトが同じアーティファクトを正常にデプロイし、次の結果が得られています。
shared_resources_war_deploy:
[echo] **************************http://${nexusIP}:8081/nexus/content/repositories/snapshots*************************
[artifact:deploy] Deploying to http://${nexusIP}:8081/nexus/content/repositories/snapshots
[artifact:deploy] [INFO] Retrieving previous build number from remote
[artifact:deploy] Uploading: com/xactsites/shared-resources/13.1.19-SNAPSHOT/shared-resources-13.1.19-20121211.172031-27.war to repository remote at http://${nexusIP}:8081/nexus/content/repositories/snapshots
[artifact:deploy] Transferring 2K from remote
[artifact:deploy] Uploaded 2K
[artifact:deploy] [INFO] Retrieving previous metadata from remote
[artifact:deploy] [INFO] Uploading repository metadata for: 'snapshot com.xactsites:shared-resources:13.1.19-SNAPSHOT'
[artifact:deploy] [INFO] Uploading project information for shared-resources 13.1.19-20121211.172031-27
[artifact:deploy] [INFO] Retrieving previous metadata from remote
[artifact:deploy] [INFO] Uploading repository metadata for: 'artifact com.xactsites:shared-resources'
BUILD SUCCESSFUL
指定された URL が実際に使用される場所。2 つのマシンを比較すると、ant (バージョン 1.8.1) と maven-ant-tasks (2.1.3) は同じバージョンです。nexus ログは、着信要求が 2 つの間で異なることを示唆しているため (1 つはスナップショット リポジトリを指定し、もう 1 つはパブリック リポジトリを指定します)、このエラーを Maven に固定したいと考えています。ただし、これを引き起こす違いを特定することはできませんでした。
どうしたの?!
アップデート:
パケットをスニッフィングした後、Maven からのリクエストが /nexus/content/groups/public/com/xactsites/shared-resources/13.1.19.2/shared-resources-13.1.19.2.war HTTP/1.1,リクエストを送信する前に、maven が URL を変更していることを確認します。したがって、これを解決するための努力は、(ネクサスではなく) Maven に集中できます。