如何在Java 1.8版本上运行ant apt任务 [英] How to run ant apt task on java 1.8 version

查看:153
本文介绍了如何在Java 1.8版本上运行ant apt任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ant Apt上尝试在Java 1.8上构建ant apt任务将崩溃.但是在我必须更改的应用程序中,我必须使用此任务,因为它是使用ant构建的

On Ant Apt trying to build ant apt task on java 1.8 will crash. But in application that i have to change i must use this task because it is built with ant

有人知道如何避免这种崩溃并在Java 1.8上运行Ant apt任务吗?

Anyone have any idea how to avoid this crash and run Ant apt task on java 1.8?

推荐答案

如果您使用的是Java8,那么您无需直接运行apt任务;它可能在幕后发生.

If you are using java8; then you don't need to run the apt task directly; it can happen behind the scenes.

来自ANT自己的文档:

From ANT's own documentation :

此任务在Java 1.5到Java 1.7上运行.

This task runs on Java 1.5 to Java 1.7.

Apt在Java 1.6中已弃用,它可以作为Javac的一部分运行注释处理器,并已从Java 1.8的发行版中删除.尝试在Java 1.8下运行时,该任务将引发异常.

Apt is deprecated in Java 1.6, which can run annotation processors as part of javac, and removed from the distribution in Java 1.8. The task will fire an exception when attempting to run under Java 1.8.

但是,这意味着您需要确保自定义注释处理器在执行javac时位于类路径中.

However, all that means is that you need to make sure that your custom annotation processor is in the classpath at the point of executing javac.

   <javac source="${javac.version}" target="${javac.version}" destdir="${classes.build.dir}" srcdir="${src.dir}" debug="on" debuglevel="source,lines">
      <classpath>
        <!-- make sure this has "my-annotation-processor.jar" -->
        <path refid="main.classpath"/>
      </classpath>
    </javac>

这篇关于如何在Java 1.8版本上运行ant apt任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆