Friday 15 June 2007

Tip: How to depend on non maven artifacts in a maven build

Have you ever wanted to depend on some jar file that is not located in any public maven repository you probably ended up copying the dependency to your local repository and creating pom and md5 files by your self. Maybe you didn't even create the md5 files as it is not necessary and 'only' generates a warning in your maven build lifecycle.

Instead of doing all the hard work, you could use the install-file goal maven-install-plugin.

The install-file goal installs the artifact into your local repository. It can aslo create the nessesary pom.xml and checksum files.

A simple example of use:

$ mvn install:install-file -Dfile=pzfilereader-3.0.0.jar -DgroupId=net.sf.flatpack -DartifactId=pzfilereader -Dversion=3.0.0 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true

No comments: