How to get the command "maven test:test" to delete test files before executing?

View: New views
4 Messages — Rating Filter:   Alert me  

How to get the command "maven test:test" to delete test files before executing?

by laredotornado :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using Maven 1.1 with Java 1.5 on a Mac 10.5.6.  In my test directory, I can run "maven test:test" to execute all of my unit tests.  I would like that when I type this command, the first thing that happens is that all files in the current directory matching "*.tmp" get deleted (in case a previous test run crashed).  How can I customize the "maven test:test" command to delete the temporary files before it starts its test run?

Thanks, - Dave

Re: How to get the command "maven test:test" to delete test files before executing?

by Sony Antony :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is one of many possible ways of doing it :

add an antrun configuration and attach it to the validate ( very first )
phase.
This antrun should do teh *.tmp deletion that you need though its <delete>
task

Then execute maven as mvn validate test:test


--sony



On Tue, Nov 3, 2009 at 3:26 PM, laredotornado <laredotornado@...>wrote:

>
> Hi,
>
> I'm using Maven 1.1 with Java 1.5 on a Mac 10.5.6.  In my test directory, I
> can run "maven test:test" to execute all of my unit tests.  I would like
> that when I type this command, the first thing that happens is that all
> files in the current directory matching "*.tmp" get deleted (in case a
> previous test run crashed).  How can I customize the "maven test:test"
> command to delete the temporary files before it starts its test run?
>
> Thanks, - Dave
>
> --
> View this message in context:
> http://old.nabble.com/How-to-get-the-command-%22maven-test%3Atest%22-to-delete-test-files-before-executing--tp26163569p26163569.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

Re: How to get the command "maven test:test" to delete test files before executing?

by Lukas Theussl-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Use a preGoal in maven.xml:

   <preGoal name="test:test">
     <ant:delete>
       <ant:fileset dir="." includes="*.tmp" />
     </ant:delete>
   </preGoal>

HTH,
-Lukas


laredotornado wrote:

> Hi,
>
> I'm using Maven 1.1 with Java 1.5 on a Mac 10.5.6.  In my test directory, I
> can run "maven test:test" to execute all of my unit tests.  I would like
> that when I type this command, the first thing that happens is that all
> files in the current directory matching "*.tmp" get deleted (in case a
> previous test run crashed).  How can I customize the "maven test:test"
> command to delete the temporary files before it starts its test run?
>
> Thanks, - Dave
>

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


Re: How to get the command "maven test:test" to delete test files before executing?

by laredotornado :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks all for your responses.  Lukas, I went with yours and it worked instantly. - Dave

Lukas Theussl-4 wrote:
Use a preGoal in maven.xml:

   <preGoal name="test:test">
     <ant:delete>
       <ant:fileset dir="." includes="*.tmp" />
     </ant:delete>
   </preGoal>

HTH,
-Lukas


laredotornado wrote:
> Hi,
>
> I'm using Maven 1.1 with Java 1.5 on a Mac 10.5.6.  In my test directory, I
> can run "maven test:test" to execute all of my unit tests.  I would like
> that when I type this command, the first thing that happens is that all
> files in the current directory matching "*.tmp" get deleted (in case a
> previous test run crashed).  How can I customize the "maven test:test"
> command to delete the temporary files before it starts its test run?
>
> Thanks, - Dave
>

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