Angelo.Hannes
Angelo.Hannes

Reputation: 1729

Java 9 compiles fine in maven but not in intellij

I wanted to update my project from java 8 to java 10. Hitting the well known problems of java 9 module system. However after some fiddling, researching and back and forth I was able to compile everything in maven. I added a module-info.java to my project. See also this snippet of my pom.

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>10</source>
                <target>10</target>
                <release>10</release>
                <optimize>true</optimize>
                <debug>true</debug>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm</artifactId>
                    <version>6.2</version>
                </dependency>
            </dependencies>
        </plugin>

However Intellij is reporting 100 errors saying

unnamed module ready package X from both A and B

and similar. I'm using Intellij Community Edition 1018.1.5. I tested it in eclipse photon and there it compiles fine. I think that IntelliJ is putting the maven dependencies differently on the module path/classpath than how maven or eclipse puts them.

However, I'm at a loss and have no idea how to convince IntelliJ to compile my project.

Upvotes: 1

Views: 92

Answers (1)

Eric Green
Eric Green

Reputation: 1283

I'd prefer to put this in a comment, since I can't really give an answer until I have more info, but you can't add screenshots to comments. In any case, did you tweak the appropriate settings under File > Project Structure > Project as in:

IntelliJ Project Structure - Project Dialog

And also under File > Project Structure > Modules:

IntelliJ Project Structure - Modules Dialog

Upvotes: 1

Related Questions