From users-return-125751-apmail-maven-users-archive=maven.apache.org@maven.apache.org Wed Feb 22 07:40:53 2012 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 DC1D69B04 for ; Wed, 22 Feb 2012 07:40:53 +0000 (UTC) Received: (qmail 37620 invoked by uid 500); 22 Feb 2012 07:40:51 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 37459 invoked by uid 500); 22 Feb 2012 07:40:50 -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 37444 invoked by uid 99); 22 Feb 2012 07:40:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 07:40:50 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=FSL_RCVD_USER,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; Wed, 22 Feb 2012 07:40:44 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S06oG-0005Qx-Dw for users@maven.apache.org; Wed, 22 Feb 2012 08:40:20 +0100 Received: from mail.scalaris.com ([62.154.225.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Feb 2012 08:40:20 +0100 Received: from Joerg.Schaible by mail.scalaris.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Feb 2012 08:40:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: users@maven.apache.org From: =?UTF-8?B?SsO2cmc=?= Schaible Subject: Re: Maven 3.0.3 Not Allowing Different Versions for Compile/Test Date: Wed, 22 Feb 2012 08:40:10 +0100 Organization: Scalaris AG Lines: 132 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: mail.scalaris.com User-Agent: KNode/4.7.4 Hi Daniel, Daniel Jones wrote: > Hi all, > > Apologies in advance if this isn't the right list to post to. > > Using Maven 3.0.3 and Dependency plug-in 2.4, I've encountered a > strange issue whereby if I specify different versions of a dependency, > one in compile scope and one in test, only one of them gets 'noticed'. > I've detailed the problem on Stack Overflow > (http://stackoverflow.com/questions/9364511/maven-different-dependency- version-in-test), > but I'll repeat the explanation here. > > In my project I need to depend on a Cloudera distribution of Hadoop > and a 'vanilla' version for JUnit testing, as the former only works on > *nix. > > When I try and execute my application, I get Exception in thread > "main" java.lang.NoClassDefFoundError: > org/apache/hadoop/conf/Configuration. When I run JUnit tests from > Maven or Eclipse, everything works fine. If I comment out the test > dependencies, the application runs successfully, but then the tests > fail because they're using the wrong version. > > Why is the compile dependency getting ignored when the test dependency > is uncommented? > > > org.apache.hadoop > hadoop-core > 0.20.2-cdh3u2 > compile > > > > org.apache.hadoop > hadoop-core > 1.0.0 > test > > > > org.apache.hadoop > hadoop-test > 1.0.0 > test > > > mvn dependency:list shows the following, which does not show the > compile scoped version at all: > > [INFO] The following files have been resolved: > [INFO] ant:ant:jar:1.6.5:test > [INFO] aopalliance:aopalliance:jar:1.0:compile > [INFO] asm:asm:jar:3.3.1:compile > [INFO] cglib:cglib:jar:2.2.2:compile > [INFO] ch.qos.logback:logback-classic:jar:1.0.0:compile > [INFO] ch.qos.logback:logback-core:jar:1.0.0:compile > [INFO] com.google.guava:guava:jar:r08:compile > [INFO] com.h2database:h2:jar:1.3.164:test > [INFO] com.jolbox:bonecp:jar:0.7.1.RELEASE:compile > [INFO] com.sun.jersey:jersey-core:jar:1.11:test > [INFO] commons-beanutils:commons-beanutils:jar:1.7.0:test > [INFO] commons-beanutils:commons-beanutils-core:jar:1.8.0:test > [INFO] commons-cli:commons-cli:jar:1.2:test > [INFO] commons-codec:commons-codec:jar:1.4:test > [INFO] commons-collections:commons-collections:jar:3.2.1:test > [INFO] commons-configuration:commons-configuration:jar:1.6:test > [INFO] commons-digester:commons-digester:jar:1.8:test > [INFO] commons-el:commons-el:jar:1.0:test > [INFO] commons-httpclient:commons-httpclient:jar:3.0.1:test > [INFO] commons-lang:commons-lang:jar:2.4:test > [INFO] commons-logging:commons-logging:jar:1.1.1:compile > [INFO] commons-net:commons-net:jar:1.4.1:test > [INFO] hsqldb:hsqldb:jar:1.8.0.10:test > [INFO] junit:junit:jar:4.10:test > [INFO] mysql:mysql-connector-java:jar:5.1.18:compile > [INFO] net.java.dev.jets3t:jets3t:jar:0.7.1:test > [INFO] net.sf.kosmosfs:kfs:jar:0.3:test > [INFO] org.apache.commons:commons-math:jar:2.1:test > [INFO] org.apache.ftpserver:ftplet-api:jar:1.0.0:test > [INFO] org.apache.ftpserver:ftpserver-core:jar:1.0.0:test > [INFO] org.apache.ftpserver:ftpserver-deprecated:jar:1.0.0-M2:test > [INFO] org.apache.hadoop:hadoop-core:jar:1.0.0:test > [INFO] org.apache.hadoop:hadoop-test:jar:1.0.0:test > [INFO] org.apache.mina:mina-core:jar:2.0.0-M5:test > [INFO] org.codehaus.jackson:jackson-core-asl:jar:1.0.1:test > [INFO] org.codehaus.jackson:jackson-mapper-asl:jar:1.0.1:test > [INFO] org.eclipse.jdt:core:jar:3.1.1:test > [INFO] org.hamcrest:hamcrest-core:jar:1.1:test > [INFO] org.liquibase:liquibase-core:jar:2.0.3:test > [INFO] org.liquibase.ext:liquibase-slf4j:jar:0.0.1:test > [INFO] org.mortbay.jetty:jetty:jar:6.1.26:test > [INFO] org.mortbay.jetty:jetty-util:jar:6.1.26:test > [INFO] org.mortbay.jetty:jsp-2.1:jar:6.1.14:test > [INFO] org.mortbay.jetty:jsp-api-2.1:jar:6.1.14:test > [INFO] org.mortbay.jetty:servlet-api:jar:2.5-20081211:test > [INFO] org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:test > [INFO] org.slf4j:jcl-over-slf4j:jar:1.6.4:compile > [INFO] org.slf4j:log4j-over-slf4j:jar:1.6.4:compile > [INFO] org.slf4j:slf4j-api:jar:1.6.4:compile > [INFO] org.springframework:spring-aop:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-asm:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-beans:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-context:jar:3.1.1.RELEASE:compile > [INFO] > [org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-core:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-expression:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile > [INFO] org.springframework:spring-test:jar:3.1.1.RELEASE:test > [INFO] org.springframework:spring-tx:jar:3.1.1.RELEASE:compile > [INFO] > [org.springframework.data:spring-data-hadoop:jar:1.0.0.BUILD-SNAPSHOT:c > ompile > [INFO] oro:oro:jar:2.0.8:test > [INFO] tomcat:jasper-compiler:jar:5.5.12:test > [INFO] tomcat:jasper-runtime:jar:5.5.12:test > [INFO] xmlenc:xmlenc:jar:0.52:test > > I've worked around the issue for now by using profile properties, but > I thought it would be worth mentioning this on the Maven list in case > it turns out to be a bug. No, it is by design. Maven will always resolve the same dependency (in term of groupId:artifactId) to the "nearest" version. Regards, Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org