You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Denise Li <dk...@ouray.cudenver.edu> on 2006/02/11 06:26:25 UTC

[m2] Transitive Dependencies

I am using maven 2 on a project and I recently discover that maven2 downloads many jars for my project even though my project has few dependencies.  All of my dependencies are in the provided scope as I expect the application server my application runs in will provide them.  It turns out the extra jars maven downloaded are never used.

Upon futher investigation, I come across a documentation on apache's maven site explaining transitive dependencies.  About half way down in the document there's table illustrating what dependencies will be loaded by maven.  This table is copied below.

     compile provided runtime test 
      compile compile(*) - runtime - 
      provided provided provided provided - 
      runtime runtime - runtime _ 
      test test - test - 


According to the table, a provided dependency's dependencies will be loaded in as provided except the test dependencies (third row of the table).  Why is this?

By definition, a dependency in the provided scope is only needed at compile time, and it is not available at runtime or during tests.  So I will never need any of the dependency's dependencies for compilation.  Why does maven2 download the dependency's compile, provided and runtime scope dependencies?  I can understand if I need a dependency at runtime, then I will probably need the dependency's runtime dependencies also.  But why would maven2 follow the dependency graph for a dependency not needed at runtime?  Shouldn't the "provided" row above be like this?

      provided - - - - 



As it stands now, my repository grew very large quickly because maven download everything in the dependency graph.  This seems to be a bug to me.

Mitch