Luca Farsetti
Luca Farsetti

Reputation: 247

Grails 2.3.7 remove itext 2.0.8 jar

I trying to update an application from grails 2.2.4 to 2.3.7 and i have issues with iText dependencies.

executing grails resources-dependencies show me that i have 2 jars for iText

+--- org.grails:grails-docs:2.3.7
|    \--- org.xhtmlrenderer:core-renderer:R8
|    \--- org.yaml:snakeyaml:1.8
|    \--- org.grails:grails-gdoc-engine:1.0.1
|    \--- **com.lowagie:itext:2.0.8**
|    \--- commons-lang:commons-lang:2.6
+--- org.grails.plugins:jasper:1.8.0
|    \--- **com.lowagie:itext:2.1.7**
|         \--- bouncycastle:bcmail-jdk14:138
|         \--- bouncycastle:bcprov-jdk14:138
|         \--- org.bouncycastle:bctsp-jdk14:1.38
|              \--- org.bouncycastle:bcprov-jdk14:1.38
|              \--- org.bouncycastle:bcmail-jdk14:1.38

I tried to remove itext 2.0.8 adding on BuildConfig

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
    excludes "itext" 
 }

however when i refresh dependencies Grails add itext 2.0.8 anyway.

Someone could give me an hint for a solution?

Best Regard

Upvotes: 5

Views: 1851

Answers (2)

sandhya murugesan
sandhya murugesan

Reputation: 114

There is no need to exclude the itext version,instead explicitly add the version in dependency as below. This would override any plugins itext with the below version. In future ,adding a new plugin with itext also won't cause any issue.

 dependencies {
         build "com.lowagie:itext:2.1.0"
    }

Note: Don't exclude any itext or grails-docs.

Upvotes: 2

doelleri
doelleri

Reputation: 19682

itext 2.0.8 is a dependency of a dependency: grails-docs. What you can do is exclude grails-docs from the inherited global dependencies and then specifically add it excluding itext.

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        excludes "grails-docs"
    }

    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        // runtime 'mysql:mysql-connector-java:5.1.24'
        build('org.grails:grails-docs:2.3.7') {
            excludes 'itext'
        }
    }
}

This will produce

+--- org.grails:grails-docs:2.3.7
|    \--- org.xhtmlrenderer:core-renderer:R8
|    \--- org.yaml:snakeyaml:1.8
|    \--- org.grails:grails-gdoc-engine:1.0.1
|    \--- commons-lang:commons-lang:2.6

Upvotes: 8

Related Questions