abcd ef
abcd ef

Reputation: 49

How to download an artifact with all its dependencies?

i want learn download an artifact with its all dependencies. for example how to download com.android.tools.build/gradle artifact (https://mvnrepository.com/artifact/com.android.tools.build/gradle/2.3.0) with its all dependencies by mvn command in terminal (command prompt) or other any way. at all i just want learn download an artifact with its all dependencies in maven repository and i don't want create an java project. just "download an artifact with its all dependencies."

i downloaded Android Studio and it has Android gradle plugin artifact and its dependencies.

enter image description here

how to download this artifact with its dependencies in one folder???

Upvotes: 3

Views: 1099

Answers (1)

nortontgueno
nortontgueno

Reputation: 2801

You can run this command:

mvn -DgroupId=com.android.tools.build -DartifactId=gradle -Dversion=2.3.0 -DremoteRepositories="http://repo1.maven.org/maven2" dependency:get

It will fetch your dependencies from the informed repository. The JARs will be downloaded into your local Maven Repository.

Docs around dependency:get dependency:get can be found in here.


Unfortunately I could not find any option for this plugin to specify a output directory for all the artifacts, I have tried the -DoutputDirectory option but it does not seem to work for this plugin.

I would suggest then to temporarily change the path of your localRepository in your Maven settings.xml to a new folder, which will hold the downloaded JARs:

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  -->
  <localRepository>DOWNLOADED_JARS_OUTPUT_FOLDER</localRepository>

Upvotes: 2

Related Questions