.war lib

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

.war lib

JerodLass
Where can I configure exactly what goes in the WEB-INF/lib directory when creating a .war file?  I see where I can add to it, but I want to strip away almost all of it.  It would work for me to be able to disable the lib copy function and then manually specify which jars to add.

-Jerod
Reply | Threaded
Open this post in threaded view
|

Re: .war lib

hans_d
Administrator
Hi Jerod,

On Jul 15, 2008, at 3:32 PM, JerodLass wrote:

>
> Where can I configure exactly what goes in the WEB-INF/lib  
> directory when
> creating a .war file?  I see where I can add to it, but I want to  
> strip away
> almost all of it.  It would work for me to be able to disable the  
> lib copy
> function and then manually specify which jars to add.

We want to improve the filtering of war dependencies in 0.3, which  
means soon. Dominick More has already raised this issue. Right now  
you have to do something ugly to make it work the way you want.

The war task has a String property dependencyConfiguration.  
Unfortunately setting it to null leads to an exception. So what you  
can do is to add a configuration in the dependencies section which is  
empty:

dependencies {
    addConfiguration('dummy')
}

Than you can say: war.libConfiguration = 'dummy'

With war.additionalLibFileSets you can add whatever you want. In 0.3.  
we will introduce helper methods for adding to the  
additionalLibFileSets and webInfFileSets.

In 0.3. we will also introduce a configuration for adding  
dependencies that should not be part of the war but part of the  
compile and tests.

- Hans


>
> -Jerod
> --
> View this message in context: http://www.nabble.com/.war-lib- 
> tp18465407p18465407.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: .war lib

hans_d
Administrator
Hi Jerod,

On Jul 15, 2008, at 4:35 PM, Hans Dockter wrote:

> Hi Jerod,
>
> On Jul 15, 2008, at 3:32 PM, JerodLass wrote:
>
>>
>> Where can I configure exactly what goes in the WEB-INF/lib  
>> directory when
>> creating a .war file?  I see where I can add to it, but I want to  
>> strip away
>> almost all of it.  It would work for me to be able to disable the  
>> lib copy
>> function and then manually specify which jars to add.
>
> We want to improve the filtering of war dependencies in 0.3, which  
> means soon. Dominick More has already raised this issue. Right now  
> you have to do something ugly to make it work the way you want.
>
> The war task has a String property dependencyConfiguration.  
> Unfortunately setting it to null leads to an exception. So what you  
> can do is to add a configuration in the dependencies section which  
> is empty:
>
> dependencies {
>    addConfiguration('dummy')
> }
>
> Than you can say: war.libConfiguration = 'dummy'
>
> With war.additionalLibFileSets you can add whatever you want. In  
> 0.3. we will introduce helper methods for adding to the  
> additionalLibFileSets and webInfFileSets.
>
> In 0.3. we will also introduce a configuration for adding  
> dependencies that should not be part of the war but part of the  
> compile and tests.

In trunk the situation has improved. For your use case you don't have  
to declare a dummy configuration any longer. You simply say:

war.libConfigurations = [] // watch the plural

You could now also do the following to fill your war with libs:

dependencies {
   addConfiguration('provided')
   dependencies(['compile', 'provided'], d1, d2, ...)
   dependencies(['runtime', 'provided'], r1, r2, ...)
   compile 'com.comp:not_for_the_war:1.0'
}

war.libConfigurations = ['provided']    

For the 0.3 release we will further add a more out of the box  
solution for this use case. But the approach above might be  
interesting to know anyway.

- Hans

>
>
>>
>> -Jerod
>> --
>> View this message in context: http://www.nabble.com/.war-lib- 
>> tp18465407p18465407.html
>> Sent from the gradle-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

    http://xircles.codehaus.org/manage_email