Our project has a dependency like
<dependency>
<groupId>apollo.components.cots</groupId>
<artifactId>cots-wfs</artifactId>
</dependency>
And as far as I understand, maven2 will get the latest artifact for cots-wfs, say <version>2.3-20101111.000000-13</version>
The problem is, when we branch the project, the dependency stays the same, and when other developers release a new cots-wfs say <version>2.3-20101222.000000-13</version> which is not backward compatible, the build is broken.
I am trying to avoid merging the code into the branch, which is painful.
So what do I need to do to “freeze” all the dependencies when I branch the project ?
Is there any easy way to do this?
It looks like you are using a
SNAPSHOTdependency for cots-wfs (2.3-SNAPSHOT), probably declared in thedependencyManagementsection.Indeed, which is why you should simply not branch an artifact with
SNAPSHOTdependencies, the build of released artifacts should be reproducible, for ever, and usingSNAPSHOTdependencies defeats this. The maven release plugin actually forbids releasing a POM havingSNAPSHOTdependencies.It is however possible to “lock”
SNAPSHOTdependencies usingversions:lock-snapshotsor, even better, to use the corresponding released version usingversions:use-releases. This is actually the way to go.By the way, the Maven Release Plugin might help to automate the whole process.