You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Randall Fidler <ra...@testadvantage.com> on 2009/02/23 22:08:41 UTC

Disable/Enable tests per plugin/goal

Hello,

 

            I'm looking into using a feature of Clover, test
optimization, and run into a tricky situation.  I would like to use the
test optimization to speed up build times on Hudson and the issue comes
in that Clover, as part of it's test optimization, puts hooks inside
your code.  This effectively means you cannot use any artifacts
generated during the test optimization process for deployment, which in
turn means the CI can't automatically deploy snapshots if Clover
optimization is on.

 

So, where's the Maven question?  Well what I'm trying to figure out is
can you, in one call, specify variables per plugin or even a profile per
plugin?  For example, I believe the following "could" work:

 

mvn verify -Pclover.optimize clean deploy

 

NOTE: the clover.optimize profile simply configures the clover2 plugin
to run the proper clover goals, it doesn't change any other behavior
with other plugins.

 

I say it could work IF tests were disabled for deploy.  If tests are not
disabled for deploy then what's the point of trying to optimize as all
the tests would be run anyhow - right?  This is where things get tricky,
I could just disable tests but then the clover plugin thinks it doesn't
have any work to do so my question is: is there a way with Maven to say
that tests are disabled for the deploy goal but NOT for the clover
portion?

 

I thought for a minute that    mvn verify -Pclover.optimize clean
package deploy might work but of course the default lifecycle is going
to run the test goal when deploy runs, which I can't disable - at least
not per goal/plugin that I've found.

 

Any advice is appreciated.

 

Regards,

 

Randall


Re: Disable/Enable tests per plugin/goal

Posted by Stephen Connolly <st...@gmail.com>.
USE FREESTYLE

add 2 maven buildsteps or use | to separate invocations

Sent from my [rhymes with myPod] ;-)

On 23 Feb 2009, at 21:27, "Randall Fidler" <randall.fidler@testadvantage.com 
 > wrote:

> Stephen,
>
>    Agreed... it's a bit wacked to say the least but I've got to
> basically do that to get ride of the 'optimized' source code, which  
> has
> the clover hooks in it - the compiled src / jar cannot be deployed  
> to a
> repository for production use as it has the clover 'hooks' in it.
>
> Optimally, (using Hudson BTW) Hudson would have multiple "executions"
> for a phase and that would make things easier but it would still  
> result
> in two lifecycle executions... something like:
>
> 1.  mvn verify -Pclover.optimize
> 2.  mvn clean deploy -Dmaven.tests.skip=true
>
> Basically I'm trying to save time by using Clover's test optimization
> but in the same 'build' on the CI server deploy a cloverLESS package.
> Hudson doesn't provide for running maven "twice" (that I've seen)  
> and so
> I'm trying to see if I can get Maven to do it. Thinking more on it, it
> does require two lifecycle runs in order to eliminate the src with the
> clover hooks in it BEFORE deployment.
>
> Thanks for the response.
>
> Regards,
>
> Randall
>
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> Sent: Monday, February 23, 2009 2:19 PM
> To: Maven Users List
> Cc: Maven Users List
> Subject: Re: Disable/Enable tests per plugin/goal
>
> wtf...
>
> you do know running verify followed by deploy is running the lifecycle
> twice!
>
> if you are using the freestyle project type (and _I_ do not recommend
> the m2 project type as it fecks with your pons behind your back) just
> run maven twice, problem solved
>
> Sent from my [rhymes with myPod] ;-)
>
> On 23 Feb 2009, at 21:08, "Randall Fidler"
> <randall.fidler@testadvantage.com
>> wrote:
>
>> Hello,
>>
>>
>>
>>           I'm looking into using a feature of Clover, test
>> optimization, and run into a tricky situation.  I would like to use
>> the
>> test optimization to speed up build times on Hudson and the issue
>> comes
>> in that Clover, as part of it's test optimization, puts hooks inside
>> your code.  This effectively means you cannot use any artifacts
>> generated during the test optimization process for deployment, which
>> in
>> turn means the CI can't automatically deploy snapshots if Clover
>> optimization is on.
>>
>>
>>
>> So, where's the Maven question?  Well what I'm trying to figure out  
>> is
>> can you, in one call, specify variables per plugin or even a profile
>> per
>> plugin?  For example, I believe the following "could" work:
>>
>>
>>
>> mvn verify -Pclover.optimize clean deploy
>>
>>
>>
>> NOTE: the clover.optimize profile simply configures the clover2  
>> plugin
>> to run the proper clover goals, it doesn't change any other behavior
>> with other plugins.
>>
>>
>>
>> I say it could work IF tests were disabled for deploy.  If tests are
>> not
>> disabled for deploy then what's the point of trying to optimize as  
>> all
>> the tests would be run anyhow - right?  This is where things get
>> tricky,
>> I could just disable tests but then the clover plugin thinks it
>> doesn't
>> have any work to do so my question is: is there a way with Maven to
>> say
>> that tests are disabled for the deploy goal but NOT for the clover
>> portion?
>>
>>
>>
>> I thought for a minute that    mvn verify -Pclover.optimize clean
>> package deploy might work but of course the default lifecycle is  
>> going
>> to run the test goal when deploy runs, which I can't disable - at
>> least
>> not per goal/plugin that I've found.
>>
>>
>>
>> Any advice is appreciated.
>>
>>
>>
>> Regards,
>>
>>
>>
>> Randall
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Disable/Enable tests per plugin/goal

Posted by Randall Fidler <ra...@testadvantage.com>.
I think the only way you'd be able to do it was if you could have verify
use profile A (with clover setup in it) and deploy use profile B
(sans-Clover) but from I've seen that's not possible.  My understanding
is you can use either a single or multiple profiles but they apply to
the entire execution, you can't change horses halfway.

-Randall

-----Original Message-----
From: Randall Fidler [mailto:randall.fidler@testadvantage.com] 
Sent: Monday, February 23, 2009 2:28 PM
To: Maven Users List
Subject: RE: Disable/Enable tests per plugin/goal

Stephen,

	Agreed... it's a bit wacked to say the least but I've got to
basically do that to get ride of the 'optimized' source code, which has
the clover hooks in it - the compiled src / jar cannot be deployed to a
repository for production use as it has the clover 'hooks' in it.

Optimally, (using Hudson BTW) Hudson would have multiple "executions"
for a phase and that would make things easier but it would still result
in two lifecycle executions... something like:

1.  mvn verify -Pclover.optimize
2.  mvn clean deploy -Dmaven.tests.skip=true

Basically I'm trying to save time by using Clover's test optimization
but in the same 'build' on the CI server deploy a cloverLESS package.
Hudson doesn't provide for running maven "twice" (that I've seen) and so
I'm trying to see if I can get Maven to do it. Thinking more on it, it
does require two lifecycle runs in order to eliminate the src with the
clover hooks in it BEFORE deployment.

Thanks for the response.

Regards,

Randall

-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com] 
Sent: Monday, February 23, 2009 2:19 PM
To: Maven Users List
Cc: Maven Users List
Subject: Re: Disable/Enable tests per plugin/goal

wtf...

you do know running verify followed by deploy is running the lifecycle  
twice!

if you are using the freestyle project type (and _I_ do not recommend  
the m2 project type as it fecks with your pons behind your back) just  
run maven twice, problem solved

Sent from my [rhymes with myPod] ;-)

On 23 Feb 2009, at 21:08, "Randall Fidler"
<randall.fidler@testadvantage.com 
 > wrote:

> Hello,
>
>
>
>            I'm looking into using a feature of Clover, test
> optimization, and run into a tricky situation.  I would like to use  
> the
> test optimization to speed up build times on Hudson and the issue  
> comes
> in that Clover, as part of it's test optimization, puts hooks inside
> your code.  This effectively means you cannot use any artifacts
> generated during the test optimization process for deployment, which  
> in
> turn means the CI can't automatically deploy snapshots if Clover
> optimization is on.
>
>
>
> So, where's the Maven question?  Well what I'm trying to figure out is
> can you, in one call, specify variables per plugin or even a profile  
> per
> plugin?  For example, I believe the following "could" work:
>
>
>
> mvn verify -Pclover.optimize clean deploy
>
>
>
> NOTE: the clover.optimize profile simply configures the clover2 plugin
> to run the proper clover goals, it doesn't change any other behavior
> with other plugins.
>
>
>
> I say it could work IF tests were disabled for deploy.  If tests are  
> not
> disabled for deploy then what's the point of trying to optimize as all
> the tests would be run anyhow - right?  This is where things get  
> tricky,
> I could just disable tests but then the clover plugin thinks it  
> doesn't
> have any work to do so my question is: is there a way with Maven to  
> say
> that tests are disabled for the deploy goal but NOT for the clover
> portion?
>
>
>
> I thought for a minute that    mvn verify -Pclover.optimize clean
> package deploy might work but of course the default lifecycle is going
> to run the test goal when deploy runs, which I can't disable - at  
> least
> not per goal/plugin that I've found.
>
>
>
> Any advice is appreciated.
>
>
>
> Regards,
>
>
>
> Randall
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Disable/Enable tests per plugin/goal

Posted by Andreas Benneke <ab...@beansoft.de>.
Hi Randal,
> 1.  mvn verify -Pclover.optimize
> 2.  mvn clean deploy -Dmaven.tests.skip=true
>   
we managed to setup something similar using the invoker plugin. Our 
problem was, that by running "test" and "deploy" together on our 
multi-part-project the snapshot versions of the first parts got deployed 
while the ones with the failed tests did not - so the situation in the 
repository would get inconsistent if only one test failed...

Our continuus integration tool (Continuum) does not seem to be able to 
run multipe commands per schedule, not talking about "dependent" runs 
like: "do the second only if the first one did not fail"...
We worked around this limitation by setting up a special profile (see 
below) which invokes the whole lifecyle twice with the command "mvn -N 
-P ci"

Regards,
  Andy

      <!-- Usage: mvn -N -P ci -->
      <profile>
         <id>ci</id>
         <build>
            <defaultGoal>initialize</defaultGoal>
            <plugins>
               <plugin>
                  <artifactId>maven-invoker-plugin</artifactId>
                  <configuration>
                     <pom>pom.xml</pom>
                     <noLog>true</noLog>
                     <streamLogs>true</streamLogs>
                     <suppressSummaries>true</suppressSummaries>
                  </configuration>
                  <executions>
                     <!-- run the tests first -->
                     <execution>
                        <id>test</id>
                        <phase>initialize</phase>
                        <goals>
                           <goal>run</goal>
                        </goals>
                        <configuration>
                           <goals>
                              <goal>clean</goal>
                              <goal>install</goal> <!-- should be 
"test", but "install" is required for some dependencies -->
                           </goals>
                        </configuration>
                     </execution>

                     <!-- and install + deploy all, once the tests 
succeeded -->
                     <execution>
                        <id>deploy</id>
                        <phase>initialize</phase>
                        <goals>
                           <goal>run</goal>
                        </goals>
                        <configuration>
                           <profiles>
                              <profile>notest</profile> <!-- do not run 
the tests again, see below -->
                           </profiles>
                           <goals>
                              <goal>deploy</goal>
                           </goals>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>

      <!-- Disable testing -->
      <profile>
         <id>notest</id> <!-- convenience -->
         <properties>
            <maven.test.skip>true</maven.test.skip>
         </properties>
      </profile>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Disable/Enable tests per plugin/goal

Posted by Randall Fidler <ra...@testadvantage.com>.
Stephen,

	Agreed... it's a bit wacked to say the least but I've got to
basically do that to get ride of the 'optimized' source code, which has
the clover hooks in it - the compiled src / jar cannot be deployed to a
repository for production use as it has the clover 'hooks' in it.

Optimally, (using Hudson BTW) Hudson would have multiple "executions"
for a phase and that would make things easier but it would still result
in two lifecycle executions... something like:

1.  mvn verify -Pclover.optimize
2.  mvn clean deploy -Dmaven.tests.skip=true

Basically I'm trying to save time by using Clover's test optimization
but in the same 'build' on the CI server deploy a cloverLESS package.
Hudson doesn't provide for running maven "twice" (that I've seen) and so
I'm trying to see if I can get Maven to do it. Thinking more on it, it
does require two lifecycle runs in order to eliminate the src with the
clover hooks in it BEFORE deployment.

Thanks for the response.

Regards,

Randall

-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com] 
Sent: Monday, February 23, 2009 2:19 PM
To: Maven Users List
Cc: Maven Users List
Subject: Re: Disable/Enable tests per plugin/goal

wtf...

you do know running verify followed by deploy is running the lifecycle  
twice!

if you are using the freestyle project type (and _I_ do not recommend  
the m2 project type as it fecks with your pons behind your back) just  
run maven twice, problem solved

Sent from my [rhymes with myPod] ;-)

On 23 Feb 2009, at 21:08, "Randall Fidler"
<randall.fidler@testadvantage.com 
 > wrote:

> Hello,
>
>
>
>            I'm looking into using a feature of Clover, test
> optimization, and run into a tricky situation.  I would like to use  
> the
> test optimization to speed up build times on Hudson and the issue  
> comes
> in that Clover, as part of it's test optimization, puts hooks inside
> your code.  This effectively means you cannot use any artifacts
> generated during the test optimization process for deployment, which  
> in
> turn means the CI can't automatically deploy snapshots if Clover
> optimization is on.
>
>
>
> So, where's the Maven question?  Well what I'm trying to figure out is
> can you, in one call, specify variables per plugin or even a profile  
> per
> plugin?  For example, I believe the following "could" work:
>
>
>
> mvn verify -Pclover.optimize clean deploy
>
>
>
> NOTE: the clover.optimize profile simply configures the clover2 plugin
> to run the proper clover goals, it doesn't change any other behavior
> with other plugins.
>
>
>
> I say it could work IF tests were disabled for deploy.  If tests are  
> not
> disabled for deploy then what's the point of trying to optimize as all
> the tests would be run anyhow - right?  This is where things get  
> tricky,
> I could just disable tests but then the clover plugin thinks it  
> doesn't
> have any work to do so my question is: is there a way with Maven to  
> say
> that tests are disabled for the deploy goal but NOT for the clover
> portion?
>
>
>
> I thought for a minute that    mvn verify -Pclover.optimize clean
> package deploy might work but of course the default lifecycle is going
> to run the test goal when deploy runs, which I can't disable - at  
> least
> not per goal/plugin that I've found.
>
>
>
> Any advice is appreciated.
>
>
>
> Regards,
>
>
>
> Randall
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Disable/Enable tests per plugin/goal

Posted by Stephen Connolly <st...@gmail.com>.
wtf...

you do know running verify followed by deploy is running the lifecycle  
twice!

if you are using the freestyle project type (and _I_ do not recommend  
the m2 project type as it fecks with your pons behind your back) just  
run maven twice, problem solved

Sent from my [rhymes with myPod] ;-)

On 23 Feb 2009, at 21:08, "Randall Fidler" <randall.fidler@testadvantage.com 
 > wrote:

> Hello,
>
>
>
>            I'm looking into using a feature of Clover, test
> optimization, and run into a tricky situation.  I would like to use  
> the
> test optimization to speed up build times on Hudson and the issue  
> comes
> in that Clover, as part of it's test optimization, puts hooks inside
> your code.  This effectively means you cannot use any artifacts
> generated during the test optimization process for deployment, which  
> in
> turn means the CI can't automatically deploy snapshots if Clover
> optimization is on.
>
>
>
> So, where's the Maven question?  Well what I'm trying to figure out is
> can you, in one call, specify variables per plugin or even a profile  
> per
> plugin?  For example, I believe the following "could" work:
>
>
>
> mvn verify -Pclover.optimize clean deploy
>
>
>
> NOTE: the clover.optimize profile simply configures the clover2 plugin
> to run the proper clover goals, it doesn't change any other behavior
> with other plugins.
>
>
>
> I say it could work IF tests were disabled for deploy.  If tests are  
> not
> disabled for deploy then what's the point of trying to optimize as all
> the tests would be run anyhow - right?  This is where things get  
> tricky,
> I could just disable tests but then the clover plugin thinks it  
> doesn't
> have any work to do so my question is: is there a way with Maven to  
> say
> that tests are disabled for the deploy goal but NOT for the clover
> portion?
>
>
>
> I thought for a minute that    mvn verify -Pclover.optimize clean
> package deploy might work but of course the default lifecycle is going
> to run the test goal when deploy runs, which I can't disable - at  
> least
> not per goal/plugin that I've found.
>
>
>
> Any advice is appreciated.
>
>
>
> Regards,
>
>
>
> Randall
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org