You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Van Steenberghe Mario (GFDI)" <Ma...@gfdi.be> on 2005/07/29 09:53:32 UTC

setting properties in the POM [m2]

Hi,

I'm trying to setup a build mechanism that is able to build a version of our projects based on a property (${project.version}). 

I have tried to include this property in my POM but since maven2 doesn't use property files anymore, it doesn't seem to recognize this property, even when I pass it as a command-line argument. (m2 -Dproject.version=1.0 install)

Perhaps I'm still thinking too much in the old maven way... is there anyone who knows how to tackle this problem in maven2 ?

Thanks in advance.
Mario.

<project>

  <!-- ========================================================= -->
  <!-- Base configuration                                        -->
  <!-- ========================================================= -->

  <parent>
    <groupId>fwk2</groupId>
    <artifactId>fwk2</artifactId>
    <version>${project.version}</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>fwk2</groupId>
  <artifactId>fwk_client</artifactId>
  <version>${project.version}</version>
  <packaging>jar</packaging>

  <!-- ========================================================= -->
  <!-- Default Dependencies                                      -->
  <!-- ========================================================= -->

  <dependencies>

    <dependency>
      <groupId>fwk2</groupId>
      <artifactId>fwk_client_common</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>fwk2</groupId>
      <artifactId>fwk_core</artifactId>
      <version>${project.version}</version>
    </dependency>

  </dependencies>

</project>

Re: setting properties in the POM [m2]

Posted by Brett Porter <br...@gmail.com>.
${project.version} is actually an expression that gets <version>
(which in your case is an expression that at that point evaluates
empty). It can actually be shortened to ${version}.

What you probably want to do is set the version and then use the
expression for the dependencies.

- Brett

On 7/29/05, Van Steenberghe Mario (GFDI) <Ma...@gfdi.be> wrote:
> Hi,
> 
> I'm trying to setup a build mechanism that is able to build a version of our projects based on a property (${project.version}).
> 
> I have tried to include this property in my POM but since maven2 doesn't use property files anymore, it doesn't seem to recognize this property, even when I pass it as a command-line argument. (m2 -Dproject.version=1.0 install)
> 
> Perhaps I'm still thinking too much in the old maven way... is there anyone who knows how to tackle this problem in maven2 ?
> 
> Thanks in advance.
> Mario.
> 
> <project>
> 
>   <!-- ========================================================= -->
>   <!-- Base configuration                                        -->
>   <!-- ========================================================= -->
> 
>   <parent>
>     <groupId>fwk2</groupId>
>     <artifactId>fwk2</artifactId>
>     <version>${project.version}</version>
>   </parent>
> 
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>fwk2</groupId>
>   <artifactId>fwk_client</artifactId>
>   <version>${project.version}</version>
>   <packaging>jar</packaging>
> 
>   <!-- ========================================================= -->
>   <!-- Default Dependencies                                      -->
>   <!-- ========================================================= -->
> 
>   <dependencies>
> 
>     <dependency>
>       <groupId>fwk2</groupId>
>       <artifactId>fwk_client_common</artifactId>
>       <version>${project.version}</version>
>     </dependency>
> 
>     <dependency>
>       <groupId>fwk2</groupId>
>       <artifactId>fwk_core</artifactId>
>       <version>${project.version}</version>
>     </dependency>
> 
>   </dependencies>
> 
> </project>
> 
>

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