简体   繁体   中英

How to configure annotations processing in IntelliJ IDEA 14 for current project work?

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

After launching project B in Tomcat 7, I have an error:

Error:java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [A,B] are excluded from annotation processing

How do I avoid this problem?

I use Java 8, Tomcat 7 and Intellij Idea 14.

To solve these kind of problems need to use Analyze Module dependencies in 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.

EDIT – For the latest version, it is Analyze -> Analyze Module Dependencies..

In addition to Mikhails answer, here is how to fix it :

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

Not sure if it was the actual solution, but I had a similar issue on migrating our multi-module Maven Project to Idea 14.

Parent

  • junit 1.2.16

Module A

  • junit 1.2.17

Module B

  • junit 1.2.16
  • Module A

It failed to execute when I was trying to run an unit test from Module A. Totally removing junit from the modules resolved it for me. No idea why, but maybe you're having a similar set-up?

If the circular dependency is wrong then open Module Settings and remove it from the module(s) that should not have it.

If the dependency is correct then uncheck the Enable annotation processing box in File | Settings | Build, Execution, Deployment | Compiler | Annotation Processors File | Settings | Build, Execution, Deployment | Compiler | Annotation Processors

在此处输入图片说明

Going into Settings->Build->Compiler->Annotation Processors and disabling it solved it.

Allowing Test-A to depend on B, even though B depends on A

I'm using IntelliJ2019.1

But it's sad it doesn't seem to consider the maven test scope

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. Delete the tag that is causing the issue. You can find the dependecy with the issue in the console.

Hope it helps. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM