FWIW, I want to mention that we did end up using exclusions and that did the
trick. What I was missing was how could I find what was dependent on what.
For that the mvn site | Dependency Report provided the answer. From there it
was a matter of <excluding> the dependencies I did not want. 
Painful but effective. 
So I was hoping that there would be a POM level <exclusions> element that
would exclude the dependencies from all the artifacts in that POM. That
would be useful.

Thanks for the clarifications on the "provided" vs "exclusion" concept.
Using Provided does seem a little hokey.

Pankaj


craigmcc wrote:
> 
> On 2/6/07, Bashar Abdul Jawad <[EMAIL PROTECTED]> wrote:
>>
>> Yes, but sometimes you will need to use a dependency for compile time
>> only,
>> and NOT for runtime. You don't need the container to provide it for you
>> either because it is not required for runtime. Example: aspectjtools.jar.
>> You can't exclude it because your project will not compile. The only way
>> is
>> to give it the provided scope.
> 
> 
> That is not correct.  Declaring a dependency to be optional puts it on the
> compile classpath, but avoids any attempt to include it at runtime.
> 
> 
> Even if your container doesn't provide it
>> that's not a problem, maven doesn't care. I know it is not very clean to
>> give a dependency a provided scope when it's not going to be provided
>> anywhere, but sometimes you need to do this if you want to compile
>> against
>> it.
> 
> 
> The semantics of "provided" are different than "optional" even though
> Maven
> does not enforce it.
> 
> The code you write against a "provided" API assumes that the API will
> indeed
> be provided by the container.  As an example, you might declare as
> "provided" a library that you've installed in Tomcat's common/lib
> directory.  The library must be there in order for the application to
> function -- but Maven can assume that it will indeed by supplied by the
> container, so won't include it in the WAR.
> 
> "Optional", on the other hand, means what it says.  Declaring such a
> dependency means that you will need it available at compile time FOR THE
> DEPENDENCY, but not necessarily for your own code (unless you explicitly
> need it for other reasons).  The library is explicitly NOT required at
> runtime, because your dependency has said, in effect, "I can use this
> library if it exists, but if it does not, no harm no foul."
> 
> Note also that "optional" is NOT a scope -- it is a completely separate
> element.  That is because the concept of being optional is orthogonal to
> scope ... it's perfectly reasonable, for example, to have an optional
> module
> with "compile" scope if your build process knows how to intelligently deal
> with that combination.
> 
> PLEASE do not misuse "provided" scope to mean the "optional" element or
> vice
> versa.  PLEASE set up your POMs to say what you mean.  These are two
> DIFFERENT concepts!
> 
> Craig
> 
> Bashar
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos
>> Sanchez
>> Sent: Tuesday, February 06, 2007 5:18 PM
>> To: Maven Users List
>> Subject: Re: dependencies are bloated in M2
>>
>> still not right, you have to use exclusions
>> provided means the environment (read appserver) "provides" that
>> dependency, which is only true for few dependencies in the whole
>> world, like servlet-api
>>
>> On 2/6/07, Bashar Abdul Jawad <[EMAIL PROTECTED]> wrote:
>> >
>> > This is the question I was answering:
>> >
>> > >Tandon, Pankaj wrote:
>> > >
>> > >1. How can we control what get's into WEB-INF/lib. We tried all the
>> > >scopes mentioned, but that did not help.
>> >
>> > And it's follow up:
>> >
>> > > >Christian Goetze wrote:
>> > > >
>> > > > I believe that the scope that should work is "provided". The
>> problem
>> is
>> > > > that I don't know if maven is smart enough to remove a provided
>> > > > dependency from the transitive closure. I would call that a bug if
>> it
>> > > > didn't.
>> >
>> > And the answer to these 2 questions is to use the provided scope. It
>> will
>> > also stop a dependency from being passed on transitively. Using
>> exclusions
>> > is NOT right if you still want to compile against these dependencies.
>> >
>> > Bashar
>> >
>> >
>> > -----Original Message-----
>> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
>> Carlos
>> > Sanchez
>> > Sent: Tuesday, February 06, 2007 5:02 PM
>> > To: Maven Users List
>> > Subject: Re: dependencies are bloated in M2
>> >
>> > exactly, that's why he needs to use exclusions, you exclude things
>> > that you don't need.
>> >
>> > On 2/6/07, Bashar Abdul Jawad <[EMAIL PROTECTED]> wrote:
>> > > It is the right solution. Using exclusions will exclude a dependency
>> from
>> > > being downloaded at all, which means it won't be available at any
>> path.
>> > > Using provided will still make the dependency available for compile
>> time,
>> > > but not in runtime, and will not bundle it in the package.
>> > >
>> > > Read maven FAQ:
>> > >
>> > > http://maven.apache.org/general.html#scope-provided
>> > >
>> > >
>> > >
>> > > -----Original Message-----
>> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
>> Carlos
>> > > Sanchez
>> > > Sent: Tuesday, February 06, 2007 4:29 PM
>> > > To: Maven Users List
>> > > Subject: Re: dependencies are bloated in M2
>> > >
>> > > that's not the right solution, you have to use exclusions
>> > >
>> > > On 2/6/07, Bashar Abdul Jawad <[EMAIL PROTECTED]> wrote:
>> > > > It will. If you don't want to include a particular dependency in
>> your
>> > > > generated package just give it the provided scope, it will be
>> excluded
>> > > even
>> > > > if it was a transitive dependency of something else.
>> > > >
>> > > > Bashar
>> > > >
>> > > > -----Original Message-----
>> > > > From: Christian Goetze [mailto:[EMAIL PROTECTED]
>> > > > Sent: Tuesday, February 06, 2007 2:58 PM
>> > > > To: Maven Users List
>> > > > Subject: Re: dependencies are bloated in M2
>> > > >
>> > > > Tandon, Pankaj wrote:
>> > > >
>> > > > >
>> > > > >
>> > > > >So the questions are:
>> > > > >1. How can we control what get's into WEB-INF/lib. We tried all
>> the
>> > > > >scopes mentioned, but that did not help.
>> > > > >
>> > > > I believe that the scope that should work is "provided". The
>> problem
>> is
>> > > > that I don't know if maven is smart enough to remove a provided
>> > > > dependency from the transitive closure. I would call that a bug if
>> it
>> > > > didn't.
>> > > >
>> > > > --
>> > > > cg
>> > > >
>> > > >
>> ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > > >
>> > > >
>> > > >
>> ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > > >
>> > > >
>> > >
>> > >
>> > > --
>> > > I could give you my word as a Spaniard.
>> > > No good. I've known too many Spaniards.
>> > >                              -- The Princess Bride
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > >
>> > >
>> >
>> >
>> > --
>> > I could give you my word as a Spaniard.
>> > No good. I've known too many Spaniards.
>> >                              -- The Princess Bride
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>>
>> --
>> I could give you my word as a Spaniard.
>> No good. I've known too many Spaniards.
>>                              -- The Princess Bride
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/dependencies-are-bloated-in-M2-tf3182336s177.html#a8846301
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to