Java 如何在 IntelliJ IDEA 14 中为当前项目工作配置注释处理?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27223917/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to configure annotations processing in IntelliJ IDEA 14 for current project work?
提问by Mikhail
The structure of the project is:
该项目的结构是:
- Parent project
- A project (Spring) have dependency of project B in pom.xml
- B project (Spring MVC) have dependency of project A in pom.xml
- 父项目
- 一个项目(Spring)在 pom.xml 中有项目 B 的依赖
- B 项目(Spring MVC)在 pom.xml 中有项目 A 的依赖
After launching project B in Tomcat 7 i have an error:
在 Tomcat 7 中启动项目 B 后,出现错误:
Error:java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [A,B] are excluded from annotation processing
错误:java:模块周期不支持注释处理。请确保周期 [A,B] 中的所有模块都被排除在注释处理之外
How to avoid this problem?
如何避免这个问题?
I use java 8,Tomcat 7 and idea 14.
我使用 java 8、Tomcat 7 和 idea 14。
采纳答案by Mikhail
To solve these kind of problems need to use Analyze Module dependencies in InteliJ-idea.
为了解决这类问题,需要使用 InteliJ-idea 中的分析模块依赖关系。
File Menu > Analyze > Module Dependencies
文件菜单 > 分析 > 模块依赖
This shows the list of all projects which have cyclic dependencies and should be resolved first.
这显示了所有具有循环依赖项并应首先解决的项目的列表。
This feature helps you to find the problem.
此功能可帮助您找到问题。
EDITFor latest version, it is Analyze -> Analyze Module Dependencies..
编辑对于最新版本,它是分析-> 分析模块依赖关系..
回答by codepleb
In addition to Mikhails answer, here is how to fix it:
除了 Mikhails 的回答,这里是如何修复它:
When you saw which modules have cyclic dependencies, right-click your project and
当您看到哪些模块具有循环依赖项时,右键单击您的项目并
Open Module Settings
-> Expand the according module-group and select the module-> Dependencies
-> select and remove it
Open Module Settings
->展开相应的模块组并选择模块-> Dependencies
->选择并删除它
回答by SimtiMan
An alternative in order to solve this problem that worked for me (the above answers didn't).
为了解决这个对我有用的问题的替代方法(上面的答案没有)。
Go to the pom.xml
from the package / project that you have.
Deletethe tag that is causing the issue.
You can find the dependecy with the issue in the console.
转到pom.xml
您拥有的包/项目。
删除导致问题的标签。您可以在控制台中找到问题的相关性。
Hope it helps. :)
希望能帮助到你。:)
回答by David Lilljegren
Going into Settings->Build->Compiler->Annotation Processors and disabling it solved it.
进入 Settings->Build->Compiler->Annotation Processors 并禁用它解决了它。
Allowing Test-A to depend on B, even though B depends on A
允许测试-A 依赖于 B,即使 B 依赖于 A
I'm using IntelliJ2019.1
我正在使用 IntelliJ2019.1
But it's sad it doesn't seem to consider the maven test scope
但是很遗憾它似乎没有考虑 maven 测试范围