简体   繁体   中英

Package dependencies in a jar

I'm trying with a .jar library but the init method has a call to slf4j. I have added slf4j to my dependencies Project but I believe that I need to repackage the library with the dependency inside the jar.
The method I'm calling in the jar has this line:

private static final org.slf4j.Logger LOG =
       org.slf4j.LoggerFactory.getLogger(Init.class);

But I have this error:

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.

You also need an slf4j implementation, just as your error said. There are multiple. Here are a two:

slf4j-simple : it prints out to your console/terminal

log4j-slf4j-impl : The Apache Log4j SLF4J API binding to Log4j 2 Core

If you need just the .jar, choose your needed version and you can download it under files.

If you need more help, the official manual explains it quite good.

Hope I could help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM