Starting with version 6.6.0, Hibernate includes an annotation processor that creates files within a directory entity.index
in the source output directory
(https://hibernate.atlassian.net/browse/HHH-18162).
When used in combination with IntelliJ, this causes the following error:
java.lang.LayerInstantiationException: Package entity.index in both module com.github.martinleim.modulea and module com.github.martinleim.moduleb
Tested on IntelliJ IDEA 2024.3.3 Ultimate Edition, Build #IU-243.24978.46
- Import into IntelliJ as Maven project
- Run "Build project". Notice how the
target/classes
directory does not contain theentity
directory - Open
com.github.martinleim.moduleb.Main
and execute the main method. - Now, IntelliJ again builds the project. This time, the
entity
directory fromtarget/generated-sources/annotations
is included intarget/classes
- After the build, the main method is run and produces the error above.