Friday, November 23, 2012

An excellent solution for local dependencies with Maven projects

I found this tip on Heroku devcenter website.

In a few words, you add a "repo" directory to your project, deploy your artifact into this local repo and declare this repository in your pom.xml. Then, you can use your local jar as classic maven dependency.

Here is the example :

+- pom.xml
+- src
+- repo
mvn deploy:deploy-file -Durl=file:///path/to/yourproject/repo/ -Dfile=mylib-1.0.jar -DgroupId=com.example -DartifactId=mylib -Dpackaging=jar -Dversion=1.0
It's just perfect! Thanks to the Heroku member who had this excellent idea!