Skip to content

Unable to exclude a specific dependency from spring boot dependencies in gradle #29189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
voduku opened this issue Dec 29, 2021 · 3 comments
Closed
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@voduku
Copy link

voduku commented Dec 29, 2021

I would like to know how to exclude a specific dependency from spring boot dependencies in gradle. I am asking this because due to internal restriction and licensing, I can't pull com.oracle.database.jdbc:ojdbc-bom. Despite trying all exclusion recommendation out there, including instruction from spring boot gradle plugin page, none of them seems to be able to alter detachedConfiguration. I get this error no matter what.

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':detachedConfiguration24'.
   > Could not find com.oracle.database.jdbc:ojdbc-bom:21.3.0.0.

My build.gradle:

plugins {
    id 'org.springframework.boot' version '2.6.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = ''
version = '1.0.0'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

configurations.all {
    exclude group: 'com.oracle.database.jdbc', module: 'ojdbc-bom'
}

repositories {
    ... // some internal repo that mimic mavenCentral() but with licensing restriction
}

bootJar {
    enabled = false
}

jar {
    enabled = true
}


dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
    implementation 'io.r2dbc:r2dbc-postgresql'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
}

test {
    useJUnitPlatform()
}
@snicoll
Copy link
Member

snicoll commented Dec 29, 2021

@voduku that feels like a question for the dependency management plugin, not Spring Boot. If you haven't found what you're looking for in the reference documentation, I'd suggest asking on StackOverflow first.

@snicoll snicoll closed this as completed Dec 29, 2021
@snicoll snicoll added the for: stackoverflow A question that's better suited to stackoverflow.com label Dec 29, 2021
@voduku
Copy link
Author

voduku commented Dec 29, 2021

@snicoll isn't dependency management plugin provided by spring boot team?

@snicoll
Copy link
Member

snicoll commented Dec 29, 2021

It has a separate issue repository but even if we did, we don't use the issue tracker for questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

2 participants