Maven Local Repository Modules

Local repository modules are useful when your project depends on some jars that cannot be found in any public or proprietary repository. In such cases, you have two choices: importing the jar in your local repository manually before running the build, as suggested in the mvn faq, or make your build process do it for you automatically; this is how: A Maven-friendly Pattern for Storing Dependencies in Version Control.
I learned this "pattern" time ago working with Greg in a company that was not using maven, so didn't had any repository for proprietary libraries. The solution was working great automating the process of installing the proprietary jars into the local repositories, and was saving developers to execute many maven esoteric command lines to import jars one by one.

To deploy files in a local repository module, it's possible to use the goal "deploy:deploy-file" as indicated in the example here:

mvn deploy:deploy-file -Durl=file://C:\m2-repo \
                       -Dfile=your-artifact-1.0.jar \
                       -DgroupId=org.some.group \
                       -DartifactId=your-artifact \
                       -Dversion=1.0 \
                       -Dpackaging=jar \
                       -DgeneratePom=true 

I promised to myself to write an howto about this interesting topic, as it may be useful to myself in future and I need an online reference to this procedure. But recently I don't have much time to blog, so I have to reference an existing article.

Another reference: a feature request opened by Greg to Maven team MNG-3989.


One Response to “Maven Local Repository Modules”  

  1. 1 Federico Grilli

    Or third (deprecated) option, you could use scope=system and systemPath=${basedir}/more_libs/xxx.jar in your dependency and put the libs under version control so that none is forced to manually download and install the dependency. Brett Porter’s idea, however, is a cunning one, guess I’ll put it to work very soon.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Current day month ye@r *


Calendar

August 2010
M T W T F S S
« Jul   Sep »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening