question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

commons-logging:commons-logging should not be a transitive dependency

See original GitHub issue

Spring projects should use Spring Framework’s spring-jcl module (a dependency of spring-core) in place of commons-logging:commons-logging, however spring-data-elasticsearch pulls in commons-logging:commons-logging transitively. Can it please be excluded so that users don’t end up with two different set of Commons Logging classes on their classpath?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sothawocommented, Nov 13, 2021

fixed in main, 4.3.x, 4.x.2 and 4.1.x

0reactions
wilkinsonacommented, Nov 13, 2021

Excellent. Just in case it’s still useful, here’s a minimal Gradle script that shows the problem:

plugins {
	id "java"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"
sourceCompatibility = "11"

repositories {
	mavenCentral()
}

dependencies {
	implementation(platform("org.springframework.data:spring-data-bom:2020.0.14"))
	implementation("org.springframework.data:spring-data-elasticsearch")
}
$ ./gradlew dependencyInsight --dependency commons-logging                                 

> Task :dependencyInsight
commons-logging:commons-logging:1.1.3
   variant "compile" [
      org.gradle.status              = release (not requested)
      org.gradle.usage               = java-api
      org.gradle.libraryelements     = jar (compatible with: classes)
      org.gradle.category            = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling = external
         org.gradle.jvm.environment     = standard-jvm
         org.gradle.jvm.version         = 11
   ]

commons-logging:commons-logging:1.1.3
\--- org.elasticsearch.client:elasticsearch-rest-client:7.9.3
     +--- org.elasticsearch.client:elasticsearch-rest-high-level-client:7.9.3
     |    \--- org.springframework.data:spring-data-elasticsearch:4.1.14
     |         +--- compileClasspath (requested org.springframework.data:spring-data-elasticsearch)
     |         \--- org.springframework.data:spring-data-bom:2020.0.14
     |              \--- compileClasspath
     \--- org.elasticsearch.plugin:reindex-client:7.9.3
          \--- org.elasticsearch.client:transport:7.9.3
               \--- org.springframework.data:spring-data-elasticsearch:4.1.14 (*)

(*) - dependencies omitted (listed previously)

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 518ms
1 actionable task: 1 executed
Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing SLF4J in an application with many transitive ...
Spring using JCL (Jakarta common logging) for its logging, so it is bringing in commons-logging as a transitive dependency. This is a potential ......
Read more >
Log4j Commons Logging Adaptor – Project Dependencies
Transitive dependencies are the dependencies of the project dependencies. test. The following is a list of test dependencies for this project.
Read more >
Logging - Strongbox
Dependencies which have transitive dependencies on different versions of the libraries below, will most-likely cause dependency conflicts: log4j; commons- ...
Read more >
excluding transitive dependencies - Google Groups
I know it's not being brought in by another dependency because I can change the commons-validator dependency to intransitive and the commons-logging jar ......
Read more >
How to fix java.lang.ClassNotFoundException: org.apache ...
commons.logging.LogFactory error in Java. It can come even if you are not using commons-logging directly but using a library like Spring, Hibernate, or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found