Usage of maven deploy-file

I usually use deploy:deploy-file in command-line, when I have an 3rd-party artifact without its pom.xml:

cmd /v /c "set a=an-artifact-name&& set g=com.company.xxx&& \
mvn deploy:deploy-file -Dfile=C:\path\to\!a!.jar -Dpackaging=jar -DgroupId=!g! -DartifactId=!a! \
-Dversion=1.0-DEV-SNAPSHOT -DrepositoryId=nexus \
-Durl=http://company.com/nexus/content/repositories/company-snapshots/"

All you need to do is to modify a and g at the beginning of the command.

You can add a version v if you have a specific version, and put it in the release part of your Nexus:

cmd /v /c "set a=an-artifact-name&& set g=com.company.xxx&& && set v=1.2.3&& \
mvn deploy:deploy-file -Dfile=C:\path\to\!a!.jar -Dpackaging=jar -DgroupId=!g! -DartifactId=!a! \
-Dversion=!v! -DrepositoryId=nexus \
-Durl=http://company.com/nexus/content/repositories/company-releases/"

The plugin "Usage" page (https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) states:

If the following required information is not specified in some way, the goal will fail:

  • the artifact file to deploy
  • the group, artifact, version and packaging of the file to deploy. These can be taken from the specified pomFile, and overriden or specified using the command line. When the pomFile contains a parent section, the parent's groupId can be considered if the groupId is not specified further for the current project or on the command line.
  • the repository information: the url to deploy to and the repositoryId mapping to a server section in the settings.xml file. If you don't specify a repositoryId, Maven will try to extract authentication information using the id 'remote-repository'.

So you either need to specify the coordinates or give a POM file.

Tags:

Maven