briarheart
briarheart

Reputation: 2006

Exclude parent project dependencies from child project classpath

I have parent project that defines dependency on some local libraries for all its child projects:

subprojects {
    dependencies {
        compile fileTree(dir: '../somelib', include: '*.jar')
    }
}

Can I exclude some jars (or even whole library folder) from parent's dependencies in child project without touching parent build.gradle?

Upvotes: 4

Views: 2690

Answers (1)

Perimosh
Perimosh

Reputation: 2794

Maybe this helps you. Add this in your child's project build.gradle

configurations {
    all.collect { configuration ->
        configuration.exclude   group: 'org.springframework.ws', module: 'spring-ws-core'
    }
}

I had to deal with some spring dependencies, and well, I fixed it that way. I don't like it though, but all comes down to the way I have set up my projects.

Upvotes: 1

Related Questions