Looking at your build.xml - the reason your tests are being run when you deploy is that deploy depends on jar, and jar depends on test... So the sequence for deploy is something like: [init] [compile] (because test depends on compile) [test] (because jar depends on test) [jar] (because deploy depends on jar) [deploy]
Good luck :) -----Original Message----- From: Dan Perik [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 3:39 PM To: Ant Users List Subject: RE: conditional testing based on compiling I think the "uptodate" target is what I need. I think I'll have that set a property whether anything needs compiled or not. I can use that same property to determine whether the tests need rerun, and whether the jar file needs rebuilt. Thanks! FYI my build.xml file is something like this: <target name="init" ...> <target name="compile" depends="init" description="Compile the source"> <target name="test" depends="init,compile" description="Do JUnit unit tests"> <target name="jar" depends="init,test" description="Make the jar file"> <target name="deploy" depends="jar" description="Deploy application to servlet container"> <target name="war" depends="init,deploy" description="Make the war binary deployment file"> ...etc... - Dan On Fri, 2003-10-03 at 14:56, Anderson, Kajsa wrote: > What are the other dependencies of "deploy"? From your description, it > sounds like your build file looks something like this: > > <target name="deploy" depends="compile">...</target> > <target name="junit" depends="compile">...</target> > <target name="compile">...</target> > > If that's the case, and "junit" runs when you execute "deploy", it sounds > like something else that "deploy" depends on has a dependency on "junit". > > You might also look at using a property set by the <uptodate> to > conditionally run "junit". > > -----Original Message----- > From: Dan Perik [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 2:35 PM > To: [EMAIL PROTECTED] > Subject: conditional testing based on compiling > > Hello, > > I have a build file which uses JUnit to run tests on my code after it > compiles (it depends on "compile"). The build file also has a deploy > target, etc., which also depends on "compile". These unit test are time > consuming. There are times when it doesn't need to "compile" to > "deploy". But it still runs the unit tests anyways (even though it > doesn't need to). What I'd like to do is have it only run the unit > tests IF it had to compile something. Sort of like: > > do compile { > if anything compiled { > do tests > } > } > > Is there any way to do this? > > Thanks! > Dan > > --------------------------------------------------------------------- > 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] -- Dan Perik <[EMAIL PROTECTED]> --------------------------------------------------------------------- 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]
