Java – ant warning: implicitly compiled files are not annotated

I received this warning when running ant build scripts (ant 1.8.2, Java 1.6)

[javac] warning: Implicitly compiled files were not subject to annotation processing.
[javac] Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
[javac] 1 warning

Add < compilerarg value = "implicit" / > production:

[javac] error: Class names,'implicit',are only accepted if annotation processing is explicitly requested
[javac] 1 error

Add < compilerarg value = "proc: None" / > production:

[javac] javac: invalid flag: proc:none
[javac] Usage: javac <options> <source files>
[javac] use -help for a list of possible options

Someone can understand what warning means and how can I get rid of it?

Solution

I created a simple build xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="build" basedir=".">
    <target name="build">
        <javac destdir="bin" srcdir="." includes="**/*.java">
        </javac>
    </target>
</project>

Easy to use Java reference custom annotation But no source code was provided

public class T {
    @TestAnn
    public void test() {
    }
}

The output of the ant command is the same as the first output I tried to execute the javac command to compile it, but the error was: the symbol @ testann was not found and printed I don't know why the news is different

Then I add the annotation class and run the ant command again Build succeeded without warning

For your problem, the possible reasons are:

>The Java code refers to the custom annotation, but the annotation class cannot be found > based on the annotation processing security of javac, if the annotation requires a processor However, their jar does not contain the service provider configuration file You should specify the - processorpath or - processor option so that javac can find the appropriate processor

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>