On 11/25/06, jiangshachina <[EMAIL PROTECTED]> wrote:

For example, on servlet-api artiface.
I declare servlet-api-2.4.jar in others POM, but commons-loggin(in Apache
POM) has transitive dependency servlet-api-2.3.jar. Both of them are compile
scope.

These poms are incorrect -- servlet-api shouldn't be in compile scope.

When I run "mvn package" for the Web project, I found that
servlet-api-2.3.jar, but servlet-api-2.4.jar, in WEB-INF/lib.
If I modified POM of commons-loggin, and declared servlet-api-2.3.jar as
provided dependency, then none of them would be put into WEB-INF/lib!

Modifying public poms is one way to do it, and can work if you have
complete control of an internal corporate repository.

A better way to fix this is to add <exclusions> to the dependencies
that are causing the problem, then go back to the project in question
and ask them to fix it in the next release.  Quite often the project
causing the problem is not using m2 to build, and the developers don't
understand what happens when they leave everything in compile scope.

Another way that will work is to declare the servlet-api dependency in
your own project and properly mark it 'provided'.  Since Maven uses
the "closest" definition for each artifact, that one will win.

--
Wendy

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

Reply via email to