Skip to content
Advertisement

Download multiple artifacts using com.googlecode.maven-download-plugin

I’d like to download several artifacts from a Maven repository using download-maven-plugin

I can download one artifact fine, but when I add a second it is ignored:

JavaScript

I think the problem is that the configuration should be specified for each execution and the plugin declared only once, but this doesn’t compile:

JavaScript

Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.6.8:artifact (default-cli) on project libdownloader: The parameters 'groupId', 'artifactId', 'version' for goal com.googlecode.maven-download-plugin:download-maven-plugin:1.6.8:artifact are missing or invalid

Alternatively, if there’s another way to download from a Maven repository to a file (specifically, a private repository that requires authentication from the settings.xml) – e.g. using Wagon – then that could work too.

Advertisement

Answer

https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html seems like a better solution for the stated problem. It will:

Goal that copies the project dependencies from the repository to a defined location.

You can run mvn org.apache.maven.plugins:maven-dependency-plugin:copy-dependencies . This will read the dependencies from your POM, use settings.xml as normal, and copy them. The default is a directory in I think target but it is configurable.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement