This is explained very clearly in the documentation:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

(look at section "Depencdency scope")

Here is an example:

I use Wicket, which is dependent on log4j through teh following declaration in wicket-parent pom:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.13</version>
  <type>jar</type>
  <optional>true</optional>
</dependency>

My project do not use log4j. Furthermore, I do not want the log4j jar to be included in the distribution because it would clash with JBoss own version. So I had the following dependecy in my app:

<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.13</version>
  <scope>provided</scope>
</dependency>

This might be a bit confusing, because it says my project depends on log4j although it does not. In fact, it does depend on the fact that log4j must not be included, which a very special case of dependency :-(

Well, anyway, it works ! (provided you do not forget to clean your project before installing it again with this change).

Pierre-Yves


SkipWalker a écrit :
We're having a problem with our war.  Some of the dependencies have
transitive dependencies on different versions of the same jar.

For instance, some dependency has a transitive dependency of
velocity-1.4.jar.  Another has velocity-dep-1.4.jar.  Other examples include
cglib, spring, etc.

The result is that all of these jars get included in the the war.  This can
be innocuous or problematic depending on the library.

I know that I can use the <exclusions> tag in a dependency to exclude a
particular  transitive dependency.  The problem there is that I have to
track down every darn dependencies transitive dependency.
I'd rather just explicitly state every dependency, whether they be
transitive or not, in my pom and just turn off maven's transititve
dependency resolution for my build.

Is this possible?  If so, how do I do it?

Thanks,
Skip


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

Reply via email to