简体   繁体   中英

JAR added to Gradle project but no entry in build.gradle

I am new to the Java tools and stuff, so please be gentle.

I see that someone has added the Simple Logging Façade 4 Java (SLF4J) logging capability to a project I am looking at in IntelliJ IDEA. The project is a Gradle project and when I see the Project Structure -> Module -> Dependencies , I do see a dependency for the SLF4 jars.

在此处输入图片说明

I also see these listed in the External Libraries node in the treeview in the Project window.

在此处输入图片说明

However, when I open the build.gradle file, I see no entry for slfj. How is that? How would this library have been added to the project?

slf4j is a transitive dependency of some other library.

Use ./gradlew dependencies on the root folder of your project to see the dependencies graph.

slf4j ist most likely a transitive dependency of one of the declared dependencies.

To list the dependency tree, you can use gradlew dependencies .

To list the dependency tree for a specific configuration, you can use gradlew dependencies --configuration runtime .

In your situation you can also use the other way around and use dependencyInsight task instead like gradlew dependencyInsight --configuration runtime --dependency org.slf4j:slf4j-api to see which declared dependencies depen on the given dependency in the given configuration.

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