0

How to use the command 'mvn' to fetch a jar from the central repository to the local repository without building a maven project or writting a pom file?

kino lucky
  • 1,365
  • 4
  • 15
  • 24
  • Why do you want to do that? – artbristol Dec 19 '12 at 07:32
  • Eq. I fetch a jar from the central repository to the local repository, then i can copy it from the local repository and use it in a none-maven-style project. I don't want to download it on a website. – kino lucky Dec 19 '12 at 07:39

1 Answers1

0

You can use dependency:get goal of Maven Dependency plugin to do that.

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:get -DrepoUrl=<repo URL> -Dartifact=<group>:<artifact>:<version>

Sample:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:get -DrepoUrl=http://repo1.maven.org/maven2 -Dartifact=com.yammer.metrics:metrics-spring:2.1.5
Stanley
  • 5,057
  • 4
  • 34
  • 44