title: error: package org.testng.annotations does not exist [javac] import org.testng.annotations.Test;
body: <p>I have a simple project that I am trying to build using Ant. My project contains testng, but I get an error message when I try to run the build. Could you please help me? I have spent a lot of time trying to see what's the problem but without any results so far.</p>
  
  <p>Here is the project:</p>
  
  <pre><code>package selenium;
  
  import org.testng.annotations.Test;
  
  public class HomePage {
  
      @Test
      public void test(){
  
          System.out.println("this is test");
      }
  }
  </code></pre>
  
  <p>Now I have a lib file that contains the testng.jar, and I have a test.xml suite that runs the class, and here is my build file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;project name="Concep.TestAutomation" basedir="." default="all"&gt;
  
   &lt;property name="src.dir" value="${basedir}/src" /&gt;
   &lt;property name="build.dir" value="target" /&gt;
   &lt;property name="classes.dir" value="${build.dir}/classes" /&gt; 
   &lt;property name="suites.dir" value="suites" /&gt;
   &lt;property name="testng.path" value="lib/testng.jar" /&gt;
   
   &lt;property name="testreport.dir" value="${build.dir}/test-output" /&gt;
   
   &lt;target name="clean" description="Delete the build directory."&gt;
    &lt;delete dir="${build.dir}" /&gt;
   &lt;/target&gt;
  
   &lt;target name="init" depends="clean" description="Create build directories."&gt;
    &lt;!--Create the build directory structure used by compile --&gt;
    &lt;mkdir dir="${build.dir}" /&gt;
    &lt;mkdir dir="${classes.dir}" /&gt;
    &lt;mkdir dir="${testreport.dir}" /&gt;
   &lt;/target&gt;
  
   &lt;target name="compile" depends="init" description="Compile tests."&gt;
    &lt;!-- Compile the java code from ${src} into ${classes.dir} --&gt;
    &lt;javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" /&gt;
   &lt;/target&gt;
  
   &lt;target name="run-test" depends="compile" description="Run test suite."&gt;
    &lt;!-- Run a testng suite--&gt;
    &lt;taskdef resource="testngtasks" classpath="${testng.path}" /&gt;
  
    &lt;testng classpathref="${testng.path}" outputDir="${testreport.dir}" haltonfailure="true" verbose="5"&gt;
     &lt;xmlfileset dir="${suites.dir}" includes="IA-smoke-test.xml" /&gt;
     &lt;/testng&gt;
   &lt;/target&gt;
  
   &lt;target name="all" depends="run-test" description="Executes all targets." /&gt;
   
    &lt;target name="all-debug" description="outputs all vars in use."&gt;
    &lt;!-- useful to diagnose runtime problems --&gt; 
         &lt;echo message="'work.dir' = '${basedir}/..'"/&gt;
         &lt;echo message="'lib.dir' = '${basedir}/lib'"/&gt;
         &lt;echo message="'src.dir' = '${basedir}/src'"/&gt;
         &lt;echo message="'config.dir' = '${basedir}/config'"/&gt;
         &lt;echo message="'build.dir' = 'target'"/&gt;
         &lt;echo message="'classes.dir' = '${build.dir}/classes'"/&gt;
         &lt;echo message="'suites.dir' = '${basedir}/suites'"/&gt;
         &lt;echo message="'testng.path' = '${basedir}/lib/testng.jar'"/&gt;
       &lt;/target&gt;
  
  &lt;/project&gt;</code></pre>
  </div>
  </div>
  </p>