 <p>The classpath of javac should refer to directories and jar files containing the root of compiled class files trees. It should not refer to Java files.</p> <p>Similarly, the source directory should refer to the root of the package tree of the source files. Not to directories corresponding to packages, inside the package tree.</p> <p>Your compile task should look like</p> <pre><code>&lt;target name="main-compile"&gt; &lt;javac includeantruntime="false" srcdir="src/main/java" destdir="${gen.bin.main.dir}" debug="on" includes="com/myapp/api/**/*.java, com/myapp/impl/core/FizzImpl/**/*.java"&gt; &lt;classpath refid="lib.main.path"/&gt; &lt;/javac&gt; &lt;/target&gt; </code></pre>