mavennexus3mvn-repo

mvn deploy:deploy-file publish multiple files to nexus


We want to publish the artifacts using mvn command to the "release" repository in nexus (not SNAPSHOT), however running multiple commands to add new files to one of the version isnt possible (will fail with HTTP 400 error). So, can any one please share pom.xml where we can publish multiple files in one shot to nexus release repository ?

I have been trying to execute below 3 commands and 1st one succeeds and 2nd command fails

mvn deploy:deploy-file -DgroupId=com.jdk.mid-openjdk -DartifactId=jre -Dclassifier=windows-x86-64 -DrepositoryId=devsnc-releases -Dversion=11.0.8-ga -DgeneratePom=true -Dpackaging=zip -Durl=http://nexus/content/repositories/releases -Dfile=jre-jdk-11.0.8-hk-windows-x86-64.zip -DgeneratePom=true
mvn deploy:deploy-file -DgroupId=com.jdk.mid-openjdk -DartifactId=jre -Dclassifier=linux-x86-64 -DrepositoryId=devsnc-releases -Dversion=11.0.8-ga -DgeneratePom=true -Dpackaging=zip -Durl=http://nexus/content/repositories/releases -Dfile=jre-jdk-11.0.8-hk-linux-x86-64.zip -DgeneratePom=true
mvn deploy:deploy-file -DgroupId=com.jdk.mid-openjdk -DartifactId=jre -Dclassifier=windows-x86-32 -DrepositoryId=devsnc-releases -Dversion=11.0.8-ga -DgeneratePom=true -Dpackaging=zip -Durl=http://nexus/content/repositories/releases -Dfile=jre-jdk-11.0.8-hk-windows-x86-32.zip -DgeneratePom=true

Solution

  • You can use classifiers instead of classifier and files instead of file. Then you can first give the list of classifiers and then the list of files to upload.

    See also:

    https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html