History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MPTEST-66
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Lukas Theussl
Reporter: nicolas de loof
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Test Plugin

1.8 version introduces bug in other plugins

Created: 21/Jul/06 05:27 AM   Updated: 01/Jul/07 02:40 AM
Component/s: None
Affects Version/s: 1.8
Fix Version/s: 1.8.1

Time Tracking:
Not Specified

File Attachments: 1. Text File MPTEST-66.patch (0.9 kb)

Issue Links:
Duplicate
 
Related
 
Supercedes
 
dependent
 


 Description  « Hide
When maven-war-plugin is run with maven.test.skip=true, the sources are not compiled.
Latest version of test-plugin has removed prereqs on java:compile & java:jar-resources.
Assuming other plugins themself run the java:compile goal may have impact on lots of plugin and can break many application builds. I think the "test:test" goal may have a prereqs="java:compile,java:jar-resources", and the "test:compile" goal only prereqs="test:prepare-filesystem,test:test-resources"

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
nicolas de loof - 21/Jul/06 05:29 AM
Patch to attach java:compile as a test:test prereqs

this patch also solves MPWAR-62


Lukas Theussl - 24/Jul/06 03:53 PM
It seems more logical to fix this in the war plugin. There is a slight backwards compatibility problem, but it only affects the case when test.skip=true, which is not recommended anyway (certainly not in production builds!).

nicolas de loof - 21/Aug/06 07:35 AM
Please reconsider this issue as not only the WAR plugin get's broken.

+ The JAR plugin will compile the java source two times (beacuse prereqs="java:compile,java:jar-resources,test:test")

+ The javaapp plugin (from maven-plugins@sourceforge.net) doesn't compile java if skip=true

+ maybe other external plugins expect test:test to compile sources, based on copy/paste of code from official maven plugins, so upgrading to maven-test-plugin 1.8 can break the build process.

Why not simply adding moving prerequs on java:compile to test:test ?

<goal name="test:test"
description="Test the application"
prereqs="java:compile,java:jar-resources">


Shinobu Kawai - 21/Aug/06 07:01 PM
This issue was intoduced from the fix of MPTEST-46.

Shinobu Kawai - 21/Aug/06 07:07 PM
I like nicolas' solution for backward compatability, but I'm not sure if it is "right" to assume that test:test will always compile and copy resources. If other plugins need the java:compile and java:jar-resouces to be run, I think it should explicitly state that, like the JAR plugin example given. (Having said that, I don't like the idea of compiling twice, either...)

Shinobu Kawai - 21/Aug/06 07:26 PM
Actually, it's going to compile twice anyways (unless we revert the whole MPTEST-46 fix) because test:compile is being attainGoal-ed, and that will call java:compile.

java:compile and java:jar-resources will do nothing on the second time, so the only impact would be if pre/postGoal's were set in maven.xml.


nicolas de loof - 22/Aug/06 08:21 AM
Lot's of code generation plugin are attached to java:compile as preGoals...

I can suggest two options :

1. keep previous behaviour and assume test:* allways depends on java:compile, even if this is not clean.

2. make ONLY the "test" goal (not the "test:test") depend on java:compile, so that a

  • "maven test" compiles project and run the tests, as any user may expect it
  • any plugin depending on test:test will NOT force a twice compilation.
    This 2d solution requires update to other plugins.

Any 3d solution would be welcome as both seems not very cool...


Shinobu Kawai - 23/Aug/06 11:24 AM
Not clear how the whole prereqs stuff work, but I was wondering if adding an attribute to call attainGoal with the same werkz session would work.

Something like <attainGoal name="java:compile" useParentSession="true" />.


Lukas Theussl - 25/Apr/07 06:05 AM
We need to decide what to do about this issue for m11. Personally, I don't want to revert MPTEST-46 as the current way is the way it should be. Also, we have already adapted our other plugins to it (MPEJB-23, MPWAR-62, jar), so internally, we are clean. The only problem is with backward compatibility when using third-party plugins that rely on java:compile being called with test:test. For this case, there is a simple workaround, eg for the javaapp plugin, add the following in your maven.xml:
<preGoal name="javaapp:jar">
  <j:if test="${unitTestSourcesPresent != 'true' or context.getVariable('maven.test.skip') == 'true'}">
    <attainGoal name="java:compile"/>
    <attainGoal name="java:jar-resources"/>
  </j:if>
</preGoal>

Sources being compiled twice is not a real problem (and btw it was that way before already), as the second time only the goal will be called but the sources not actually compiled.

So my suggestion is to leave it as is and write a paragraph on the main plugin page to document the problem. Unless someone comes up with a new solution, as none of the alternatives above seem acceptable to me.


Lukas Theussl - 01/May/07 02:59 PM
Documented the issue.