Manually downloading an artefact in Maven

Usually maven will download an artefact on it’s own however there are times when you need to do this manually – in this instance the local Nexus installation is down for maintenance so I had no choice but do it the hard way.

In this instance I needed the exec-maven-plugin which my local repository didn’t have but fortunately the maven-dependency-plugin allows you to download them:

 mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
     -Dartifact=org.codehaus.mojo:exec-maven-plugin:1.2 \
     -DrepoUrl=http://repo1.maven.org/maven2

All you need is to set artifact= to the required artifact & repoUrl to the remote repository – in this case Maven Central

%d bloggers like this: