Exclude dependency from Gradle

I have recently updated my cuba version.

I had a problem of duplicate dependencies which I resolved before by:

configure(globalModule) {
    dependencies {
        compile('net.sf.jasperreports:jasperreports:6.10.0')       
        compile('com.connectifier.xero:client:0.13')        
    }

    configurations {
        compile {
            exclude group: 'org.bouncycastle'
           exclude module: 'bcprov-jdk14'
        }
    }
}

The org.bouncycastle is imported in a dependency of jasperreports ( com.lowagie » itext) and also com.connectifier.xero:client

Now it is giving the problem I had before.

java.lang.SecurityException: class “org.bouncycastle.asn1.pkcs.RSAPublicKey”'s signer information does not match signer information of other classes in the same package

Not really sure what to do here… Am I excluding the imports wrong?

Hello @daryn

First of all I would recommend you to exclude dependencies “in-place”, for example:

configure(globalModule) {
    dependencies {
        compile('net.sf.jasperreports:jasperreports:6.10.0')
        compile('com.connectifier.xero:client:0.13') {
            exclude group: 'org.bouncycastle'
        }
    }
}

It’s more clear way to manage dependencies.

Then you can check that there is only one library jar via Gradle dependencies task, for example:

gradlew :app-core:dependencies

Ok thanks for that.

I mucked around for a while and it seemed to resolve when I updated the platform version for some reason.

I also had the following as my gradle setup:

configure(globalModule) {
    dependencies {
        compile('net.sf.jasperreports:jasperreports:6.4.1')     
        compile('com.connectifier.xero:client:0.13'){
        exclude group: 'org.bouncycastle'
        }
        compile('net.sf.jasperreports:jasperreports-fonts:6.0.0')
   
        compile('org.bouncycastle:bcpkix-jdk15on:1.51')
    }



    configurations {
        compile {
            exclude module: 'bcprov-jdk14'
            exclude module: 'bcprov-jdk14:138'
        }
    }

Not really sure what solved it. But working now.