Search code examples
mavenmaven-pluginmaven-3

How do I download a Maven artifact at the command line without using dependency:get or maven-download-plugin?


I'd like to download an artifact and its dependencies at the command line. I.e.

mvn [some plugin]:[goal] -DartifactId=[artifactId] -DgroupId=[groupId] -Dversion=[version]

I've tried mvn dependency:get but this seems to require a list of remote repositories. I want mvn to use what's already specified in settings.xml

I've also tried the maven-download-plugin but this doesn't seem to work properly (it tried downloading xerces-impl as a transitive dependency of ant and failed to resolve it. Neither xerces-impl nor ant are dependencies of my artifact).

Your help would be appreciated.


Solution

  • Try using the latest version of dependency:get, it works for me

    mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DartifactId=[artifactId] -DgroupId=[groupId] -Dversion=[version]
    

    works for me