You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Erwin Mueller <fu...@googlemail.com> on 2008/11/29 03:45:33 UTC

version for submodules

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.

Thank you very much.

In the parent pom:
<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.deventm.fractionpainter</groupId>
  <artifactId>fractionpainter-core-parent</artifactId>
  <version>{$version}</version>
  <packaging>pom</packaging>
  <name>fractionpainter-core-parent</name>

  <modules>
  	<module>fractionpainter-core-server</module>
  	<module>fractionpainter-core-connection</module>
  	<module>fractionpainter-core-client</module>
  	<module>fractionpainter-core-exceptions</module>
  	<module>fractionpainter-core-fcalc</module>
  	<module>fractionpainter-core-mail</module>
  	<module>fractionpainter-core-image</module>
  	<module>fractionpainter-core-jobs</module>
  </modules>
</project>

And in the modules:

<project>
  <parent>
    <artifactId>fractionpainter-core-parent</artifactId>
    <groupId>com.deventm.fractionpainter</groupId>
    <version>{$version}</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.deventm.fractionpainter</groupId>
  <artifactId>fractionpainter-core-client</artifactId>
  <version>{$version}</version>
  <dependencies>
    <dependency>
      <groupId>com.deventm.fractionpainter</groupId>
      <artifactId>fractionpainter-core-connection</artifactId>
      <version>{$version}</version>
    </dependency>
    <dependency>
      <groupId>com.deventm.fractionpainter</groupId>
      <artifactId>fractionpainter-core-server</artifactId>
      <version>{$version}</version>
    </dependency>
    <dependency>
      <groupId>org.deventm.cli</groupId>
      <artifactId>devent-cli</artifactId>
      <version>0.3.1</version>
    </dependency>
    <dependency>
      <groupId>org.deventm.bootstrap</groupId>
      <artifactId>Bootstrap</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: version for submodules

Posted by Stephen Connolly <st...@gmail.com>.
FYI, versions-maven-plugin is out of the sandbox and has 1.0-alpha-1  
pushed to central

Sent from my iPod

On 29 Nov 2008, at 04:49, "Wendy Smoak" <ws...@gmail.com> wrote:

> On Fri, Nov 28, 2008 at 9:43 PM, Erwin Mueller <funnyacc@googlemail.com 
> > wrote:
>
>> I don't like to update the version for the parent in each module's  
>> pom
>> file, is there a solution?
>
> Barrie mentioned the release plugin and there is also a Versions
> plugin at Codehaus Mojo (possibly still in the sandbox though).
>
> -- 
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: version for submodules

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Nov 28, 2008 at 9:43 PM, Erwin Mueller <fu...@googlemail.com> wrote:

> I don't like to update the version for the parent in each module's pom
> file, is there a solution?

Barrie mentioned the release plugin and there is also a Versions
plugin at Codehaus Mojo (possibly still in the sandbox though).

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: version for submodules

Posted by Barrie Treloar <ba...@gmail.com>.
On Sat, Nov 29, 2008 at 3:13 PM, Erwin Mueller <fu...@googlemail.com> wrote:
> Thank you very much. But what is with the version of the parent project
> in the modules pom files? I need to specify the version of the parent:
>
>  <parent>
>    <artifactId>fractionpainter-gui-parent</artifactId>
>    <groupId>com.deventm.fractionpainter</groupId>
>    <version>0.1</version>
>  </parent>
>
> If I don't specify it, I get the error
> "Reason: Missing version element from parent element for project
> com.deventm.fractionpainter:fractionpainter-gui-config"
>
> I don't like to update the version for the parent in each module's pom
> file, is there a solution?

Well you specify it once, and then the release plugin will update it
automatically for you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: version for submodules

Posted by Erwin Mueller <fu...@googlemail.com>.
Thank you very much. But what is with the version of the parent project
in the modules pom files? I need to specify the version of the parent:

  <parent>
    <artifactId>fractionpainter-gui-parent</artifactId>
    <groupId>com.deventm.fractionpainter</groupId>
    <version>0.1</version>
  </parent>

If I don't specify it, I get the error 
"Reason: Missing version element from parent element for project
com.deventm.fractionpainter:fractionpainter-gui-config"

I don't like to update the version for the parent in each module's pom
file, is there a solution?

On Sat, 2008-11-29 at 13:59 +1030, Barrie Treloar wrote:
> On Sat, Nov 29, 2008 at 1:15 PM, Erwin Mueller <fu...@googlemail.com> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: version for submodules

Posted by Barrie Treloar <ba...@gmail.com>.
On Sat, Nov 29, 2008 at 1:15 PM, Erwin Mueller <fu...@googlemail.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org