How do you do multiple (active) branch development with svn and mvn?

With Maven 2, you have a local repository in ~/.m2/repository. Of course you can customize this via settings.xml, but there is only one settings.xml. Thus, the local repository is a location where versioned components are stored for fast access once a first time build is done. During development, you have to use what is called "SNAPSHOT" based development. It's in the Maven DNA.

With svn, branches have to be used if you need to do any serious development. So, if you have two branches of active development (e.g. my-prototype and trunk) then how do you development with mvn and its local repositories?

I have resorted to using alias mvn='mvn -Dmaven.repo.local=~/.m2/repository/$branch, so that I can create separate universes while doing separate builds. I don't see a way around it because for SNAPSHOT components, it is very likely that with single local repository, you'll end up overwriting the SNAPSHOT components (or even versioned ones) and thus messing up the two builds.

This means however that the things that don't change (e.g. apache-commons, and other gazillion dependencies) have to be copied in all local repositories!

Does anyone know any work-around?

Comments:

I just had to do this very same thing. I had some weirdness creep in with the plugins maven was trying to download, though. Not sure what that was all about.

Posted by Justin Lee on April 05, 2009 at 12:18 AM PDT #

Yes, there is.
You should use mvn-release-plugin to branch and there by creating your own versions of artifacts. e.g., we use it to do promotions in GFv3.

Posted by Sahoo on April 28, 2009 at 03:45 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

Welcome to my blog where mostly my work related thoughts are expressed.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today