You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laird Nelson <lj...@gmail.com> on 2011/07/14 20:02:22 UTC
Runtime scope and transitive dependencies question (maybe
maven-ear-plugin bug?)
The Maven documentation
says<http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope>
:
> Each of the scopes (except for import) affects transitive dependencies in
> different ways, as is demonstrated in the table below. If a dependency is
> set to the scope in the left column, transitive dependencies of that
> dependency with the scope across the top row will result in a dependency in
> the main project with the scope listed at the intersection. If no scope is
> listed, it means the dependency will be omitted.
>
> compileprovidedruntimetestcompilecompile(*)-runtime-providedprovided-
> provided-runtimeruntime-runtime-testtest-test-
I have an ear project.
It depends on a jar project and does not specify a scope. Therefore that
jar project's scope is compile.
The jar project has a jar dependency whose scope is runtime.
If I am understanding the cryptic table above, my ear depends on a jar in
compile scope (so the scope in the left hand column is compile). Then my
jar depends on another jar--a transitive dependency--with scope runtime (so
the scope in the top row is runtime).
The intersection of compile-on-the-left and runtime-across-the-top is
runtime. The main project is, of course, my ear project.
When I do mvn package, my ear file does not contain this runtime
dependency. Should it? Do I need to make the transitive dependency
compile, even though it is not needed at compilation time by anyone?
Is that expected behavior?
Best,
Laird