Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying 3rd party packages to my internal repo using maven using custom wagon

How can i use my own wagon to deploy 3rd party packages to my remote repository?

For example i can deploy a 3rd party package without altering pom.xml using the following command.

mvn deploy -DaltDeploymentRepository=thirdparty::default::http://myremoserver.com/mavenrepository/thirdparty -f thirpartpomfile -Dmaven.install.skip=true -Dmaven.test.skip=true

How can i tell maven to use a specific wagon for deploying packages? Can i pass some command line argument or add some entry to settings.xml?

How can i do the same for gradle?

like image 205
user93796 Avatar asked May 08 '17 22:05

user93796


1 Answers

The "Guide to deploying 3rd party JARs to remote repository" only mention:

First, the wagon-provider(wagon-ftp, wagon-file, etc..) must be placed to your ${maven.home}/lib.

That is enough for you to use mvn deploy-file with other protocols.
Your own wagon should be copied there (${maven.home}/lib).

See Maven Deploy File Plugin FAQ:

If you are using the deploy:deploy-file goal and encounter this error:

Error deploying artifact: Unsupported Protocol: 'ftp': 
  Cannot find wagon which supports the requested protocol: ftp"

Then you need to place the appropriate wagon provider in your %M2_HOME%/lib.

If the error description is something like this:

Error deploying artifact: Unsupported Protocol: 'ftp': 
  Cannot find wagon which supports the requested protocol: 
    ftp org/apache/commons/net/ftp/FTP"

Then you need to place the commons-net jar in %M2_HOME%/lib.

With Gradle, you can do the same, but with the Maven plugin, delegating the deploy-file to maven, since the Maven Deployer plugin might not support custom protocols.

like image 100
VonC Avatar answered Oct 05 '22 06:10

VonC