title: Ant needs junit.jar on travis server
body: <p>When I run <code>ant test</code> everything is cool, but when Travis runs the same command I get </p>
  
  <p>$ ant test</p>
  
  <blockquote>
    <p>Buildfile:
    /home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml </p>
    
    <p>compile:</p>
  
  <pre><code>[mkdir] Created dir: /home/travis/build/AwesomeTeamPlayer/event-receiver/build
  [javac] /home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml:28:
  </code></pre>
    
    <p>warning: 'includeantruntime' was not set, defaulting to
    build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 12 source files to /home/travis/build/AwesomeTeamPlayer/event-receiver/build
        [javac] Note: /home/travis/build/AwesomeTeamPlayer/event-receiver/src/EventReceiver/EventsCollection.java
    uses unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details. </p>
    
    <p>test-compile:</p>
  
  <pre><code>[mkdir] Created dir: /home/travis/build/AwesomeTeamPlayer/event-receiver/build/test
  [javac] Compiling 3 source files to /home/travis/build/AwesomeTeamPlayer/event-receiver/build/test 
  </code></pre>
    
    <p>test:</p>
    
    <p>BUILD FAILED</p>
    
    <p>/home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml:42:</p>
    
    <p>Problem: failed to create task or type junit </p>
    
    <p>Cause: the class
    org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.</p>
  
  <pre><code>    This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in
      -/usr/share/ant/lib
      -/home/travis/.ant/lib
      -a directory added on the command line with the -lib argument 
  </code></pre>
    
    <p>Do not panic, this is a common problem. </p>
    
    <p>The commonest cause is a missing JAR. </p>
    
    <p>This is not a bug; it is a configuration problem</p>
  </blockquote>
  
  <p>When I changed <code>ant test</code> to <code>ant test -lib ./lib/junit-4.12.jar</code> in .travis.yml file I get the same error message :/</p>
  
  <p><strong>.travis.yml</strong>:</p>
  
  <pre><code>language: java
  jdk:
    - oraclejdk8
  
  services:
    - docker
  
  script: ant test -lib ./lib/junit-4.12.jar
  </code></pre>
  
  <p><strong>build.xml</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-2"?&gt;
  &lt;project name="Project name" basedir="." default="compile"&gt;
  
      &lt;property name="src.dir" value="./src"/&gt;
      &lt;property name="build.dir" value="./build"/&gt;
      &lt;property name="lib.dir" value="./lib"/&gt;
      &lt;property name="test.dir" value="./tests"/&gt;
      &lt;property name="test.build.dir" value="./build/test"/&gt;
  
      &lt;path id="classpath.compile"&gt;
          &lt;pathelement location="${lib.dir}/amqp-client-4.0.2.jar"/&gt;
          &lt;pathelement location="${lib.dir}/json-20170516.jar"/&gt;
          &lt;pathelement location="${lib.dir}/slf4j-api-1.7.25.jar"/&gt;
          &lt;pathelement location="${lib.dir}/slf4j-simple-1.7.25.jar"/&gt;
          &lt;pathelement location="${build.dir}"/&gt;
      &lt;/path&gt;
  
      &lt;path id="classpath.test"&gt;
          &lt;pathelement location="${lib.dir}/mockito-all-1.10.19.jar"/&gt;
          &lt;pathelement location="${lib.dir}/junit-4.12.jar"/&gt;
          &lt;pathelement location="${lib.dir}/hamcrest-core-1.3.jar"/&gt;
          &lt;pathelement location="${build.dir}"/&gt;
      &lt;/path&gt;
  
      &lt;target name="compile" depends=""&gt;
          &lt;delete dir="${build.dir}" /&gt;
          &lt;mkdir dir="${build.dir}"/&gt;
          &lt;javac srcdir="${src.dir}" destdir="${build.dir}"&gt;
              &lt;classpath refid="classpath.compile"/&gt;
          &lt;/javac&gt;
      &lt;/target&gt;
  
      &lt;target name="test-compile" depends="compile"&gt;
          &lt;mkdir dir="${test.build.dir}"/&gt;
          &lt;javac srcdir="${test.dir}" destdir="${test.build.dir}" includeantruntime="false"&gt;
              &lt;classpath refid="classpath.test"/&gt;
              &lt;classpath refid="classpath.compile"/&gt;
          &lt;/javac&gt;
      &lt;/target&gt;
  
      &lt;target name="test" depends="test-compile"&gt;
          &lt;junit printsummary="on" haltonfailure="yes" fork="true"&gt;
              &lt;classpath&gt;
                  &lt;path refid="classpath.test"/&gt;
                  &lt;path refid="classpath.compile"/&gt;
                  &lt;pathelement location="${test.build.dir}"/&gt;
              &lt;/classpath&gt;
              &lt;formatter type="brief" usefile="false" /&gt;
              &lt;batchtest&gt;
                  &lt;fileset dir="${test.dir}" includes="**/*Test.java" /&gt;
              &lt;/batchtest&gt;
          &lt;/junit&gt;
      &lt;/target&gt;
  
      &lt;target name="test-integration" depends="test-compile"&gt;
          &lt;junit printsummary="on" haltonfailure="yes" fork="true"&gt;
              &lt;classpath&gt;
                  &lt;path refid="classpath.test"/&gt;
                  &lt;path refid="classpath.compile"/&gt;
                  &lt;pathelement location="${test.build.dir}"/&gt;
              &lt;/classpath&gt;
              &lt;formatter type="brief" usefile="false" /&gt;
              &lt;batchtest&gt;
                  &lt;fileset dir="${test.dir}" includes="integration/**/*Test.java" /&gt;
              &lt;/batchtest&gt;
          &lt;/junit&gt;
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>In <strong>lib</strong> dir I have</p>
  
  <ul>
  <li>amqp-client-4.0.2.jar  </li>
  <li>hamcrest-core-1.3.jar  </li>
  <li>json-20170516.jar</li>
  <li>junit-4.12.jar  </li>
  <li>mockito-all-1.10.19.jar  </li>
  <li>slf4j-api-1.7.25.jar</li>
  <li>slf4j-simple-1.7.25.jar</li>
  </ul>