How to exclude grails global dependency
Asked Answered
N

1

9

Grails has bouncycastle:bcprov-jdk14:138 as global dependency

+--- org.grails:grails-docs:2.3.3
|    \--- org.xhtmlrenderer:core-renderer:R8
|    \--- org.yaml:snakeyaml:1.8
|    \--- org.grails:grails-gdoc-engine:1.0.1
|    \--- com.lowagie:itext:2.0.8
|         \--- bouncycastle:bcmail-jdk14:138
|         \--- bouncycastle:bcprov-jdk14:138
|    \--- commons-lang:commons-lang:2.6

But my app need bcprov-jdk15on-149. When I added it as dependency it doesn't evict old version

dependencies {
    build 'org.bouncycastle:bcpg-jdk15on:1.49'
    build 'org.bouncycastle:bcprov-jdk15on:1.49'
}

I tried a lot of variants to exclude it but no one works

inherits("global") {
    //excludes 'grails-docs'

    excludes 'org.bouncycastle:bcmail-jdk14:138'
    excludes 'bouncycastle:bcmail-jdk14:138'
    excludes 'bcmail-jdk14-138.jar'
    excludes 'bcmail-jdk14'
    excludes 'bcmail'

    excludes 'bouncycastle:bcprov-jdk14:jar:138'
    excludes 'org.bouncycastle:bcprov-jdk14:138'
    excludes 'bouncycastle:bcprov-jdk14:138'
    excludes 'bcprov-jdk14-138.jar'
    excludes 'bcprov-jdk14'
    excludes 'bcprov'
    excludes 'bouncycastle'
}

The only way to made it work – exclude whole 'grail-docs' dependency.

How exclude only old bcprov-jdk14:138?

Or how to do that the new(bcprov-jdk15on-149) evict old(bcprov-jdk14:138)?

Narwhal answered 27/11, 2013 at 9:35 Comment(4)
Try compile 'org.bouncycastle:bcpg-jdk15on:1.49'. The newer version should be used.Canaletto
Thanks for answer, but I've already tried it and It haven't worked. It seems that problem in 'maven' dependency resolver(that grails used since 2.3) because with 'ivy' resolver everything works fine.Narwhal
If you change in BuildConfig.groovy to use Ivy it works? Then I think you should raise a Jira.Canaletto
Anyone has an answer for this issue ? I am also stuck...Austenite
A
10

It seems to be a reported bug >> http://jira.grails.org/browse/GRAILS-10640

I found a workaround by overriding the com.logwagie.itext dependency.

dependencies {
    // add this line
    build("com.lowagie:itext:2.1.7") { excludes "bouncycastle:bcprov-jdk14:138", "org.bouncycastle:bcprov-jdk14:1.38" }
}

Hope this will help you.

Austenite answered 23/1, 2014 at 18:1 Comment(3)
How this exclusion can be effective in a plugin that will be used by others ?Brilliance
the above worked for me on Grails 2.5.6, but I used build("com.lowagie:itext:2.0.8") { excludes "bcprov-jdk14" }Elisavetgrad
How do you find all the packages that are including an old library?Gross

© 2022 - 2024 — McMap. All rights reserved.