title: Running JUnits Via Ant, and Trying to Configure Cobertura Code Coverage In Jenkins.
body: <p>So I have a java project in Eclipse. I build the war file via ant. Which I can invoke from Eclipse, or from the command line or via Jenkins. I am setting up the environment is such a way as to try and keep all three of those ways of building working, and with as little changing of the environment as possible to make it happen.</p>
  
  <p>So I am currently doing the compile, creating the war, generating javadoc, and running junits via my ant build.xml</p>
  
  <p>Trying to add Cobertura code coverage to the mix.</p>
  
  <p>I have installed the Jenkins for Cobertura and I'm now trying to get the junit running to work with Cobertura to properly instrument the classes and generate the coverage file.</p>
  
  <p>The cobertura doc says to start by defining the task as follows.</p>
  
  <pre><code>&lt;property name="cobertura.dir" value="C:/javastuff/cobertura" /&gt;
  
  &lt;path id="cobertura.classpath"&gt;
      &lt;fileset dir="${cobertura.dir}"&gt;
          &lt;include name="cobertura.jar" /&gt;
          &lt;include name="lib/**/*.jar" /&gt;
      &lt;/fileset&gt;
  &lt;/path&gt;
  
  &lt;taskdef classpathref="cobertura.classpath" resource="tasks.properties" /&gt;
  </code></pre>
  
  <p>Don't like that C:\ obviously ... I need a valid cobertura.dir ... but it is not really obvious how to configure it. Jenkins puts all the classes for the plugin here </p>
  
  <p>.jenkins/plugins/cobertura</p>
  
  <p>And the file structure underneath this is as follows.</p>
  
  <p>drwxrwxr-x  2 vpbuild vpbuild 4096 Jan  4 10:42 images
  drwxrwxr-x  3 vpbuild vpbuild 4096 Dec 15 12:36 META-INF
  -rw-rw-r--  1 vpbuild vpbuild    0 Jan  4 10:41 .timestamp
  drwxrwxr-x  4 vpbuild vpbuild 4096 Dec 15 12:36 WEB-INF</p>
  
  <p>So if this was to be my cobertura.dir there is no lib subdirectory defined here. There is in WEB-INF, but there is no cobertura jar there ... so none of it seems quite right.</p>
  
  <p>I have also downloaded the cobertura jar separately, and put that in ANT_HOME/lib, to hopefully assist with making the cobertura tasks more visible to ANT, but not sure how that would affect what I need to do as far as the build.xml.</p>
  
  <p>Anyone have any experience with configuring cobertura so that it can run via ant both within and outside jenkins in this way ? What does the build.xml need to look like to make it happen ?</p>
  
  <p>-Jim</p>