Hi, Andy,
Thanks a lot for the prompt reply! Using your technique, I have encountered
two issues during testing,
1) the variable "maven.test.skip.value" seems to be not "presisting" between
goals. E.g. after I set this variable in preGoal of war:install, then went
on to use a <j:if test="empty(...)"} to test it in preGoal of test:test, it
is always tested "true".
I don't think I understand how to define a property for a maven plugin. Any
pointer on this subject is appreciated.
2) To proceed, I hardcoded the value in the <maven:set/> tag.
It is something like:
<maven:set plugin="maven-test-plugin"
property="maven.test.skip"
value="true"/>
Then there is an runtime error:
You must define an attribute called 'value' for this tag.
This is the way I defined the namespace for my maven plugin:
<project
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:j="jelly:core"
xmlns:doc="doc"
xmlns:maven="jelly:maven"
>
I wonder if you may have any idea on why this error? Basically if I can
solve Q2 here, I can manage to roll my first ever custom-made maven plugin
:-)
BTW, I am using maven1.0.2
Cheers,
AK
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Andy Glick
Sent: Monday, 26 September 2005 11:38 AM
To: [email protected]
Subject: Re: using maven.test.skip
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]