Cherry
Cherry

Reputation: 33514

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.

Upvotes: 4

Views: 15479

Answers (1)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 135992

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

Upvotes: 7

Related Questions