I am having a maven (3.6.0) project based on java 11 with the following structure (which works fine on the commandline!):
src/main/java/
module-info.java
/de
The error says that there is more than one module (probably a JAR) that contains the package org.apache.logging.log4j
(or to be more precise, from which the package is accessible). This is not allowed in the Java Platform Module System (JPMS). But in this case, there is only one JAR that contains the package, so this error is shown by mistake in Eclipse 2019-03 (4.11). See:
Eclipse bug 546315 - "The package […] is accessible from more than one module: , […]" error shown in Java editor by mistake
As workaround for this bug do one of the following:
module-info.java
add the line requires org.apache.logging.log4j.core;
which pulls all related JARs on the modulepathBy default, all Maven dependencies are on the classpath. In module-info.java
the line requires org.apache.logging.log4j;
pulls the JAR with the org.apache.logging.log4j
module on the modulepath. The error erroneously states that there is another JAR on the classpath (and therefore in the unnamed module) that also contains the package org.apache.logging.log4j
. Please note, modules-info.test
(with the file extension .test
) is neither a Java nor a Maven thing and therefore for Eclipse only a text file.
Multi-module support: in your case you have only one module-info.java
which means you only have one Java module. In Eclipse for each Java module a Java project is required (due each module has its own dependencies).