Anthony Kong wrote:
Hi, all,
I have written a custom plugin for a in-house project which will produce a
ear file at the end.
There is a number of goals defined in this plugin. One of these is: <goal name="projecct:ear-build" description="Invokes ejb:install and
war:install goal">
     <j:set var="maven.test.skip" value="false"/>
     <ant:echo>{maven.test.skip} is set to ${maven.test.skip}</ant:echo>
     <attainGoal name="ejb:install"/>
     <j:if test="${maven.test.failure}">
       <fail message="There were test failures!"/>
     </j:if>
     <j:set var="maven.test.skip" value="true"/>
     <ant:echo>{maven.test.skip} is set to ${maven.test.skip}</ant:echo>
     <attainGoal name="war:install"/>
     <j:set var="maven.test.skip" value="false"/>
  </goal>
Basically i want to skip the junit test in war:install (ejb:install will
invoke the junit test). However the trick does not work. The junit test in
war:install is not skipped, even though from ant:echo I can see it is set to
true. Any suggestion to how to debug/solve this problem?

You might want to try the following:

<preGoal name="ejb:install">
 <j:set var="maven.test.skip.value" value="false"/>
</preGoal>

<preGoal name="war:install">
 <j:set var="maven.test.skip.value" value="true"/>
</preGoal>

<preGoal name="test:test">
 <maven:set plugin="maven-test-plugin" var="maven.test.skip" 
value="${maven.test.skip.value}"/>
</preGoal>

The reason that I would recommend this strategy is as follows:

1) you cannot rely upon a single setting of maven.test.skip.

2) because your effort to set the value of maven.test.skip before executing war:install 
isn't working, I think that you'll have better results if you "inject" the 
value of maven.test.skip into the maven-test-plugin

3) to do that <maven:set> is the preferred method, and the way that this set of 
code ought to work is that you should be able to explicitly set the value of 
maven.test.skip in the test plugin as you execute it

If this doesn't work, please try the following modification to the <j:set var> 
tags:

<j:set var="maven.test.skip.value" value="{appropriate value}" scope="parent"/>

and if that doesn't work, feel free to report the fact and we can try to debug 
whatever it is that is going on.

Hope that this helps.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to