Reputation:
I am working on my own multi modules project, where I am using lombok. The problem occured when i wanted to start the application, and terminal showed error:
java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [domain,service] are excluded from annotation processing
So I turned off the annotation processing in project settings
And there are no more errors with modules
annotation processing, but there is the new error.
My classes which use lombok
does not recognize builder
method
java: cannot find symbol symbol: method builder()
because lombok require annotation processing - even intellij shows message: Do you want to enable lombok annotations?
when I turn on intellij.
Is there any way to solve this?
Upvotes: 4
Views: 6502
Reputation: 13261
From the error message, I conclude:
There is a (dependency) cycle in your modules:
Unfortunately the error message doesn't recommend you to elliminate these cycles, but (rather gently and task focused) only to "exclude them from pre-processing" (which is of course needed by lombok et.al.)
To proof yet (when you google "java module cycles", then you hit only this problem on the top results ..whereas "java module cycles good or bad?" brought me here:
Why are cyclic imports considered so evil? ), but I think "cyclic modules" is a "anti-module-pattern", and as long your "system" ist small and over-viewable: Break these cycles & avoid them!
So in your case, I would avoid any imports from service
to domain
so depend only unidirectional!
service -> domain
..., and notdomain -> service
!
, which will re-enable your pre-proccessing & lombok.
Upvotes: 2
Reputation:
Okay, I solved this problem with help of @xerx593
user.
The main reason why it was not working was this part of error:
modules from cycle [domain,service]
which means that there was a module cycle in my project.
I have got three modules: domain
, service
and ui
where
service
module is contingent on domain
module and
ui
module is contingent on service
so the structure looks like this: domain
-> service
-> ui
:
my pom.xml
in ui
module should implement service
module dependency
my pom.xml
in service
module should implement domain
module dependency
and pom.xml
in domain
module should not implement any of ui
and service
dependency
but because of my fault, I implemented service
dependency in domain
pom.xml and there was the problem with module cycle dmoain
-> service
-> domain
After i deleted this service
dependency in domain
module, everything works!
Upvotes: 5
Reputation: 54
the question itself may need a little bit more context, but in the meantime, looking at lombok's setup for IDEA might help you https://projectlombok.org/setup/intellij. TLDR when working with lombok on IDEA you can use this extension to have hints without rebuilding the whole project (since annotation processing kicks in when running the compiler).
Upvotes: 0