Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How download maven artifact from remote repository to local folder?

I am writing a script for deploying java application. The scenarion is simple:

  1. Download pusblished application (jar) from repository to local folder.
  2. Run java with jar

How can I download this jar from maven repo to local folder?

Important

  1. The question is not about resolving one artifact. Here is a solution to donwload single artifact to local repository, but I want to specified folder.
  2. Also the solution should work from command line without pom file. E.g. run mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:copy will fail, because it runs only in folder where pom.xml is present.
like image 491
Cherry Avatar asked Mar 18 '23 16:03

Cherry


1 Answers

Try dependency:get like this:

mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=org.springframework:spring-context:4.0.4.RELEASE:jar -Dtransitive=false -Ddest=spring-context-4.0.4.RELEASE.jar
like image 84
Evgeniy Dorofeev Avatar answered Mar 20 '23 06:03

Evgeniy Dorofeev