title: Bamboo Ant Task fails when running junit task
body: <p>In my current project I'm using junit tests. Runing my ant file on my local pc produces my Test Report as expected, but when bamboo tries to run my tests, it produces the following output.</p>
  
  <p>Whats my mistake?</p>
  
  <p>SimplerTest.java</p>
  
  <pre><code>import static org.junit.Assert.*;
  
  import org.junit.Test;
  
  public class SimplerTest {
  
  
  @Test
  public void dummerTest()
  {
      assertTrue(true);
  }
  }
  </code></pre>
  
  <p>Local Output:</p>
  
  <pre><code>Buildfile: C:\Users\jussi\git\kingdom-builder-repository\build.xml
  
  compile-test:
  [javac] Compiling 1 source file to C:\Users\jussi\git\kingdom-builder-repository\bin
  
  junit:
      [junit] Running me.jussi.kingdombuilder.SimplerTest
      [junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,062 sec
  
  main:
  
  BUILD SUCCESSFUL
  Total time: 1 second
  </code></pre>
  
  <p>Server Output:</p>
  
  <pre><code>compile-test:
  [javac] Compiling 1 source file to /var/atlassian/application-data/bamboo/xml-data/build-dir/KB-KBP1-JOB1/bin
  
  junit:
  
  BUILD FAILED
  /var/atlassian/application-data/bamboo/xml-data/build-dir/KB-KBP1-JOB1/build.xml:108: Using loader AntClassLoader[/opt/apache-ant-1.9.0/lib/ant-launcher.jar:/opt/ant/lib/ant.jar:/opt/ant/lib/ant-junit.jar:/opt/ant/lib/ant-junit4.jar:/var/atlassian/application-data/bamboo/xml-data/build-dir/KB-KBP1-JOB1/kingdom-builder/libs/junit-4.10.jar:/var/atlassian/application-data/bamboo/xml-data/build-dir/KB-KBP1-JOB1/bin] 
  on class org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter: java.lang.NoClassDefFoundError: junit/framework/TestListener
  </code></pre>
  
  <p>build.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="KingdomBuild" default="main" basedir="."&gt;
  &lt;!-- Sets variables which can later be used. --&gt;
  &lt;!-- The value of a property is accessed via ${} --&gt;
  
  &lt;property name="test.src.dir" location="kingdom-builder/test" /&gt;
  &lt;property name="build.dir" location="bin" /&gt;
  &lt;property name="test.report.dir" location="testreport" /&gt;
  
  &lt;!-- Define the classpath which includes the junit.jar and the classes after compiling--&gt;
  &lt;path id="junit.class.path"&gt;
      &lt;pathelement location="kingdom-builder/libs/junit-4.10.jar" /&gt;
      &lt;pathelement location="${build.dir}" /&gt;
  &lt;/path&gt;
  
  &lt;!-- Compiles the java code (including the usage of library for JUnit --&gt;
  &lt;target name="compile-test"&gt;
      &lt;javac srcdir="${test.src.dir}" destdir="${build.dir}" includeantruntime="false"&gt;
          &lt;classpath refid="junit.class.path" /&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  
  &lt;!-- Run the JUnit Tests --&gt;
  &lt;!-- Output is XML, could also be plain--&gt;
  &lt;target name="junit" depends="compile-test"&gt;
      &lt;junit printsummary="on" fork="true" haltonfailure="true"&gt;
          &lt;classpath refid="junit.class.path" /&gt;
          &lt;formatter type="xml" /&gt;
          &lt;batchtest todir="${test.report.dir}"&gt;
              &lt;fileset dir="${build.dir}"&gt;
                  &lt;include name="**/*Test*.class" /&gt;
              &lt;/fileset&gt;
          &lt;/batchtest&gt;
      &lt;/junit&gt;
  &lt;/target&gt;
  
  &lt;target name="main" depends="junit"&gt;
      &lt;description&gt;Main target&lt;/description&gt;
  &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>ant -v Output: </p>
  
  <p><a href="http://nopaste.info/1abdd27a8e.html" rel="nofollow">http://nopaste.info/1abdd27a8e.html</a></p>