[英]How to specify an AbstractProcessor on the apt/javac command line?
I have a class that extends javax.annotation.processing.AbstractProcessor
, which I'd like to run over some .java
files with apt
. 我有一个扩展
javax.annotation.processing.AbstractProcessor
的类,我想用apt
运行一些.java
文件。
How do I specify the class name on the apt
command-line (or in an ant apt task)? 如何在
apt
命令行(或ant apt任务)中指定类名? The command-line options I see, such as -factory
expect an AnnotationProcessorFactory
, not an AbstractProcessor
. 我看到的命令行选项,例如
-factory
期望AnnotationProcessorFactory
,而不是AbstractProcessor
。
I use javac 1.6.0_20. 我使用javac 1.6.0_20。
The relevant options for my compiler are 我的编译器的相关选项是
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
I suspect you are using javac 1.5.*. 我怀疑你使用的是javac 1.5。*。 That JDK does not work with AbstractProcessor (which was introduced in 1.6).
JDK不适用于AbstractProcessor (1.6中引入)。 The solution is to upgrade your JDK.
解决方案是升级您的JDK。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.