How can I download a ZIP file with the Maven dependency plugin?

eerriicc picture eerriicc · Jun 18, 2013 · Viewed 10.3k times · Source

I'm trying to download a couple of dependencies from the command line using dependency:copy -Dartifact=...

However, one artifact looks like this as dependency

<dependency>
  <groupId>foo</groupId>
  <artifactId>xml-schemas</artifactId>
  <version>1.10.0-SNAPSHOT</version>
  <classifier>public</classifier>
  <type>zip</type>
</dependency>

How can I download this? What are the correct Maven coordinates?

Answer

user944849 picture user944849 · Jun 18, 2013

Make sure you are using version 2.7 or later of the dependency plugin. Then it's

-Dartifact=<groupId>:<artifactId>:<version>:<type>:<classifier>

There is an example in the dependency:get section of the Maven dependency plugin usage docs.