On Sat, Nov 29, 2008 at 1:15 PM, Erwin Mueller <[EMAIL PROTECTED]> wrote:
> Hallo,
> I have a maven2 project with several modules. How can I specify a
> variable indicating the version for the parent and the modules?
>
> Something like that below, so that {$version} is replaced with the
> project's version. Furthermore, that I need to specify the {$version} in
> one place only.
Use ${pom.version} but ONLY in the parent pom.
You use ${pom.version} in the parent dependencyManagement section.
i.e
pom.xml:
...
<build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.deventm.fractionpainter</groupId>
<artifactId>fractionpainter-core-server</artifactId>
<version>{$pom.version}</version>
</dependency>
<!-- repeat dependency for each module -->
</dependencies>
</dependencyManagement>
...
Then in the modules you specify the dependencies as normal BUT you do
not specify a version as that has already been defined in the parent
dependencyManagement section.
You can also use the <properties> section to define other variables if you need.
<properties>
<anExambleVariable>withItsValue</anExambleVariable>
</properties>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]