db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew McIntyre" <mcintyr...@gmail.com>
Subject Re: junit targets and setting classpath from ant
Date Thu, 15 Mar 2007 17:43:49 GMT
On 3/14/07, Daniel John Debrunner <djd@apache.org> wrote:
> I'm trying to setup one ant file that will call the derby top-level file
> to set a classpath and then execute the junit tests.
> E.g. logically
>   CLASSPATH="/work/dan/derby/trunk/classes" ant junit-autoloadtest
> So I have in a separate build file:
>   <target name="test">
>     <!-- need to set classpath here somehow -->
>     <ant antfile="build.xml" target="junit-autoloadtest">
>   </target>
> But I need to add something to set the classpath and then make sure the
> derby junit-oneclass picks it up.
> Any ideas?
> Can I used the refid option of classpath (not well documented at ant)
> somehow with changes to junit targets in build.xml to pick up an
> explicit classpath (e.g. derby.junit.classpath) if set, otherwise use
> the default setting?
> This is to get some continuous integration testing with CruiseControl.

With Ant 1.7, <junit> tasks honor nested classpath elements. So, you
could then add:

  <pathelement path="${derby.junit.classpath}"/>

inside the <junit> task in junit-oneclass. Then you'll probably want
to set derby.junit.classpath=${out.dir} in dirs.properties for the
default. You could also set up paths for various jar configurations in
various properties and then pass them in using nested <param>s on the
<ant> tasks.

<target name="test">
  <!-- run all tests -->
  <ant antfile="build.xml" target="junit-all">

  <!-- run tests with just derby.jar in the classpath -->
  <ant antfile="build.xml" target="junit-all">
    <property name="derby.junit.classpath"

  <!-- etc... -->



View raw message