Maybe I'm missing something, but why not simply leave off the child-POM
version element? It will inherit the one specified in the parent
section. If the parent POM doesn't exist in the repository, you could
always use the <relativePath/> element in the parent section to specify
where the parent POM is relative to the current project's ${basedir}.
However, I would only recommend this for hierarchies that are meant to
be built as a single application. Once you cross that boundary to more
general information, the release cycles are different and therefore so
is the versioning. Something to remember is that Maven allows n-level
inheritance. So, if you have common information for multiple apps, and
still want a single version for the application, you can use a root POM
that carries the common information, and an application-level parent POM
that inherits from the root. This parent would be the parent of all POMs
within the application build, and would specify the version.
I know some of this is clunky, and it's in the queue for revision in
Maven 2.1.
Anyway, hope that didn't muddy the waters too much.
-john
Grothaus, Christoph wrote:
Bad idea.
At least in the <parent> tags of your submodules you have to explicitly define
the parent version number. If you do a reactor build, everything is fine without
that. If you want to build a submodule standalone, Maven will ask the repository for
the parent pom. Without version number, that will fail. And as Maven fails to resolve
the parent pom, how can there be inheritance?
As to resource filtering, that's AFAIK meant for Java resources, and not for
the POMs themselves.
Suggestion for your version number problem: put markers after all <version>someversion</version>
sequences that belong to your current project and its submodules, like that:
<version>1.0-SNAPSHOT</version><!-- myprojectversionmarker -->. Apply a strategy where all
submodules have the same version number as the master pom (e.g. by simply omitting the version number for the
child module, it will inherit its parent version number). Too many different versions along the submodules
are confusing. Now if you have to change the version, do a search and replace on all your POMs. It will be
safe, as you have the version markers.
Just my two cents.
Christoph
-----Original Message-----
From: Allan Ramirez [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 16, 2006 3:18 AM
To: Maven Users List
Subject: Re: [m202] can I use filters to externalize my
artifact version
number?
Hi there,
I think <properties> from the parent pom can be inherited by the sub
modules. You may want to use that
or
http://maven.apache.org/guides/getting-started/index.html#How%
20do%20I%20filter%20resource%20files?
-allan
Mick Knutson wrote:
I want an easier way to manage version numbers than having my team
modify the pom.xml. I want to keep them from touching it all together.
So can I use some soert of filtering mechanism to change:
<version>1.2.3.2</version>
to this:
<version>${core.version.number}</version>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]