Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.3.7 remove itext 2.0.8 jar

Tags:

grails

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

like image 540
Luca Farsetti Avatar asked May 14 '14 16:05

Luca Farsetti


2 Answers

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
like image 164
doelleri Avatar answered Oct 18 '22 17:10

doelleri


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.

like image 31
sandhya murugesan Avatar answered Oct 18 '22 16:10

sandhya murugesan