You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rogerio Baldini <ro...@gmail.com> on 2006/09/21 18:27:50 UTC

exclude dependencies

Hi,

Is it possible to exclude dependencies from my packaged war file ?
I mean, I 'd like to remove some jar files from my lib directory because I
am not using them in runtime.


Thanks,
Rogerio Baldini.

Re: exclude dependencies

Posted by Dirk Olmes <di...@xanthippe.ping.de>.
Iulian Costan wrote:
> if it is adirect dependencies you can play with <scope> tag, you might use
> test or provided scopes. the default scope is compile so that dep will be
> included in war.
> 
> on the other side if it is a transitive dependency then play with
> <exclusions> tag,
> in the sample below artifact A is excluded from war.
> <dependecy>
>     <grouppId>
>     <artifactId>...
>     <version>...
>     <exlusions>
>        <exclusion>
>             <groupId>G<groupId>
>             <artifactId>A</artifactId>
>             <version>1.0</version>
>        <exclusion>
>     </exclusions>
> </dependency>

This is becoming my favourite maven subject in the last few months :-(
Managing what goes inside the war via <scope>provided</scope> works but
in practice turns out to be a quite tedious task.

We develop an enterprise system which consists of a large number of
EJBs. When developing web frontends to this system there are two main
use cases:

- development time: run the webapp against a remote app server
- deployment time: run the webapp in the same app server as the EJBs

In order to build different wars for development and deploy, we use
profiles. In the deployment profiles, we have to re-list most of the
webapp's dependencies with scope provided. This does not only turn the
pom into one giant xml file but becomes quite unmanageable since listing
dependencies has to be done in two places.

See http://jira.codehaus.org/browse/MWAR-21 for my patch to the war
plugin and the discussion why it was rejected. I still think that
dependency excludes/includes are a good idea as this would ease the
building of deployment packages a lot and make my POMs smaller.

I have the feeling that I might not be the only one with this problem ...

-dirk

-- 
A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: exclude dependencies

Posted by Iulian Costan <iu...@gmail.com>.
if it is adirect dependencies you can play with <scope> tag, you might use
test or provided scopes. the default scope is compile so that dep will be
included in war.

on the other side if it is a transitive dependency then play with
<exclusions> tag,
in the sample below artifact A is excluded from war.
<dependecy>
     <grouppId>
     <artifactId>...
     <version>...
     <exlusions>
        <exclusion>
             <groupId>G<groupId>
             <artifactId>A</artifactId>
             <version>1.0</version>
        <exclusion>
     </exclusions>
</dependency>


/iulian




On 9/21/06, Lee Meador <le...@leemeador.com> wrote:
>
> This page
>
> http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html
>
> has information on this as relates directly to the war contents.
>
> You might also want to look into the <scope> tag on your dependencies. I'm
> not sure why you would need a jar to compile but not to run the code
> itself.
> I can see how you would need a jar to compile and run tests but not need
> it
> for your application code. Putting <scope>test</scope> on the dependency
> would  indicate that.
>
> -- Lee
>
> On 9/21/06, Rogerio Baldini <ro...@gmail.com> wrote:
> >
> > Hi,
> >
> > Is it possible to exclude dependencies from my packaged war file ?
> > I mean, I 'd like to remove some jar files from my lib directory because
> I
> > am not using them in runtime.
> >
> >
> > Thanks,
> > Rogerio Baldini.
> >
> >
>
>
> --
> -- Lee Meador
> Sent from gmail. My real email address is lee AT leemeador.com
>
>

Re: exclude dependencies

Posted by Lee Meador <le...@leemeador.com>.
This page

http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html

has information on this as relates directly to the war contents.

You might also want to look into the <scope> tag on your dependencies. I'm
not sure why you would need a jar to compile but not to run the code itself.
I can see how you would need a jar to compile and run tests but not need it
for your application code. Putting <scope>test</scope> on the dependency
would  indicate that.

-- Lee

On 9/21/06, Rogerio Baldini <ro...@gmail.com> wrote:
>
> Hi,
>
> Is it possible to exclude dependencies from my packaged war file ?
> I mean, I 'd like to remove some jar files from my lib directory because I
> am not using them in runtime.
>
>
> Thanks,
> Rogerio Baldini.
>
>


-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com