`
swbssd
  • 浏览: 56061 次
  • 来自: ...
文章分类
社区版块
存档分类
最新评论

ant使用jdt compiler编译

阅读更多

使用javacc编译存在一些条件无法编译的情况,例如org.codehaus.jackson.annotate.JsonIgnore的注解@JsonIgnore
这个时候可以使用eclipse的编译器jdt进行编译,以下方法:
 <!--在ant中添加property,使用eclipse jdt compiler编译-->
 <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

使用jdt的时候需要注意的是,javac必须指定版本否则无法编译
 <!-- 如果指定了build.compiler使用eclipse jdt编译就必须指定版本-->
 <javac
  nowarn="on"
  source="1.6"
  target="1.6"
  deprecation="true"
  debug="true" encoding="UTF-8"
  srcdir="${base.src.dir}"
  destdir="${classes.dir}"
  classpathref="lib.class.path" >
 </javac>

把eclipse的jdt三个jar包放到ant\lib下面去:

org.eclipse.jdt.compiler.tool_1.0.100.v_894_R34x.jar

org.eclipse.jdt.core_3.4.4.v_894_R34x.jar

org.eclipse.jdt.debug.ui_3.3.1.v20080730_r341.jar

----------------------------------------------------------------------------------

Class not found: org.eclipse.jdt.core.JDTCompilerAdapter 错误处理:
ant调用eclipse的jdt出现这个错误,检查类名书写是否正确,是否有空格。 
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics