Friday, July 13, 2007

Maven local repository synchronization

We extensively use maven for building our software. The reason behind it is the fact that maven manages inter project dependencies very effectively and efficiently. Another reason is the Repositories in maven, this helps individuals to grab the third party dependent jars from a single place and then use them in their favorite IDE. However very often you will find that local repository that maven maintains (usually under <user.home>/.m2/repository folder) is not in sync with the remote repository. I tried to find out a solution for this problem which lead me to two projects being developed and maintained by codehaus.
  1. MaveIde
  2. Maven Integration for Eclipse
However none of them was particularly useful. They are still under development and buggy. What I found then was a simple solution in the from of ant task. Again this solution is itself available from Maven at Here is a small ant script snippet which demonstrate the usage of these ant task(s) to synchronize your local repository.
<target name="pomcheck">
    <echo message="Runnint POM check."/>
    <dependencies verbose="true"
        profiles="default, MavenCentral">
        <dependency groupid="product" artifactid="core"
        <remoterepository id="maven_global"
        <remoterepository id="maven_released"
        <remoterepository id="maven-snaps"
        <remoterepository id="MavenCentral"
That's it folks. Tomorrow we will dive into details of the above ant scripts. I will show you how to configure eclipse to run this script and meaning of each of the tag.


Salil said...

raven mahit hota.. maven kay ahe re bhau..


BizSutra Designer said...

Ravan Ramayana madhye hota. Maven Java (Adhunik Ramayana) madhye aahe!

Disclaimer: The views expressed in this blog are my own and do not necessarily reflect the views of any former, current or future employers or employees of mine