6

I am trying to deploy signature files separately using deploy-file goal to Nexus staging repository, but I noticed that mvn deploy plugin removes the extension. My file is something like: azerty-0.1.jar.asc

but the file that gets deployed is: azerty-0.1.asc

I tried adding a classifier: -Dclassifier=jar

the file that gets deployed is: azerty-0.1-jar.asc

This seems like a strange behaviour.

Question: Any ideas how to work around it?

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128
zakaria amine
  • 3,412
  • 2
  • 20
  • 35

1 Answers1

6

This is rather a normal behavior, Maven is using the file extension as artefact packaging, from maven-deploy-plugin, deploy-file, packaging option:

Type of the artifact to be deployed. Retrieved from the <packaging> element of the POM file if a POM file specified. Defaults to the file extension if it is not specified via command line or POM.

Note: bold is mine.

Moreover, the classifier option would indeed add an - between the version and the string provided as classifier: that's maven convention.

In your case you want to specify a special packaging, which would be jar.asc if you really want the remote file to have as extension jar.asc.

The following would hence work:

mvn deploy:deploy-file -Dfile=azerty-0.1.jar.asc -Dpackaging=jar.asc -DrepositoryId=your_id -Durl=http://your_repository -DgroupId=your_groupId -DartifactId=azerty -Dversion=0.1

Note the -Dpackaging=jar.asc which effectively tells Maven the file extension would be jar.asc.


As a general note, if you are using the repository as a build store, that would still be reasonable, otherwise in your case you would push to a Maven repository an artifact which would then be difficult (or rather weird) to import in a project.

If instead this is really an additional artifact of your project, you should look at the attach-artifact goal of the build-helper-maven-plugin, to effective define it as additional artifact, then Maven will automatically add it to its install and deploy phase.

A_Di-Matteo
  • 26,902
  • 7
  • 94
  • 128