Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle - Exclude Nested Transitive Dependencies

The below custom boot dependency has a number of transitive dependencies. Few of these transitive dependencies have reference to org.hibernate group. I updated the below in my build.gradle file to exclude the dependency. However it doesn't seem to be removed when I run "gradle dependencies" and view the dependency tree.Should something be modified in order to exclude nested transitive dependencies?

compile("com.comp.service:service-boot:3.0.+") {
    exclude group: 'org.hibernate'
}
like image 235
Punter Vicky Avatar asked Jun 09 '26 13:06

Punter Vicky


2 Answers

Add the configurations section:

dependencies {
    ....
}

configurations {
    all*.exclude group: 'org.hibernate'
}

You can also use module to narrow down the exclusion (if group alone removes too many transitive dependencies).

sources :

  • how to properly configure gradle build to avoid including log4j and slf4j from the resulting jar?
  • https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies (#25.4.7)
  • http://mrhaki.blogspot.ca/2012/10/gradle-goodness-exclude-transitive.html
like image 66
alexbt Avatar answered Jun 12 '26 13:06

alexbt


use as below block and i hope its work-

    compile("com.comp.service:service-boot:3.0.+") {
     exclude group: 'org.hibernate'
}
like image 24
sanjeevjha Avatar answered Jun 12 '26 12:06

sanjeevjha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!