dependency mechanism ( overriding transitive version )

Tag: maven Author: jiang493819713 Date: 2011-03-06

I am trying to explicitly override a transitive dependencies version, but doesn't seem to work.

I have this in my projects pom

<!-- use no-commons-logging -->
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>99.0-does-not-exist</version>
</dependency>
<!-- no-commons-logging-api, if you need it -->
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging-api</artifactId>
    <version>99.0-does-not-exist</version>
</dependency>

But, the first one doesn't seem to override the transitive dependencies version. I am not sure why ?

Here is the full POM http://pastebin.com/TBP0YTZs

Here is the dependency tree http://pastebin.com/VBdjiVcL

PS: a) This is what I am trying to do http://day-to-day-stuff.blogspot.com/2007/10/announcement-version-99-does-not-exist.html

Other Answer1

Actually, there is much cleaner method to get rid of commons-logging once and for all:

<dependency>
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <version>1.1.1</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
  <version>1.6.1</version>
</dependency>

Based on: http://www.slf4j.org/faq.html#excludingJCL

comments:

thanks. I did read that. But, I am just curious about mavens dependency resolution behavior.