Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D4AC10C08 for ; Mon, 3 Jun 2013 23:56:40 +0000 (UTC) Received: (qmail 92514 invoked by uid 500); 3 Jun 2013 23:56:38 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 92442 invoked by uid 500); 3 Jun 2013 23:56:38 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 92434 invoked by uid 99); 3 Jun 2013 23:56:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 23:56:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gcjtmu-turbine-maven-user-846@m.gmane.org designates 80.91.229.3 as permitted sender) Received: from [80.91.229.3] (HELO plane.gmane.org) (80.91.229.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 23:56:32 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ujebj-0005rS-Bo for users@maven.apache.org; Tue, 04 Jun 2013 01:56:11 +0200 Received: from hsi-kbw-095-208-058-089.hsi5.kabel-badenwuerttemberg.de ([95.208.58.89]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Jun 2013 01:56:11 +0200 Received: from joerg.schaible by hsi-kbw-095-208-058-089.hsi5.kabel-badenwuerttemberg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Jun 2013 01:56:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: users@maven.apache.org From: =?UTF-8?B?SsO2cmc=?= Schaible Subject: Re: Transitive Dependency Question Date: Tue, 04 Jun 2013 01:56:01 +0200 Lines: 64 Message-ID: References: Reply-To: joerg.schaible@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: hsi-kbw-095-208-058-089.hsi5.kabel-badenwuerttemberg.de User-Agent: KNode/4.10.2 X-Virus-Checked: Checked by ClamAV on apache.org Hi Jamal, Jamal B wrote: > Hello, I have a question about transitive dependencies. According to the > pom documentation here: http://maven.apache.org/pom.html#Dependencies > > project dependencies marked with test scope are not transitive. I assumed > that this also applied to it's dependencies, so my question is if I > declare a dependency on a project at test scope, that project's > dependencies should > all be included at test scope. For example, given the following > project(s) > > Project test-utils defines a junit dependency like such: > > > junit > junit > > > Project application defines a dependency on test-utils with a scope of > test like such > > ${project.groupId} > test-utils > ${project.version} > test > > > Now running mvn clean dependency:tree shows that the junit dependency is > being passed to the application project at compile scope which is not > expected. > > [INFO] --- maven-dependency-plugin:2.7:tree (default-cli) @ application > [--- INFO] org.sandbox:application:war:1.0.0-SNAPSHOT > .... > [INFO] \- org.sandbox:test-utils:jar:1.0.0-SNAPSHOT:test > [INFO] +- junit:junit:jar:4.8.2:compile > [INFO] +- org.mockito:mockito-all:jar:1.8.5:test > [INFO] +- com.h2database:h2:jar:1.3.165:test > [INFO] \- log4j:log4j:jar:1.2.16:test > > > Is this a bug or was my interpretation of the transitive dependency logic > incorrect? > > Thank you for your time. Actually I was fooled by such an output with M3 in one of my projects at first sight also. So, please make a test: Comment out the org.sandbox:test-utils in your POM and print the tree again. I am quite sure that you will see that junit:junit is now introduced by a different dependency that is not of test scope. What you see above is only the result of the dependency resolver. It detected that it already has a junit:junit in its transitive deps in compile scope (maybe even in a different version), but the "nearest" path to junit was as direct child of org.sandbox:test-utils. Therefor it was "promoted" to compile scope in this place, but the overall result of the compilation classpath is still OK, it is only the displayed tree that is somewhat inconsistent (compared to M2). - Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org