本文介绍了maven-processor-plugin 忽略未定义的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 JPA 2 maven 项目,我想处理源以获得静态元模型.我做了什么我拿了 JBoss 的静态元模型处理器 并将其设置为在 generate-sources 阶段运行.现在,显然我有一些引用元模型的类,编译本身也很好.但是 maven-processor-plugin 本身会产生错误,抱怨它无法像这样从元模型中找到符号:

I've JPA 2 maven project and I want to process sources to have the static meta model. What I did I took JBoss' static meta model processor and set it up to run during generate-sources phase. Now, obviously I have some classes that reference the meta model and compilation itself goes fine. But maven-processor-plugin itself generates errors complaining that it can't find symbols from meta model like this:

[INFO] --- maven-processor-plugin:2.2.4:process (process) @ ng-grid-java ---
[ERROR] diagnostic: c:\...\service\position\PositionSpecifications.java:13: cannot find symbol
symbol  : class Position_

这是合乎逻辑的,因为它实际上生成了这些类,但这是不对的,因为它会给原本正确的项目带来错误.还是我用错了?我错过了什么吗?

Which is logical because it actually generates these classes, but is not right since it brings errors to an otherwise correct project. Or maybe I'm using it wrong? Am I missing something?

更新:我已经能够通过使用配置参数 outputDiagnostics 来抑制错误输出,但我不确定这是正确的方法.

Update: I have been able to inhibit the error output by using configuration parameter outputDiagnostics but I'm not sure that's the right way.

推荐答案

我已经设置了插件的阶段-s,例如:

I have setted the phase-s of the plugins like:

build-helper-maven-plugin --> <phase>process-sources</phase>

maven-processor-plugin --> <phase>compile</phase>

这篇关于maven-processor-plugin 忽略未定义的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:59