java – 在maven中的注释处理器输出

前端之家收集整理的这篇文章主要介绍了java – 在maven中的注释处理器输出前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用JSR 269作为编译时分析代码方法,如果需要,则将其失败.
我在maven中显示我的注释处理器的输出时遇到麻烦(Ant确实显示输出)
我使用 javax.annotation.processing.Messager来显示警告和错误,但是在maven中我看不到它的输出. (我知道它运行,因为它生成代码,应该).
有任何想法吗?

解决方法

我认为你在编译器插件MCOMPILER-66中遇到了一个Maven错误或更好的错误.当涉及注释处理时,编译器插件有几个问题,例如 MCOMPILER-62.真正的最佳选择是使用imo禁止编译器的注释处理插件,并使用 maven-processor-plugin.在这 blog post,你可以看到如何使用它.看起来像这样:
<plugins>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
            <compilerArgument>-proc:none</compilerArgument>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.bsc.maven</groupId>
        <artifactId>maven-processor-plugin</artifactId>
        <version>1.3.7</version>
        <executions>
            <execution>
                <id>process</id>
                <goals>
                    <goal>process</goal>
                </goals>
                <phase>process-sources</phase>
            </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-jpamodelgen</artifactId>
                <version>1.1.0.Final</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    </plugin>

还要注意注释处理器依赖关系如何很好地仅限于插件.

原文链接:https://www.f2er.com/java/123932.html

猜你在找的Java相关文章