Hi,
Raffaele schrieb:
Hi all,
my very simple scenario:
project B dependes upon project A which dependes upon Junit, and so:
I guess you mean project A depends on project B which depends on Junit.
A --> B --> Junit
Project A also needs of Junit to compile its test classes, but I would like
that project A didn't define directly the dependency from Junit.
That's not the maven philosophy. If a project depends directly on
classes from another project (class inheritance, imports...) it should
specify a dependency to the projects artifact in its pom. What for
example if project B be at some time doesn't depend on junit anymore?
Can Junit in this scenario be considered a transitive dependency for project
A? I believe yes.
I think no :-)
Additionally, as Nick pointed out only dependencies with a certain scope
are part of the transitive dependency tree. See [1] for a table
detailing the inclusion of transitive dependencies and their resulting
scopes.
When I load my projects in Eclipse 3.3 after obviously mvn eclipse:eclipse,
I see compile error on project A which it don't find the reference to
Junit....
But how can it be possible? Shouldn't the references of right jars be
arranged?
The compile error is also visible when I try from command-line to run mvn
test on project A folder.
As explained above, you have to include junit as a dependency in your
project. If you want to avoid specifying common dependencies in every
project you should look into creating a parent pom these projects share.
Thank you very much,
best regards.
Raffaele
-Tim
[1]
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]