Trying to exclude jar from being packaged in WAR?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to exclude jar from being packaged in WAR?

marcopas
Hi there,

in my project i want to exclude a jar file so that it is not packaged
into the final war file. I tried several things but it looks like i am
doing something wrong.

I am using the following in my BuildConfig:

grails.project.dependency.resolution = {
...
     plugins {
         compile 'org.grails.plugins:rendering:0.4.3' {
             excludes "core-renderer-R8"
         }
         compile 'org.grails.plugins:jasper:1.5.3' {
             excludes "core-renderer-R8"
         }
     }
}

Any suggestion what i am missing? The core-renderer-R8 keeps showing up
in my final WAR file..

/Marco

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

robelsner
On Mon, Apr 2, 2012 at 10:52 AM, Marco Pas <[hidden email]> wrote:
> Any suggestion what i am missing? The core-renderer-R8 keeps showing up in
> my final WAR file..

Hi Marco,

I've had this problem with other jar's.  The way you are excluding the
jars only works for some scenarios but in your BuildConfig.groovy you
can add code like this:

grails.war.resources = { stagingDir ->
    delete(file: "${stagingDir}/WEB-INF/lib/ehcache-1.2.3.jar")
    delete(file: "${stagingDir}/WEB-INF/lib/ehcache-core-1.7.1.jar")
}

and it will remove the files when it builds the WAR.  It isn't ideal
but the best I've come up with for when transient dependencies are not
suppressed.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

Ian Roberts
In reply to this post by marcopas
On 02/04/2012 17:52, Marco Pas wrote:
> Hi there,
>
> in my project i want to exclude a jar file so that it is not packaged
> into the final war file. I tried several things but it looks like i am
> doing something wrong.

What version of Grails?  I've had the same problem with 1.3.x.

http://grails.1312388.n4.nabble.com/excludes-commons-lang-tp4525206p4525886.html

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

basejump (Josh)
In reply to this post by marcopas

I just happen to be in the rendering project right now and I can see the dependency is
compile("org.xhtmlrenderer:core-renderer:R8") not core-renderer-R8
try removing the R8 or specify it as core-renderer:R8

On Apr 2, 2012, at 11:52 AM, Marco Pas wrote:

> Hi there,
>
> in my project i want to exclude a jar file so that it is not packaged into the final war file. I tried several things but it looks like i am doing something wrong.
>
> I am using the following in my BuildConfig:
>
> grails.project.dependency.resolution = {
> ...
>    plugins {
>        compile 'org.grails.plugins:rendering:0.4.3' {
>            excludes "core-renderer-R8"
>        }
>        compile 'org.grails.plugins:jasper:1.5.3' {
>            excludes "core-renderer-R8"
>        }
>    }
> }
>
> Any suggestion what i am missing? The core-renderer-R8 keeps showing up in my final WAR file..
>
> /Marco
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

gpinkham
i know this is an old thread but..  I tried the above method
    compile 'org.grails.plugins:rendering:0.4.4' {
      excludes "core-renderer"
    }
and it causes this error on startup:
| Error WARNING: Configurational method [org.grails.plugins:rendering:0.4.4] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..
| Error WARNING: Configurational method [compile] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..

is there a different way to do this exclusion?  
Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

gpinkham
gpinkham wrote
i know this is an old thread but..  I tried the above method
    compile 'org.grails.plugins:rendering:0.4.4' {
      excludes "core-renderer"
    }
and it causes this error on startup:
| Error WARNING: Configurational method [org.grails.plugins:rendering:0.4.4] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..
| Error WARNING: Configurational method [compile] in grails-app/conf/BuildConfig.groovy doesn't exist. Ignoring..

is there a different way to do this exclusion?
ok it turns out you need to have Parans on the compile line.. like this:
compile('org.grails.plugins:rendering:0.4.4') {
      excludes "core-renderer"
    }

learn something new every day!
Reply | Threaded
Open this post in threaded view
|

Re: Trying to exclude jar from being packaged in WAR?

Ian Roberts
On 08/08/2013 16:27, gpinkham wrote:
> ok it turns out you need to have Parans on the compile line.. like this:
> compile('org.grails.plugins:rendering:0.4.4') {
>       excludes "core-renderer"
>     }

Or a comma

    compile 'org.grails.plugins:rendering:0.4.4', {
      excludes "core-renderer"
    }

The root of your problem is that Groovy is treating

    compile 'org.grails.plugins:rendering:0.4.4' {
      excludes "core-renderer"
    }

as if it were

    compile(
      'org.grails.plugins:rendering:0.4.4' {
        excludes "core-renderer"
      }
    )

i.e. calling a (non-existent) method called
'org.grails.plugins:rendering:0.4.4' with a closure parameter, and then
passing whatever that method returned to another method called "compile".

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email