Thursday, December 29, 2011

maven2 and maven3 : m2 repository

Early of my post I discussed about keeping maven2 and maven3 in the same machine. But I forgot to discuss about the .m2 repository. Please note that the m2 repositories of maven2 and maven3 cannot be the same. Because there are some differences in pom files in maven3 which maven2 cannot understand. So we have to keep two different spaces for maven2 and maven3. If you use one of these then you can use the default m2 repository directly instead you have to rm -rf your existing m2 repository if you going with maven3. If you want to keep both here is a tip you can follow.
First decide which one take default and which one take a custom place (you can put both in a custom place also).  Then you have to change the settings.xml of maven. 
Settngs.xml file can be found in following places and you can change any of it.
  • The Maven install: $M2_HOME/conf/settings.xml
  • A user's install: ${user.home}/.m2/settings.xml
Now you have to add the following part to the settings.xml file.
/path/to/local/repo


Now you are done.

Note: If you used aptitude to install maven then maven install settings.xml can be found in /etc/maven2. 

No comments:

Post a Comment