I have a JDK 9 project. When running mvn install
, everything works fine. When using IntelliJ 2017.2.6 with JDK 9.0.4 I come up
with dozens of compilation errors due to split packages. For example, in my POM I set a dependency on org.apache.solr:solr-core:7.2.1
. One of the errors displayed by IntelliJ is:
Error:java: module solr.core reads package org.apache.lucene.search from both lucene.misc and lucene.sandbox
The rationale for the compilation error issued by IntelliJ is:
solr-core
has Maven dependencies on artifactslucene-misc
andlucene-sandbox
- Both
lucene-misc.jar
andlucene-sandbox.jar
define classes in packageorg.apache.lucene.search
- IntelliJ considers that
lucene-misc.jar
andlucene-sandbox.jar
are JDK 9 modules (if fact, they are not modules, they have nomodule-info.java
file). As two JDK 9 modules cannot participate to the same package, IntelliJ issues a compilation error.
By contrast, the Maven compiler pluging issues no error, because it considers lucene-misc.jar
and lucene-sandbox.jar
as belonging to
the class path, not to the module path.
I obviously don't want to re-package the Lucene stuff.
So my problem boils down to the following: how can I mute IntelliJ errors Error:java: module Mod1 reads package P from both Mod2 and Mod3
?