log4j2-slf4j-impl duplicate dependencies

I have a Maven project where I would like to use log4j2 with slf4j. So I add this dependency:

<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-slf4j-impl</artifactId>
  <version>2.11.2</version>
</dependency>

It seems to work as far as I can tell. But my question is in regard to log4j-slf4j-impl's transitive dependencies.

Why does IntelliJ show that log4j-core brings in log4j-api, but then omits it due to being a duplicate (which I believe the below screenshot is saying)? And how can I prevent that?

#java #maven

3 Likes2.30 GEEK