You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Paul Christmann <pa...@priorartisans.com> on 2003/01/03 18:03:59 UTC

Ant Classpath References

<alert type="newbie">Help!</alert>

I'm trying to install Cactus for the first time.  I've got my test cases 
written, and I'm using Ant to stop/start a local tomcat instance.  So 
far, so good.  My Tomcat instance runs, and I can use a browser to 
invoke the test suite and verify the results.  So I'm pretty sure that 
I've got Tomcat configured correctly, and am writing a test case correctly.

Now I'm trying to use Ant <junit> task to actually invoke the test 
cases.  What I'm seeing, though, is that the tasks invoked by the 
"runservertest" task do not inherit classpaths from the calling target 
(though they inherit properties).  Is that expected?

My build file (with major snipping) looks sort-of-like:

<project>
   <target name="load-properties">
     <xmlproperty file="properties.xml"/>
     <path id="test.classpath">
       <pathelement location="something"/>
     </path>
   </target>

   <target name="cactus" depends="load-properties">
     <runservertests testURL="${url}"
                     startTarget="start-tomcat"
                     testTarget="run-cactus-tests"
                     stopTarget="stop-tomcat"/>
   </target>

   <target name="start-tomcat">
   </target>

   <target name="stop-tomcat">
   </target>

   <target name="run-cactus-tests">
     <junit>
       <!-- ** HERE'S THE PROBLEM ** -->
       <classpath refid="test.classpath"/>
     </junit>
   </target>
</project>

The run-cactus-tests target has access to all of the properties defined 
by the load-properties task, but does *not* have the test.classpath 
path.  I can work around this by adding a dependency to the 
run-cactus-tests, but I am curious if I have something configured 
incorrectly.

Thanks for any help,

Paul Christmann




RE: Ant Classpath References

Posted by Vincent Massol <vm...@octo.com>.
Hi Paul,

I guess the reason has to do with the AntCall Ant task. The
runservertest custom Ant task calls your start, stop and test targets
using AntCall. However, until Cactus 1.5, I was using the
"setInherit(true)" API which propagates the Ant properties but not the
Ant references... This was fixed a few weeks ago and I now use the
"setInheritAll(true)" API which also propagates the references...

Thanks
-Vincent

> -----Original Message-----
> From: news [mailto:news@main.gmane.org] On Behalf Of Paul Christmann
> Sent: 03 January 2003 18:04
> To: cactus-user@jakarta.apache.org
> Subject: Ant Classpath References
> 
> <alert type="newbie">Help!</alert>
> 
> I'm trying to install Cactus for the first time.  I've got my test
cases
> written, and I'm using Ant to stop/start a local tomcat instance.  So
> far, so good.  My Tomcat instance runs, and I can use a browser to
> invoke the test suite and verify the results.  So I'm pretty sure that
> I've got Tomcat configured correctly, and am writing a test case
> correctly.
> 
> Now I'm trying to use Ant <junit> task to actually invoke the test
> cases.  What I'm seeing, though, is that the tasks invoked by the
> "runservertest" task do not inherit classpaths from the calling target
> (though they inherit properties).  Is that expected?
> 
> My build file (with major snipping) looks sort-of-like:
> 
> <project>
>    <target name="load-properties">
>      <xmlproperty file="properties.xml"/>
>      <path id="test.classpath">
>        <pathelement location="something"/>
>      </path>
>    </target>
> 
>    <target name="cactus" depends="load-properties">
>      <runservertests testURL="${url}"
>                      startTarget="start-tomcat"
>                      testTarget="run-cactus-tests"
>                      stopTarget="stop-tomcat"/>
>    </target>
> 
>    <target name="start-tomcat">
>    </target>
> 
>    <target name="stop-tomcat">
>    </target>
> 
>    <target name="run-cactus-tests">
>      <junit>
>        <!-- ** HERE'S THE PROBLEM ** -->
>        <classpath refid="test.classpath"/>
>      </junit>
>    </target>
> </project>
> 
> The run-cactus-tests target has access to all of the properties
defined
> by the load-properties task, but does *not* have the test.classpath
> path.  I can work around this by adding a dependency to the
> run-cactus-tests, but I am curious if I have something configured
> incorrectly.
> 
> Thanks for any help,
> 
> Paul Christmann
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>