I have an annotation processor that is depended on other libraries eg Guava, Commons. I already set it up with Eclipse and Maven. However, I want to use it with an Apache Ant's build file. So, I created following target:
<target name="compile.frontend" depends="compile.main">
<mkdir dir="${target}target/frontend/classes" />
<javac encoding="utf-8" destdir="${target}target/frontend/classes" debug="on" nowarn="true" source="1.6" target="1.6" optimize="on" includeantruntime="false">
<src path="src/application/java"/>
<classpath>
<fileset dir="lib">
<include name="main/*.jar" />
</fileset>
<pathelement location="${target}target/main/classes" />
</classpath>
<compilerarg line="-processorpath ${basedir}/lib/main/MyProcessor-1.0.jar;${basedir}/lib/main/javapoet-1.7.0.jar;${basedir}/lib/main/guava-17.0.jar;${basedir}/lib/main/commons-lang-2.6.jar"/>
<compilerarg line="-processor com.me.MyProcessor"/>
<compilerarg line="-s ${target}target/frontend/classes/"/>
</javac>
</target>
The error I get is the processor-generated class I instantiated is missing, "cannot find symbol".
The dependencies I added with a ";" separated list are the same dependencies I made Eclipse use the processor properly. I suspect from the output folder <compilerarg line="-s...
, since when I remove a dependency ie JavaPoet I get a "java.lang.NoClassDefFoundError" of JavaPoet. Any suggestion?
The problem was regarding some directory exclusion using exclude name
under javac lines:
<exclude name="**/folder_name/**"/>
There is also no need to add compilerarg line
s as I did at the original question. Having the libs under classpath is enough.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.