Maven: Trouble deploying third party JAR to a remote repository

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


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.


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.

链接地址: http://www.djcxy.com/p/54662.html

上一篇: iOS自定义空闲计时器

下一篇: Maven:无法将第三方JAR部署到远程存储库