2

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
hare krshn
  • 176
  • 1
  • 4
  • 16
  • Do I understand you correctly: You have a main artifact together with some side artifacts (with classifiers) that you want to deploy? – J Fabian Meier Aug 13 '20 at 10:05
  • Yes correct @JFabianMeier – hare krshn Aug 13 '20 at 10:06
  • The second fails simply cause with the first one you have created a release in Nexus and Neuxs fails correctly cause a release is immutable. Furthermore why are you using deploy-file ? Are those artifacts being created during a maven build? – khmarbaise Aug 13 '20 at 10:11
  • @khmarbaise : Artifacts were generated withouot maven build ..built using linux compiler, so finding the way on how to upload multiple artifacts to nexus (with groupId, artifactid,classifiers and versions included) – hare krshn Aug 13 '20 at 10:13

1 Answers1

3

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

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • Tried that, i am getting an error "The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file are missing or invalid -> [Help 1]", below is the command tried as you suggested : ```mvn deploy:deploy-file -DgroupId=com.jdk.mid-openjdk -DartifactId=jre -Dclassifiers=windows-x86-64 -DrepositoryId=devsnc-releases -Dversion=11.0.8-ga -DgeneratePom=true -Dpackaging=zip -Durl=http://nexus/content/repositories/releases -Dfiles=jre-jdk-11.0.8-hk-windows-x86-64.zip -DgeneratePom=true ``` – hare krshn Aug 13 '20 at 10:50
  • You need to list all classifiers and all files, not just one. – J Fabian Meier Aug 13 '20 at 10:54
  • Can you give me an example, should it be like this : ```mvn deploy:deploy-file -DgroupId=com.jdk.mid-openjdk -DartifactId=jre -Dclassifiers=windows-x86-64,windows-x86-32,linux-x86-64 -DrepositoryId=devsnc-releases -Dversion=11.0.8-ga -DgeneratePom=true -Dpackaging=zip -Durl=http://nexus/content/repositories/releases -Dfiles=jre-jdk-11.0.8-hk-windows-x86-64.zip,jre-jdk-11.0.8-hk-windows-x86-32.zip,jre-jdk-11.0.8-hk-linux-x86-64.zip -DgeneratePom=true ``` – hare krshn Aug 13 '20 at 11:02
  • This is how I would understand the documentation. – J Fabian Meier Aug 13 '20 at 11:03
  • Well - i am still getting this - `"The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file are missing or invalid -> [Help 1]"` – hare krshn Aug 13 '20 at 11:06
  • Sorry, I misread the documentation. The main artifact (without the classifier) needs to be put into `file`, the side artifacts (with the classifiers) are put under `files`. – J Fabian Meier Aug 13 '20 at 11:25