What’s next

November 12, 2008

Idea for simple-jar-lib plugin

Filed under: Idea,Java — stigl @ 8:23 am
Tags: , , ,

Often, when one looks at someone elses project, the artifact dependencies are a mess! The jars litter a lib/ folder, and often have no version or groupId, and it would be beneficial to structure them into a local repository. Another case is when you wish to supply an artifact which is not located in any external repository, but wish to have it close to your project in the VCS, for convenience. And the artifact has no pom. I believe the maven-dependency-plugin has a similar functionality which can be used with legacy maven1 projects, which do not require the advanced folder structure, but still requires a pom present.

Layout

lib/some-artifact.jar

com.some-company
some-artifact
1.0.3-SNAPSHOT

Implementation details

The pom.xml contains all the necessary information needed to create the folder structure and pom for the artifact. In fact, if you run Maven in a case where you have specified an artifact which it cannot find in any repositories, you will recieve instructions on how to use the maven-install plugin to add the project.

[INFO] Failed to resolve artifact.

Missing:
----------
1) com.some-application:some-artifact:jar:1.0.3-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=com.some-company -DartifactId=some-artifact \
-Dversion=1.0.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

Today, the process is not automatic. However, all the semantics are already made in the pom.xml. All you require is that lib/some-artifact has the same identifier as in the dependency.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: