Search code examples
javamavenpom.xmljava-11

Why java.util is accessible from more than one module : <unnamed>, java.base


I am new to java and working on mutlimodule maven project. I am trying to upgrade project from java 8 to java 11. but when i run 'mvn clean install' i get below error:

[ERROR] Failed to execute goal com.nickwongdev:aspectj-maven-plugin:1.12.6:compile (default) on project module-1: AJC compiler errors:
[ERROR] error at import java.util.Collection;
[ERROR]        ^^^^^^^^

[ERROR] /home/project-name/module-1/apect/classname1.java:22:0::0 The package java.util is accessible from more than one module: <unnamed>, java.base

I am unable to figure out why and where is . i am using sdk version 11.0.16 and apache maven 3.8.6.


Solution

  • It solved. The issue was that I was using 'aspectjrt'(1.9.7) as a transitive dependency of 'aspectj-maven-plugin' and this version of 'aspectjrt' was not compatible with java-11. So I changed it to 1.9.2. And now it's working.

    Additionaly I changed there groupId of this plugin to 'org.codehaus.mojo' and used latest version(1.14.0). reference