java - how to move multi-module projects to maven -
we attempting move several multi-module applications maven, , having problems.
each module stored independently in cvs. have manifest files each application, list modules required application (and optionally version). not modules in maven form.
so application 'customer_care' has following manifest:
<manifest> <module id="my_api"/> <module id="custcare_webapp"/> </manifest>
similarly, application 'core batch' has manifest this:
<manifest> <module id="my_api"/> <module id="core"/> <module id="batch"/><!--nb non-maven module --> </manifest>
i have started 'mavenising' our code, my_api project has pom.xml dependencies defined, including 1 on internal code module 'central_config'. have specified version release.
the problem
this works fine, until need create frozen manifest. can specify version each module:
<manifest> <module id="my_api" version="0.123.0"/> <module id="core" version="0.456.0"/> <module id="batch" version="0.789.0"/><!--nb non-maven module --> </manifest>
but build not reproducible, because version of 'centralconfig' dependency in my_api 'release'. if releases new version of 'centralconfig', next time build frozen manifest, it's different.
so why don't use hard-coded versions of dependencies central-config? because then, have update perhaps 10 or 20 pom files every time updates centralconfig new version. depends on central config, , depends on that, need pom.xml updating , re-released. not lots of work, don't know how programmatically , reliably identify every module declares dependency on central config.
a possible solution?
could define 'centralconfig.version' in 1 place, , refer in modules? if so, should this? don't know parent poms feel might provide solution.
update
it seems using parent pom way go. according question: can maven projects have multiple parents? , it's not possible maven child project have multiple parents.
so how can my_api module child of both custcare_webapp , core_batch?
update
i've concluded maven doesn't meet requirements, , we've gone using our 12-year old home-grown solution build using ant , cvs.
one other option better parent-structure managing versions import dependencies.
to illustrate how works create 1 project contain pom specifying versions use modules:
<project> <modelversion>4.0.0</modelversion> <groupid>test</groupid> <artifactid>module-versions</artifactid> <packaging>pom</packaging> <version>1.0</version> <dependencymanagement> <dependencies> <dependency> <groupid>test</groupid> <artifactid>a</artifactid> <version>1.1</version> </dependency> <dependency> <groupid>foo</groupid> <artifactid>bar</artifactid> <version>2</version> </dependency> </dependencies> </dependencymanagement> </project>
then, in projects need have dependencies anyhing have hard coded versions import project in following manner:
<dependencymanagement> <dependencies> <dependency> <groupid>test</groupid> <artifactid>module-versions</artifactid> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement>
this way have change module-versions
project anytime release new version of have dependency to.
this way can have multiple "module-versions"-projects split things bit.
of course, still have problem project's want use new version must released in turn, cost of using released dependencies in maven.
Comments
Post a Comment