Issue Details (XML | Word | Printable)

Key: MNG-3530
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: John Casey
Reporter: Nick Pellow
Votes: 8
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
Maven 2

Regression: Properties get resolved before the LifeCycle is Forked.

Created: 17/Apr/08 02:57 AM   Updated: 10/Feb/09 04:15 PM
Component/s: General
Affects Version/s: 2.0.9
Fix Version/s: 2.1.0-M1

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive MNG-3530.tar.gz (15 kB)
2. Zip Archive MNG-3530.zip (22 kB)

Issue Links:
Related

Complexity: Intermediate


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Nick Pellow added a comment - 17/Apr/08 03:04 AM
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.


Shane Isbell added a comment - 14/May/08 01:02 PM
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.


Nick Pellow added a comment - 14/May/08 07:40 PM
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


Nick Pellow added a comment - 14/May/08 07:41 PM
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


John Casey added a comment - 04/Jun/08 05:26 PM
MNG-3355: the solution for this item broke MNG-3530

John Casey added a comment - 10/Jun/08 05:26 PM
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.


John Casey added a comment - 24/Jun/08 03:42 PM
merged from feature branch, and verified on 2.0.x branch build.

Nick Pellow added a comment - 17/Dec/08 10:50 PM
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


Brett Porter added a comment - 17/Dec/08 11:27 PM
need to review the fix and the IT, I have the same problem in both sample projects provided with 2.1.0-M1

John Casey added a comment - 06/Feb/09 12:35 PM
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...


Nick Pellow added a comment - 08/Feb/09 05:39 PM
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

Brett Porter added a comment - 08/Feb/09 08:00 PM
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?


Nick Pellow added a comment - 08/Feb/09 09:00 PM
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


John Casey added a comment - 09/Feb/09 09:35 AM
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.

Brett Porter added a comment - 10/Feb/09 03:42 AM
I'm still getting this with 2.1.0-M1 and M2-SNAPSHOT. Are we all using the same versions of the plugins?

Benjamin Bentmann added a comment - 10/Feb/09 03:48 AM

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.


Brett Porter added a comment - 10/Feb/09 03:50 AM
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.

Nick Pellow added a comment - 10/Feb/09 04:15 PM
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