如何不编译使用javac源运行注解处理器(Java的8不能使用APT) [英] How to Run Annotation Processor without compiling sources using javac (Java 8 can't use Apt)
问题描述
如何运行注解处理器无需编译使用javac(Java的8不能使用APT)来源是什么?
How can i Run Annotation Processor without compiling sources using javac (Java 8 can't use Apt)?
有可能没有编译所有的文件只运行注释处理任何参数的javac?
Is there any parameter for javac that could run only annotation processing without compiling all files?
我想的javac做的:
What i want to do by javac:
-
只要找到注解的元素,并使用通过定义注释处理器处理它们
-processor
标志
做的不可以编译没有任何注解的源
do not compile any source that doesn't have any annotation
因为我想这样做Java的8这是不可能的使用apt完成这个任务?或者,也许这是什么?
Because i want do this on Java 8 it's impossible to use Apt for this task? Or maybe it is?
推荐答案
的根据什么说的工具不可用在Java中8 = http://openjdk.java.net/jeps/117相对=nofollow>这里,移植
易
到Java 8不会是直线前进
The apt
tool is not available in Java 8. Based on what is said here, porting apt
to Java 8 would not be straight-forward.
按照的javac
的手工录入:
-proc:没有,只有]
-proc: [none, only]
控制注释处理和编译是否完成。 -proc:无
意味着汇编是在没有标注处理。 -proc:只有
意味着只标注处理完成,没有任何后续编译
Controls whether annotation processing and compilation are done. -proc:none
means that compilation takes place without annotation processing. -proc:only
means that only annotation processing is done, without any subsequent compilation.
它的听起来像的 -proc:只有
会做你想做的事。如果没有,那么你就需要寻找一个第三方工具,或开发工具自己。
It sounds like -proc:only
would do what you want to do. If not, then you would need to look for a 3rd-party tool, or develop a tool yourself.
这篇关于如何不编译使用javac源运行注解处理器(Java的8不能使用APT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!