Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: Trouble deploying third party JAR to a remote repository

Tags:

maven-2

maven

I'm using Maven 3. I'm trying to deploy a third party artifact to a remote repository but am getting a strange error. The command I'm using to deploy is

mvn deploy:deploy-file -DgroupId=com.myco.util.ant \
  -DartifactId=selenium-ant-task \
  -Dversion=1.4 \
  -Dpackaging=jar \
  -Dfile=/Users/davea/.m2/repository/com/myco/util/ant/selenium-ant-task/1.4/selenium-ant-task-1.4.jar \
  -DrepositoryId=sonatype-nexus \
  -Durl=http://sonatype.myco.com/nexus/content/repositories/releases

And the error I get when I run this command is

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project maven-selenium-plugin: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file are missing or invalid -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

What's going on here? I have defined my repositoryId, "ssonatype-nexus" in my ~/.m2/settings.xml file and verified the credentials in there are correct.

Thanks for any help, - Dave

like image 807
Dave Avatar asked Aug 29 '11 21:08

Dave


2 Answers

deploy:deploy-file is not intended to be run in a directory with a pom.xml file - you should run it somewhere else. If you want a specific POM uploaded with it, don't forget the -DpomFile argument as the default is to generate a basic one.

However, I notice that you're deploying a file from the local repository - if this was placed there by a Maven build you are certainly better to have that project do the deployment, using the <distributionManagement> element and deploy lifecycle phase.

like image 158
Brett Porter Avatar answered Sep 29 '22 17:09

Brett Porter


Seems like your url is formatted incorrectly.

Try:

-Durl=file://path_to_m2_repo

See here for more.

Edit: Note, the URL is for the local repo in this case. Maven should deploy to a Nexus based on the POM and -DrepositoryId.

like image 40
Tony Avatar answered Sep 29 '22 17:09

Tony