title: Compiling a build.xml file using Ant
body: <p>I recently installed <em>Ant 1.8.4</em> and <em>JasperReports 4.6.0</em> on my <em>Ubuntu</em> machine.</p>
  
  <p>The following environmental variables were set on my account:</p>
  
  <pre><code>PATH=$PATH:/opt/ant/bin
  
  export PATH
  
  export ANT_HOME=/opt/ant
  
  export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
  </code></pre>
  
  <p>When I try to run a demo build file in the <em>JasperReports</em> demo samples directory using the command <code>ant</code> I get the following error:</p>
  
  <pre><code>Buildfile: build.xml
  
  BUILD FAILED
  /opt/jasperreports-4.6.0/demo/samples/antcompile/build.xml:3: The following
   error occurred while executing this line:
  jar:file:/opt/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml:37: Problem: failed to create task or type componentdef
  Cause: The name is undefined.
  Action: Check the spelling.
  Action: Check that any custom tasks/types have been declared.
  Action: Check that any &lt;presetdef&gt;/&lt;macrodef&gt; declarations have taken place.
  </code></pre>
  
  <p>Any help in solving this problem will be super helpful. </p>
  
  <p>The snippet of <em>build.xml</em> file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project name="antcompile" default="test" basedir="."&gt;
  
      &lt;description&gt;Shows how multiple JRXML files can be compiled in batch mode using ANT.&lt;/description&gt;
  
      &lt;path id="classpath"&gt;
          &lt;pathelement location="../../../build/classes"/&gt;
          &lt;fileset dir="../../../lib"&gt;
              &lt;include name="**/*.jar"/&gt;
          &lt;/fileset&gt;
      &lt;/path&gt;
  
      &lt;path id="runClasspath"&gt;
          &lt;path refid="classpath"/&gt;
          &lt;pathelement location="../../fonts"/&gt;
          &lt;pathelement location="./build/classes"/&gt;
      &lt;/path&gt;
  
      &lt;taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"&gt; 
          &lt;classpath refid="classpath"/&gt;
      &lt;/taskdef&gt;
  
      &lt;target name="javac" description="Compiles the Java source files used in the report designs."&gt;
          &lt;mkdir dir="./build/classes"/&gt; 
          &lt;javac srcdir="./src" destdir="./build/classes" debug="true" optimize="false" deprecation="false"/&gt;
      &lt;/target&gt; 
  
      &lt;target name="compile1" description="Compiles report designs specified using the &amp;quot;srcdir&amp;quot; in the &amp;lt;jrc&amp;gt; tag."&gt; &lt;!-- 27 row # --&gt;
          &lt;mkdir dir="./build/reports"/&gt; 
          &lt;jrc 
                  srcdir="./reports"
                  destdir="./build/reports"
                  tempdir="./build/reports"
                  keepjava="true"
                  xmlvalidation="true"&gt;
              &lt;classpath refid="runClasspath"/&gt;
              &lt;include name="**/*.jrxml"/&gt;
          &lt;/jrc&gt;
      &lt;/target&gt; 
  </code></pre>