Maven
  1. Maven
  2. MNG-2971

Variables are not replaced into installed pom file

    Details

    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      Variables are not replaced into installed pom file.
      Here is a sample pom file
      <project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

      <modelVersion>4.0.0</modelVersion>
      <groupId>com.xxx.root</groupId>
      <artifactId>root</artifactId>
      <packaging>pom</packaging>
      <version>$

      {prop.version}</version>
      <name>My Project</name>
      ...
      <properties>
      <prop.version>3.0.20</prop.version>
      </properties>

      </project>

      The installed pom is into ${localRepository}/com/xxx/root/root/3.0.20/root-3.0.20.pom
      is the same as the project pom file but the version referenced into the installed pom file is ${prop.version}

      instead of 3.0.20
      which creates problem to artifacts depending of this one.

      Thanks in advance

      1. pom.xml
        0.4 kB
        Julian Atienza

        Issue Links

          Activity

          Hide
          abhijith nagarajan added a comment -

          Is there any rationale beyond placing the same pom in the repository instead of effective pom?

          Show
          abhijith nagarajan added a comment - Is there any rationale beyond placing the same pom in the repository instead of effective pom?
          Hide
          Mike Gould added a comment -

          We need this for a multi-module build. We want to specify that some sibling module dependencies have the same version as the parent or current project. If we do this:

          <dependency>
          <groupId>com.example</groupId>
          <artifactId>common</artifactId>
          <version>$

          {project.version}

          </version>
          <scope>compile</scope>
          </dependency>

          then the varible appears in the installed pom and then can't be used by anything.

          Currently - like most people - we have a pre-build step which sets all versions accross the whole tree.

          Putting this functionality into the release plugin would be completely useless as the release plugin simply doesn't do the right thing for CI style builds where the version is set from the build number/scm revision etc.

          Show
          Mike Gould added a comment - We need this for a multi-module build. We want to specify that some sibling module dependencies have the same version as the parent or current project. If we do this: <dependency> <groupId>com.example</groupId> <artifactId>common</artifactId> <version>$ {project.version} </version> <scope>compile</scope> </dependency> then the varible appears in the installed pom and then can't be used by anything. Currently - like most people - we have a pre-build step which sets all versions accross the whole tree. Putting this functionality into the release plugin would be completely useless as the release plugin simply doesn't do the right thing for CI style builds where the version is set from the build number/scm revision etc.
          Hide
          Jörg Hohwiller added a comment -

          There is great news for this issue:
          https://svn.codehaus.org/mojo/trunk/sandbox/consumer-maven-plugin
          Please note that the plugin will move out of sandbox in the future so try mojo instead of sandbox if the link stopped working:
          https://svn.codehaus.org/mojo/trunk/mojo/consumer-maven-plugin

          Simply check-out and install this plugin. Then add this to your toplevel POMs build-section:
          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>consumer-maven-plugin</artifactId>
          <version>1.0.0-beta-1-SNAPSHOT</version>
          </plugin>

          I hope that the plugin will move out of sandbox and be released soon.

          If you have any feedback please let us know (ideally on MOJOs dev mailing list).

          Show
          Jörg Hohwiller added a comment - There is great news for this issue: https://svn.codehaus.org/mojo/trunk/sandbox/consumer-maven-plugin Please note that the plugin will move out of sandbox in the future so try mojo instead of sandbox if the link stopped working: https://svn.codehaus.org/mojo/trunk/mojo/consumer-maven-plugin Simply check-out and install this plugin. Then add this to your toplevel POMs build-section: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>consumer-maven-plugin</artifactId> <version>1.0.0-beta-1-SNAPSHOT</version> </plugin> I hope that the plugin will move out of sandbox and be released soon. If you have any feedback please let us know (ideally on MOJOs dev mailing list).
          Hide
          Jörg Hohwiller added a comment -
          Show
          Jörg Hohwiller added a comment - Plugin had to be renamed: http://mojo.codehaus.org/flatten-maven-plugin/
          Hide
          Jörg Hohwiller added a comment -

          2nd release is out in central repo. Just add this to your build section:

          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>1.0.0-beta-2</version>
          </plugin>

          Show
          Jörg Hohwiller added a comment - 2nd release is out in central repo. Just add this to your build section: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>flatten-maven-plugin</artifactId> <version>1.0.0-beta-2</version> </plugin>

            People

            • Assignee:
              Ralph Goers
              Reporter:
              Laurent Dauvilaire
            • Votes:
              50 Vote for this issue
              Watchers:
              50 Start watching this issue

              Dates

              • Created:
                Updated: