I am stumped. I am using ant and maven-ant-tasks to build and deploy snapshot artifacts (non-maven) to a remote nexus repository. The build process specifies the url of the repository. This is the ant target that is run:
<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>
And results in:
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
For some reason beyond my understanding, maven is trying to deploy to the public repository (not allowed by nexus) instead of the snapshot repository specified (note the nexus.url variable). No where in the build file is the public URL being specified.
To make things more curious, on one machine the same build script is successfully deploying the same artifact with this result:
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
where the URL specified is actually used. In comparing the two machines, both ant (version 1.8.1) and the maven-ant-tasks (2.1.3) are the same version. The nexus logs suggest that the incoming request is different between the two (where one specifies the snapshot repository and the other the public repository) so I want to pin this error on Maven. However, I haven't been able to determine any differences that would cause this.
What's going on?!
UPDATE:
After sniffing the packets we found that the request from maven was being sent to: /nexus/content/groups/public/com/xactsites/shared-resources/13.1.19.2/shared-resources-13.1.19.2.war HTTP/1.1, confirming that maven is changing the URL before sending the request. So, any efforts to solve this can focus on maven (not nexus).