versioning - Need to control Maven Version Numbers for multiple projects -
it's long story. current place uses ant builds. create 20 different foundation class jars used in multiple projects. originally, projects check in particular versions of various jars needed , never updated them. meant each application had incompatible jars other projects , our servers. hilarity ensued.
to handle this, brought in maven repository, , integrated ivy our ant builds. no more checking in jars. instead, fetch correct version maven repository. originally, expected developers keep version numbers in ivy.xml date, never did. instead, ivy integration , setup depends upon external subversion project. allowed me integrate ivy minimal changes old build.xml files. added ivy.version.properties file external ivy project , maintain version numbers of various jars in there. there's corporate wide version number.
the various projects use ${corporate.version} property our foundation jars version numbers. when update ivy.version.properties file, projects updated right version number our foundation classes. use <ivy:makepom> generate pom.xml our projects , use deploy our jars , wars our maven repository.
the result: no longer have worry developers keeping version numbers of projects in sync. i, release engineer handle updating 1 ivy.version.properties file. projects in sync.
now, we're moving maven, , want able same thing. doubt developers remember update pom.xml correct version numbers, want read in file, , use that.
there 2 issues: 1 maven first reads in version number of project before executes goal. no version number in pom.xml, no version number generated jar.
even if manage first step, have fact pom.xml has no version number in foundation classes. when maven pulls down pom.xml dependencies, can't figure out revision.
yes, put corporate pom.xml , have parent project of other projects. have parent project set various aspect of projects. put foundation class version number in there. however, means developers have update parent project's version number each release. if developers can't trusted update version number of project each release, makes think they'll parent's version each release?
i know other people must have run similar issue. how handle this?
i have ant script generates pom.xml template pom.xml, seems bit silly.
i wondering if possible maven generate pom.xml on fly , use continue executing right goal. example, type in mvn package, , maven take template.pom.xml file, fill in missing version numbers generate generated.pom.xml file, execute mvn package on generated pom.
or, there better way solve issue? basically, need control version number of our releases across projects. way, projects using same version of our foundation classes. also, control other versions of other jars (like log4j) way. i've done ant , ivy, , want move maven.
i think best option create pom.xml dependencies packages in , import in developer project paren pom.xml using import
so, in project parent pom:
<properties> <corporate.version>...</corporate.version> <properties> ... <dependencymanagement> <dependencies> <dependency> <groupid>com.mycompany.libs</groupid> <artifactid>foundation<artifactid> <version>${corporate.version}</version> <type>pom</type> <scope>import</scope> </dependency> ... </dependencies> </dependencymanagement> so new set of foundation libraries, deploy new pom.xml versions in , update ${corporate.version} in relevant parent pom.xml file. can have when versions not yet fixed define -snapshot artifact these version numbers.
for more information, see: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#importing_dependencies
Comments
Post a Comment