Maven
  1. Maven
  2. MNG-3530

Regression: Properties get resolved before the LifeCycle is Forked.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.9
    • Fix Version/s: 2.1.0-M1
    • Component/s: General
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      2

      Description

      Since Maven 2.0.9 – If a plugin uses a forked lifecycle, then the project properties are resolved by maven before the lifecycle is forked.
      This means that the forked lifecycle has the non-forked lifecycle's values.

      This was not the case in maven prior to version 2.0.9, where properties were resolved at a much later time.

      For example - the attached sample project uses the Clover plugin with the xdoclet plugin. When

      mvn clean install

      is run under Maven-2.0.8 you can see the following output:

      [INFO] [xdoclet:xdoclet {execution: default}]
      [INFO] Initializing DocletTasks!!!
      [INFO] Executing tasks
           [echo] Build Dir: ${project.build.directory}/test.clover
      [INFO] Executed tasks
      

      whilst Maven 2.0.9 outputs:

      [INFO] [xdoclet:xdoclet {execution: default}]
      [INFO] Initializing DocletTasks!!!
      [INFO] Executing tasks
          [mkdir] Created dir: /Users/niick/work/mvnclvr/src/it/mng/xdoclet/target
          [touch] Creating /Users/niick/work/mvnclvr/src/it/mng/xdoclet/target/test.clover
           [echo] Build Dir: /Users/niick/work/mvnclvr/src/it/mng/xdoclet/target/test.clover
      [INFO] Executed tasks
      [INFO] [resources:resources]
      

      The fact the $

      {project.build.directory}

      property has been expanded already under 2.0.9, means that the forked lifecycle has the same value for that property.

      This new behavior will break any plugin which uses a forked lifecycle.

        Issue Links

          Activity

          Hide
          Nick Pellow added a comment -

          To reproduce this bug, simply unpack this archive and run:

          mvn clean install
          

          When run with version 2.0.9 of maven you will see that the properties get resolved.
          When run with version 2.0.8, these properties are not resolved.

          Please let me know if you have any difficulties reproducing this.

          Show
          Nick Pellow added a comment - To reproduce this bug, simply unpack this archive and run: mvn clean install When run with version 2.0.9 of maven you will see that the properties get resolved. When run with version 2.0.8, these properties are not resolved. Please let me know if you have any difficulties reproducing this.
          Hide
          Shane Isbell added a comment -

          I tried to run the attached project but received a build error:

          [INFO] You need to configure a license file location for Clover. You can create an evaluation license at http://www.atlassian.com/ex/GenerateLicense.jspa?product=Clover&version=2

          Looks as though there is a registration process needed prior to verifing the bug.

          Show
          Shane Isbell added a comment - I tried to run the attached project but received a build error: [INFO] You need to configure a license file location for Clover. You can create an evaluation license at http://www.atlassian.com/ex/GenerateLicense.jspa?product=Clover&version=2 Looks as though there is a registration process needed prior to verifing the bug.
          Hide
          Nick Pellow added a comment -

          Hi Shane,

          No need for verification. I mistakenly left a reference to the clover maven plugin. This is not needed to reproduce the bug.
          Please remove the plugin configuration from the pom.xml and try again.

          I've attached the archive again, with the plugin removed.

          Cheers,
          Nick

          Show
          Nick Pellow added a comment - Hi Shane, No need for verification. I mistakenly left a reference to the clover maven plugin. This is not needed to reproduce the bug. Please remove the plugin configuration from the pom.xml and try again. I've attached the archive again, with the plugin removed. Cheers, Nick
          Hide
          Nick Pellow added a comment -

          This archive has no dependency on Clover.

          FYI - the next release of the clover plugin will be have a valid evaluation license bundled.

          Cheers,
          Nick

          Show
          Nick Pellow added a comment - This archive has no dependency on Clover. FYI - the next release of the clover plugin will be have a valid evaluation license bundled. Cheers, Nick
          Hide
          John Casey added a comment -

          MNG-3355: the solution for this item broke MNG-3530

          Show
          John Casey added a comment - MNG-3355 : the solution for this item broke MNG-3530
          Hide
          John Casey added a comment -

          I've refactored the way POM expressions are resolved in the build section, and will be posting my proposal to fix this issue shortly on http://docs.codehaus.org/display/MAVEN/Dynamic+POM+Build+Sections (confluence isn't responding for me to post a revision to this document ATM)...

          The feature branch I've been working on is at:

          http://svn.apache.org/repos/asf/maven/components/branches/john-2.0.x-dynamicBuild

          One question, though: I've tried to run the MNG-3530 project attached to this issue, and it fails without creating a target/clover/test.clover directory. This would seem to be because clover isn't running when you run 'mvn clean install'...is there another way to verify this fix against the issue you're reporting? I've added integration tests for this issue here:

          https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation

          But, I'm not sure whether they express the whole problem.

          Show
          John Casey added a comment - I've refactored the way POM expressions are resolved in the build section, and will be posting my proposal to fix this issue shortly on http://docs.codehaus.org/display/MAVEN/Dynamic+POM+Build+Sections (confluence isn't responding for me to post a revision to this document ATM)... The feature branch I've been working on is at: http://svn.apache.org/repos/asf/maven/components/branches/john-2.0.x-dynamicBuild One question, though: I've tried to run the MNG-3530 project attached to this issue, and it fails without creating a target/clover/test.clover directory. This would seem to be because clover isn't running when you run 'mvn clean install'...is there another way to verify this fix against the issue you're reporting? I've added integration tests for this issue here: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-dynamicPOMInterpolation But, I'm not sure whether they express the whole problem.
          Hide
          John Casey added a comment -

          merged from feature branch, and verified on 2.0.x branch build.

          Show
          John Casey added a comment - merged from feature branch, and verified on 2.0.x branch build.
          Hide
          Nick Pellow added a comment -

          Hi John,

          Could you please confirm which branch this has been fixed on?
          This behavior still persists for me under Maven 2.1.0-M1.
          The attached .zip file still reproduces the problem.

          Cheers,
          Nick

          Show
          Nick Pellow added a comment - Hi John, Could you please confirm which branch this has been fixed on? This behavior still persists for me under Maven 2.1.0-M1. The attached .zip file still reproduces the problem. Cheers, Nick
          Hide
          Brett Porter added a comment -

          need to review the fix and the IT, I have the same problem in both sample projects provided with 2.1.0-M1

          Show
          Brett Porter added a comment - need to review the fix and the IT, I have the same problem in both sample projects provided with 2.1.0-M1
          Hide
          John Casey added a comment -

          I can't get the attached sample project to fail. I'm using JDK 1.4 with Maven 2.1.0-M1, and had to modify the POM to include the following repository entry:

              <pluginRepositories>
                <pluginRepository>
                  <id>atlassian</id>
                  <url>http://repository.atlassian.com/maven2</url>
                </pluginRepository>
              </pluginRepositories>
          

          but it clearly shows the xdoclet plugin creating the target/clover/test.clover file...

          Can someone tell me how I can reproduce this problem? BTW, the Maven core ITs are all passing here for this issue, too...

          Show
          John Casey added a comment - I can't get the attached sample project to fail. I'm using JDK 1.4 with Maven 2.1.0-M1, and had to modify the POM to include the following repository entry: <pluginRepositories> <pluginRepository> <id> atlassian </id> <url> http://repository.atlassian.com/maven2 </url> </pluginRepository> </pluginRepositories> but it clearly shows the xdoclet plugin creating the target/clover/test.clover file... Can someone tell me how I can reproduce this problem? BTW, the Maven core ITs are all passing here for this issue, too...
          Hide
          Nick Pellow added a comment -

          Hi john,

          Thanks for looking into this. This looks to now be fixed on 2.1.0-M1. It is not however working for 2.0.10-RC8.

          Here is my output running:
          mvn clean clover2:instrument using maven 2.0.8, 2.0.9, 2.0.10-RC8 and 2.1.0-M1:

          2.0.8: correct behavior

          [INFO] Initializing DocletTasks!!!
          [INFO] Executing tasks
              [touch] Creating /Users/niick/downloads/MNG-3530/target/clover/test.clover
               [echo] Build Dir: ${project.build.directory}/test.clover
          [INFO] Executed tasks
          

          2.0.9 broken

          [INFO] Initializing DocletTasks!!!
          [INFO] Executing tasks
              [touch] Creating /Users/niick/downloads/MNG-3530/target/test.clover
               [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/test.clover
          [INFO] Executed tasks
          

          2.0.10-RC8 broken

          [INFO] Executing tasks
              [touch] Creating /Users/niick/downloads/MNG-3530/target/test.clover
               [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/test.clover
          [INFO] Executed tasks
          

          2.1.0-M1: correct behavior

          [INFO] Initializing DocletTasks!!!
          [INFO] Executing tasks
              [touch] Creating /Users/niick/downloads/MNG-3530/target/clover/test.clover
               [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/clover/test.clover
          [INFO] Executed tasks
          
          Show
          Nick Pellow added a comment - Hi john, Thanks for looking into this. This looks to now be fixed on 2.1.0-M1. It is not however working for 2.0.10-RC8. Here is my output running: mvn clean clover2:instrument using maven 2.0.8, 2.0.9, 2.0.10-RC8 and 2.1.0-M1: 2.0.8: correct behavior [INFO] Initializing DocletTasks!!! [INFO] Executing tasks [touch] Creating /Users/niick/downloads/MNG-3530/target/clover/test.clover [echo] Build Dir: ${project.build.directory}/test.clover [INFO] Executed tasks 2.0.9 broken [INFO] Initializing DocletTasks!!! [INFO] Executing tasks [touch] Creating /Users/niick/downloads/MNG-3530/target/test.clover [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/test.clover [INFO] Executed tasks 2.0.10-RC8 broken [INFO] Executing tasks [touch] Creating /Users/niick/downloads/MNG-3530/target/test.clover [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/test.clover [INFO] Executed tasks 2.1.0-M1: correct behavior [INFO] Initializing DocletTasks!!! [INFO] Executing tasks [touch] Creating /Users/niick/downloads/MNG-3530/target/clover/test.clover [echo] Build Dir: /Users/niick/downloads/MNG-3530/target/clover/test.clover [INFO] Executed tasks
          Hide
          Brett Porter added a comment -

          interesting - I had the problem in 2.1.0-M1. I'll try it again to confirm, maybe I got them mixed up.

          Nick, can we close this if it is solved in a final 2.1.0 in the near future?

          Show
          Brett Porter added a comment - interesting - I had the problem in 2.1.0-M1. I'll try it again to confirm, maybe I got them mixed up. Nick, can we close this if it is solved in a final 2.1.0 in the near future?
          Hide
          Nick Pellow added a comment -

          Hi Brett,

          Could you please confirm it works under 2.1.0-M1? I just re-read my previous comment that it was broken under 2.1.0-M1 for me too.
          Either both of us were mistaken, or possibly something has changed?

          I am happy to have this closed if solved in a final 2.1.0 release.

          Thanks!
          Nick

          Show
          Nick Pellow added a comment - Hi Brett, Could you please confirm it works under 2.1.0-M1? I just re-read my previous comment that it was broken under 2.1.0-M1 for me too. Either both of us were mistaken, or possibly something has changed? I am happy to have this closed if solved in a final 2.1.0 release. Thanks! Nick
          Hide
          John Casey added a comment -

          Consolidating to 2.1.0-M1 so we can then rename to 2.1.0. We can weed out any issues we want to push to a later release from this set once we've done the consolidation.

          Show
          John Casey added a comment - Consolidating to 2.1.0-M1 so we can then rename to 2.1.0. We can weed out any issues we want to push to a later release from this set once we've done the consolidation.
          Hide
          Brett Porter added a comment -

          I'm still getting this with 2.1.0-M1 and M2-SNAPSHOT. Are we all using the same versions of the plugins?

          Show
          Brett Porter added a comment - I'm still getting this with 2.1.0-M1 and M2-SNAPSHOT. Are we all using the same versions of the plugins?
          Hide
          Benjamin Bentmann added a comment -

          Are we all using the same versions of the plugins?

          The attached test project is missing plugin versions, that should be fixed to wipe out this uncertainty.

          Show
          Benjamin Bentmann added a comment - Are we all using the same versions of the plugins? The attached test project is missing plugin versions, that should be fixed to wipe out this uncertainty.
          Hide
          Brett Porter added a comment -

          I think I made the same mistake I may have made earlier - running "mvn clean install" from the first instructions with the second project. It works if I run the clover instrument command per the latter instructions.

          Show
          Brett Porter added a comment - I think I made the same mistake I may have made earlier - running "mvn clean install" from the first instructions with the second project. It works if I run the clover instrument command per the latter instructions.
          Hide
          Nick Pellow added a comment -

          ah. sorry for the confusion here. I think I tried removing the Clover plugin entirely from the equation, however left the check in the verifications.xml .

          Cheers,Nick

          Show
          Nick Pellow added a comment - ah. sorry for the confusion here. I think I tried removing the Clover plugin entirely from the equation, however left the check in the verifications.xml . Cheers,Nick

            People

            • Assignee:
              John Casey
              Reporter:
              Nick Pellow
            • Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: