How to download jars from Maven Central without writing any pom.xml [duplicate]

If you want to download maven dependencies into your lib directory use the dependency plugin with the copy-dependencies function.

mvn -DoutputDirectory=./lib -DincludeArtifactIds=commons-logging,commons-io dependency:copy-dependencies 

Without the -DincludeArtifactIds part you’ll download every dependency.

If you want to download a an artifact without having a specific project *see below** :

mvn -DgroupId=commons-io -DartifactId=commons-io -Dversion=1.4 dependency:get

Resources :

  • maven.apache.org – dependency:copy-dependencies
  • force Maven2 to copy dependencies into target/lib
  • maven.apache.org – dependency:get *see below**

On the same topic :

  • Aggregate Dependencies in a Multi-Module Maven Project
  • Set plugin’s property on the command line in maven 2
  • A simple command line to download a remote maven2 artifact to the local repository? *see below**

Interesting comments :

  • *@Pascal Thivent :

    No need to setup a POM, no need to develop your own tool, use mvn dependency:get. That’s the right answer to this question.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)