Maven 2 JAR Fetch Trick

July 09, 2007

This tip probably belongs under the category "stupid Maven 2 tricks." While writing a tutorial that uses Maven 2, I thought to myself, "There must be a way to pull an artifact into the local Maven 2 repository without a build script." Unfortunately, a build script is required, but with a little shell magic, we can hide those details.

So what's the basic premise? First, you need to create a minimalistic Maven 2 POM file (pom.xml). The next step is to add the dependency that you would like to fetch. Finally, you execute the dependency:resolve Maven 2 goal. (By the way, I highly recommend checking out the dependency plugin. It can produce very useful output in a pinch.)


Posted at 12:26 AM in Java | Permalink Icon Permalink | Comment Icon Comments (4)