I have simple application written in Java 11. mvn clean verify
(maven 3.6.0) executes with error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project parser: Compilation failure
[ERROR] ...src/main/java/module-info.java:[2,32] module not found: org.apache.logging.log4j
Dependencies:
<log4j.version>2.11.1</log4j.version>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
Module-info.java:
module abc {
requires org.apache.logging.log4j;
}
Log4j2 configuration is default and in .xml file. Usage:
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
private static final Logger logger = LogManager.getLogger(Abc.class);
logger.info("Boom!");
I tried all related questions on stackoverflow with no success.
maven-compiler-plugin
and specify the release as11
? Since describing thelog4j-api
jar using--release 11
states the same name as in your directive. The reason primarily being thatlog4j-api
is a modular jar. Do note, on the other handlog4j-core
is derived as an automatic module. – Callboylog4j-api
, that being a modular jar. Also, maybe some contributor from the library themselves pitch in with further details over modularisation and plans ahead in consuming the library. – Callboy