Maven and SVN branches
Now, Maven doesn’t go too well with SVN branches out of the box. You “svn copy” and you start making changes in your new brunch, then you “mvn clean install” or even “mvn clean deploy” (although we only let Hudson to “mvn deploy”).
What goes into your local repo and Artifactory ?
You’re overriding your trunk artifacts with those from the branch!
If branch POMs are the same as those in a trunk – that’s exactly what’s going to happen: artifacts are overriding each other. Both in your local repository and your intranet repository manager as well (I’ve had this case for real – a nightly branch build was overriding all trunk’s artifacts in Artifactory). Of course, it can be solved by working with separate local and remote repos when dealing with branches but I think it requires too much attention and it’s still fragile – you forget to “-Dmaven.repo.local” when running Maven in branch and you’re back making a big mess in trunk’s local repo.
What I did in ClearForest was something else – I’ve modified all <groupId> of branch POMs with this simple Groovy script:
The main idea, as you see, is following: modify all <groupId> by appending a branch name, commit and you’re fine again – artifacts from different branches are located in different namespaces and can now seat safely side-by-side in local and remote repos, without overriding each other.
How do you solve this issue ?