Maven Dependencies Jar Missing for Slf4j wrapper

277 Views Asked by At

I have a project in Maven for ExtentReports. When I run it, the test fail and says.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

When I check the project properties -> java build path -> libraries. ->Maven Dependencies

rxjava-3.0.4.jar (missing) freemarker-2.3.30.jar (missing) lombok-1.18.12.jar (missing)

when I go to POM.xml

4.0.0

it says: could not transfer artifact io.reactivex.rxjava3:rxjava:jar3.0.4

I tried downloading the said jars in mvn repository but it doesnt make any changes.

1

There are 1 best solutions below

0
On

SLF4j wrapper is generally provided by Lombok.

I recommend you put these dependencies in your pom.xml:

You need the SLF4j wrapper AS WELL AS a dependency for which implementation you want to use. (Logback in this case).

<!--region Lombok Configuration -->
<!-- logger guide https://gist.github.com/stykalin/8c77ad2a705eabddc2424eff0e99d1ec -->
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.22</version>
</dependency>
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.11</version>
</dependency>
<!-- endregion -->

Also, you will need to setup a src/main/resources/logback.xml file. Also, put @Slf4j Lombok annotation at the top of your class files where you need to do a log.info("Message").

IF you still have problems, the command mvn dependency:tree can perhaps help you find dependency conflicts.