I have a library that I distribute using maven 2. The typical user of this library doesn't use maven to build their applications, but is likely somewhat familiar with maven and probably has it installed.

I'd like to document a "simple" one line command they can use to download my library's artifacts to their local ~/.m2/repository without requiring that they set up a pom.xml to do it.

I thought there was a way to do this, but I can't seem to find it after looking through the install:install-file and dependency plugin documentation. I tried things like:

but I think I'm barking up the wrong tree since it appears that the install plugin is used to copy locally built files into the local repository, rather than download remote artifacts into the local repository.

3 Answers
3

Since version 2.1 of the Maven Dependency Plugin, there is a dependency:get goal for this purpose. To make sure you are using the right version of the plugin, you'll need to use the "fully qualified name":

Good idea, although a command line they could copy-paste would be easier
– emmbyNov 21 '09 at 19:55

If I could think of one I'd post it. I don't know of any plugin that does quite what's called for. I know how to write one ...
– bmarguliesNov 21 '09 at 20:39

The get mojo actually expects -DrepoUrl to be present, not -DrepositoryUrl. Regarding the arguments to type, there is no magic, you need to provide these informations in a way or the other.
– Pascal ThiventNov 22 '09 at 18:44

In my first scheme, the end user types only three characters: mvn. All the other typing is done by the op.
– bmarguliesNov 22 '09 at 20:34

As of version 2.4 of the Maven Dependency Plugin, you can also define a target destination for the artifact by using the -Ddest flag. It should point to a filename (not a directory) for the destination artifact. See the parameter page for additional parameters that can be used