RE: using maven.test.skip

2005-09-27 Thread Anthony Kong
Thanks very much for your help, Andy!

The 2nd problem I mentioned in my last mail seems to have something to do
with how I read the variable back.

Instead of 

j:if test=${!empty(maven.test.skip.value)}

I used 

j:if test=${context.getVariable('maven.test.skip.value')=='true'}

And it works!

Thanks,

Anthony

-Original Message-
From: Andy Glick [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 27 September 2005 12:34 PM
To: Maven Users List
Cc: 'Maven Users List'
Subject: RE: using maven.test.skip

At 08:32 PM 9/26/2005, Anthony Kong wrote:

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.


Anthony,

You might want to try adding the artifact namespace to your project tag. As
in xmlns:artifact=artifact. I have found that with M1 1.0.2 and 1.1b1 that
the artifact namespace was necessary in order to set values in plugins.

I realized that I did have an existing project on which I could experiment. 
I've included a fragment of a maven.xml file, but I'm using Maven 1.1b2 so
your mileage may vary.

The coverage goal will execute the jblanket, jcoverage, and emma coverage
tools. Coverage tools instrument the code under test and then run the
testcases and report the % of the CUT that is covered. In this case, using
preGoals from the coverage tools I first checked to see if
maven.test.skip.value was not empty and removed it if it was and then set
the value of maven.test.skip.value to true. In the postGoal for test:test I
changed the value of maven.test.skip.value to false. So in this example I am
varying the value of the Jelly variable serving as a sentinel and setting
the a plugin variable's value. If you are interested, I've got a trace of
the execution of this maven.xml file which I'm willing to mail to you.

Hope that this helps.



project default=coverage
 xmlns:j=jelly:core
 xmlns:license=license
 xmlns:maven=jelly:maven
 xmlns:util=jelly:util
 xmlns:ant=jelly:ant

   goal name=coverage
 attainGoal name=jblanket:coverage/
 attainGoal name=jcoverage/
 attainGoal name=emma:report/
   /goal

   preGoal name=jblanket:coverage
 echo message=value of maven.test.skip.value is
${maven.test.skip.value}/
 j:if test=${!empty(maven.test.skip.value)}
   j:remove var=maven.test.skip.value/
   echo message=executing j:remove of maven.test.skip.value/
 /j:if
 j:set var=maven.test.skip.value value=true/
   /preGoal

   preGoal name=jcoverage:on
 echo message=value of maven.test.skip.value is
${maven.test.skip.value}/
 j:if test=${!empty(maven.test.skip.value)}
   j:remove var=maven.test.skip.value/
   echo message=executing j:remove of maven.test.skip.value/
 /j:if

 j:set var=maven.test.skip.value value=true/
   /preGoal

   preGoal name=emma:init
 echo message=value of maven.test.skip.value is
${maven.test.skip.value}/
 j:if test=${!empty(maven.test.skip.value)}
   j:remove var=maven.test.skip.value/
   echo message=executing j:remove of maven.test.skip.value/
 /j:if
 j:set var=maven.test.skip.value value=true/
   /preGoal

   preGoal name=test:test
 echo message=value of maven.test.skip.value is
${maven.test.skip.value}/
 maven:set plugin=maven-test-plugin property=maven.test.skip 
value=${maven.test.skip.value}/
 maven:get plugin=maven-test-plugin property=maven.test.skip 
var=reported.maven.test.skip/
 echo message=value of reported.maven.test.skip is
${reported.maven.test.skip}/
   /preGoal

   postGoal name=test:test
 j:if test=${!empty(maven.test.skip.value)}
   echo message=maven.test.skip.value is ${maven.test.skip.value}/
   j:set var=maven.test.skip.value value=false/
 /j:if
   /postGoal


-
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]



RE: using maven.test.skip

2005-09-26 Thread Anthony Kong
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: users@maven.apache.org
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]



RE: using maven.test.skip

2005-09-26 Thread Andy Glick

At 08:32 PM 9/26/2005, Anthony Kong wrote:


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.



Anthony,

You might want to try adding the artifact namespace to your project tag. As 
in xmlns:artifact=artifact. I have found that with M1 1.0.2 and 1.1b1 
that the artifact namespace was necessary in order to set values in plugins.


I realized that I did have an existing project on which I could experiment. 
I've included a fragment of a maven.xml file, but I'm using Maven 1.1b2 so 
your mileage may vary.


The coverage goal will execute the jblanket, jcoverage, and emma coverage 
tools. Coverage tools instrument the code under test and then run the 
testcases and report the % of the CUT that is covered. In this case, using 
preGoals from the coverage tools I first checked to see if 
maven.test.skip.value was not empty and removed it if it was and then set 
the value of maven.test.skip.value to true. In the postGoal for test:test I 
changed the value of maven.test.skip.value to false. So in this example I 
am varying the value of the Jelly variable serving as a sentinel and 
setting the a plugin variable's value. If you are interested, I've got a 
trace of the execution of this maven.xml file which I'm willing to mail to you.


Hope that this helps.



project default=coverage
xmlns:j=jelly:core
xmlns:license=license
xmlns:maven=jelly:maven
xmlns:util=jelly:util
xmlns:ant=jelly:ant

  goal name=coverage
attainGoal name=jblanket:coverage/
attainGoal name=jcoverage/
attainGoal name=emma:report/
  /goal

  preGoal name=jblanket:coverage
echo message=value of maven.test.skip.value is 
${maven.test.skip.value}/

j:if test=${!empty(maven.test.skip.value)}
  j:remove var=maven.test.skip.value/
  echo message=executing j:remove of maven.test.skip.value/
/j:if
j:set var=maven.test.skip.value value=true/
  /preGoal

  preGoal name=jcoverage:on
echo message=value of maven.test.skip.value is 
${maven.test.skip.value}/

j:if test=${!empty(maven.test.skip.value)}
  j:remove var=maven.test.skip.value/
  echo message=executing j:remove of maven.test.skip.value/
/j:if

j:set var=maven.test.skip.value value=true/
  /preGoal

  preGoal name=emma:init
echo message=value of maven.test.skip.value is 
${maven.test.skip.value}/

j:if test=${!empty(maven.test.skip.value)}
  j:remove var=maven.test.skip.value/
  echo message=executing j:remove of maven.test.skip.value/
/j:if
j:set var=maven.test.skip.value value=true/
  /preGoal

  preGoal name=test:test
echo message=value of maven.test.skip.value is 
${maven.test.skip.value}/
maven:set plugin=maven-test-plugin property=maven.test.skip 
value=${maven.test.skip.value}/
maven:get plugin=maven-test-plugin property=maven.test.skip 
var=reported.maven.test.skip/
echo message=value of reported.maven.test.skip is 
${reported.maven.test.skip}/

  /preGoal

  postGoal name=test:test
j:if test=${!empty(maven.test.skip.value)}
  echo message=maven.test.skip.value is ${maven.test.skip.value}/
  j:set var=maven.test.skip.value value=false/
/j:if
  /postGoal


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



using maven.test.skip

2005-09-25 Thread Anthony Kong
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? 

Cheers,
AK


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



Re: using maven.test.skip

2005-09-25 Thread Andy Glick

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]