Reading the doc. of the deploy:deploy-file
(https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html), it seems that the only required parameters are
Required Parameters <file>, <repositoryId> and <url>
,
nevertheless when I run :
mvn deploy:deploy-file -Durl={url} -DrepositoryId={repoId} -Dfile=D:\Users\nunito\IdeaProjects\calzada\target\calzada.zip
I got this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project oib-kw-guards-web: The artifact i
nformation is incomplete or not valid:
[ERROR] [0] 'groupId' is missing.
[ERROR] [1] 'artifactId' is missing.
[ERROR] [2] 'version' is missing.
The maven deploy plugin can be used to deploy either files or projects to the remote repository for sharing it with other developers and projects. There are various methods can be used to deploy your artifact to the remote repository by using a maven deploy plugin.
The mvn deploy runs the deploy plugin which deploys an artifact to the remote repository. A project may include the main jar and associated sources and Javadoc jars. The sources jar contains the Java sources, and the Javadoc jar contains the generated Javadoc.
mvn deploy. This command invokes the deploy phase: deploy : copies the final package to the remote repository for sharing with other developers and projects.
If you want to execute a specific execution from the command line, you'll need mvn deploy:deploy-file@deploy-file , i.e. @ the id of the configured execution, and make sure you're using at least Maven 3.3.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With