Maven 1.x War Plugin

maven-war-plugin doesn't compile java sources when used with maven-test-plugin 1.8

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.2
  • Fix Version/s: 1.6.3
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    3

Description

I've found an issue when using latest versions of maven-test-plugin (1.8) :
when maven.test.skip=true is set, the <test:compile> goal is not executed. This sounds good, BUT the maven-war-plugin use "test:test" goal to attain the "java:compile" goal, so the generated war has no classes !

The war:resources plugin should have prereqs="war:war-resources,java:compile,test:test".

  1. MPWAR-62
    01/Aug/06 5:49 PM
    0.6 kB
    Shinobu Kawai
  2. MPWAR-62.patch
    16/Aug/06 4:03 AM
    0.7 kB
    nicolas de loof
  3. MPWAR-62.patch
    21/Jul/06 5:18 AM
    0.7 kB
    nicolas de loof

Issue Links

Activity

Hide
nicolas de loof added a comment -

patch on plugin.jelly to add a prereq for "java:compile" to "war:webapp" goal.

This has as a side effect that java:compile is run twice when tests are enabled

Show
nicolas de loof added a comment - patch on plugin.jelly to add a prereq for "java:compile" to "war:webapp" goal. This has as a side effect that java:compile is run twice when tests are enabled
Hide
nicolas de loof added a comment -

This issue can be considered a duplicated of MPTEST-66 as the problem seems to be better solved in the test plugin

Show
nicolas de loof added a comment - This issue can be considered a duplicated of MPTEST-66 as the problem seems to be better solved in the test plugin
Hide
Lukas Theussl added a comment -

Checking for maven.test.skip in the war plugin, so java:compile is not attained twice. Thanks!

Show
Lukas Theussl added a comment - Checking for maven.test.skip in the war plugin, so java:compile is not attained twice. Thanks!
Hide
nicolas de loof added a comment -

There is still a problem as java:jar-resources is skipped and resources are not copied to target/classes, so the inplace war has no resource.

Show
nicolas de loof added a comment - There is still a problem as java:jar-resources is skipped and resources are not copied to target/classes, so the inplace war has no resource.
Hide
Shinobu Kawai added a comment -

The workaround is also the same:

Add this in your maven.xml:
<preGoal name="war:webapp">
<j:if test="${unitTestSourcesPresent != 'true' or context.getVariable('maven.test.skip') == 'true'}">
<attainGoal name="java:compile"/>
<attainGoal name="java:jar-resources"/>
</j:if>
</preGoal>

The fix is also the same, and I can come up with a patch tomorrow, if it's not fixed.

Show
Shinobu Kawai added a comment - The workaround is also the same: Add this in your maven.xml: <preGoal name="war:webapp"> <j:if test="${unitTestSourcesPresent != 'true' or context.getVariable('maven.test.skip') == 'true'}"> <attainGoal name="java:compile"/> <attainGoal name="java:jar-resources"/> </j:if> </preGoal> The fix is also the same, and I can come up with a patch tomorrow, if it's not fixed.
Hide
Shinobu Kawai added a comment -

Patch to fix bug against latest in SVN.

Show
Shinobu Kawai added a comment - Patch to fix bug against latest in SVN.
Hide
nicolas de loof added a comment -

I just discoverd a new side-effect :

I project has NO test folder (no test !!! are you bug-free ?) the java classes are not compiled neither packaged in the war.

.

Show
nicolas de loof added a comment - I just discoverd a new side-effect : I project has NO test folder (no test !!! are you bug-free ?) the java classes are not compiled neither packaged in the war. .
Hide
nicolas de loof added a comment -

Latest patch should also solve this. I'll try it ASAP.

Show
nicolas de loof added a comment - Latest patch should also solve this. I'll try it ASAP.
Hide
nicolas de loof added a comment -

Please apply this patch to solve this issue.

Show
nicolas de loof added a comment - Please apply this patch to solve this issue.
Hide
nicolas de loof added a comment -

Sounds like latests comments on this issue had no effect on SVN.
This issue is not yet fully solved.

Show
nicolas de loof added a comment - Sounds like latests comments on this issue had no effect on SVN. This issue is not yet fully solved.
Hide
Lukas Theussl added a comment -

Sorry, please open a new issue with a detailed description of what exactly is still not working.

Show
Lukas Theussl added a comment - Sorry, please open a new issue with a detailed description of what exactly is still not working.
Hide
Shinobu Kawai added a comment -

This should be revisited once MPTEST-66 is fixed one way or another.

Show
Shinobu Kawai added a comment - This should be revisited once MPTEST-66 is fixed one way or another.

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: