Maven
  1. Maven
  2. MNG-4140

Properties incorrectly replaced in pom

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      2

      Description

      The attached sample pom configures the dependency plugin. During an install, ${project.version} is replaced by the actual version when in fact no replacement at all must happen (see pom-transformed.xml). This seems to be related to the version, since all other properties remain unchanged.

      In our real world scenario, the dependency plugin is configured in a profile in order to copy child module artifacts to Luntbuild's publish directory. This, of course, won't work if the version is replaced during install. It must be evaluated at runtime.

      This is a regression in Maven 2.1.0. Maven 2.0.10 does not have the problem.

      1. pom.xml
        1.0 kB
        Reinhard Nägele
      2. pom-transformed.xml
        1.0 kB
        Reinhard Nägele

        Issue Links

          Activity

          Hide
          Brett Porter added a comment -

          yes, I think plugin configuration, and possible properties, need to be excluded form this rule

          Show
          Brett Porter added a comment - yes, I think plugin configuration, and possible properties, need to be excluded form this rule
          Hide
          John Casey added a comment -

          sorry, not sure what I was thinking on this one. It's simply searching for any "<version>.+</version>" and interpolating the value...which has obvious side-effects for plugin configurations. I'm working on an xpath solution now that will allow us to preserve xml comments, etc. in the original POM, without the need to drag in additional dependencies.

          Show
          John Casey added a comment - sorry, not sure what I was thinking on this one. It's simply searching for any "<version>.+</version>" and interpolating the value...which has obvious side-effects for plugin configurations. I'm working on an xpath solution now that will allow us to preserve xml comments, etc. in the original POM, without the need to drag in additional dependencies.
          Hide
          John Casey added a comment -

          replaced StringSearchInterpolator (outer interpolator that isolated "<version>.*</version>" sections of the POM) with an XPath-based solution that allows fine-tuning of which versions to replace.

          Show
          John Casey added a comment - replaced StringSearchInterpolator (outer interpolator that isolated "<version>.*</version>" sections of the POM) with an XPath-based solution that allows fine-tuning of which versions to replace.
          Hide
          John Casey added a comment -

          NOTE: I've revised the fix for this issue to be JDK 1.4 compatible. Note also that when using JDK 1.4, your POMs WILL NOT BE INTERPOLATED for version expressions on install/deploy...however, the build will still run on 1.4. You should use JDK 1.5+ if you plan to use this feature.

          Show
          John Casey added a comment - NOTE: I've revised the fix for this issue to be JDK 1.4 compatible. Note also that when using JDK 1.4, your POMs WILL NOT BE INTERPOLATED for version expressions on install/deploy...however, the build will still run on 1.4. You should use JDK 1.5+ if you plan to use this feature.
          Hide
          Benjamin Bentmann added a comment -

          For the record, POM interpolation upon installation/deployment to repos has been completely removed from Maven 2.2.

          Show
          Benjamin Bentmann added a comment - For the record, POM interpolation upon installation/deployment to repos has been completely removed from Maven 2.2.
          Hide
          Jean-Marc Borer added a comment -

          Why is this an issue? Shouldn't the pom included in the jars being interpolated? I am missing something here... any insights?

          Show
          Jean-Marc Borer added a comment - Why is this an issue? Shouldn't the pom included in the jars being interpolated? I am missing something here... any insights?
          Show
          John Casey added a comment - See: http://docs.codehaus.org/display/MAVEN/Artifact-Coordinate+Expression+Transformation

            People

            • Assignee:
              John Casey
              Reporter:
              Reinhard Nägele
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: