Maven selects its dependencies not on highest version number, but on
shortest path to dependency. i.e. if you have project dependencies A
1.0depends on B
1.0 depends on C 1.2 and D 1.0 depends on C 1.1, then the dependency in your
classpath will be C 1.1 as it has the shortest path to your project.
The easiest way to sort this out without drowning in Maven transitive
dependency nightmares is to include the dependency you want directly in your
project's pom.xml. It will override all other dependencies inherited
transitively.
Mike.
On 7/18/07, syg6 <[EMAIL PROTECTED]> wrote:
Well I can't get this thing to work.
I ran a 'mvn -X' and 'commons-lang-2.1' comes up all over the place. What
I
gather I need to do is find out which artifacts depend on '
commons-lang-2.1'
and exlcude them from the 'spring-modules-validation' artifact, which
depends on 'commons-lang-2.3' (or 2.2 minimum).
The output for the 'mxn -X' command has a bunch of lines like this:
[DEBUG] Adding managed dependencies for unknown:xxxxxx
... followed by all the jars it needs. The following artifacts list
'commons-lang:jar:2.1' :
ehcache
spring (which I understand as spring-aop, spring-dao, spring-jdbc,
spring-remoting, spring-support)
acegi-security-tiger
displaytag
So I tried exclusing them like this:
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-validation</artifactId>
<version>${springmodules.validation.version}</version>
<exclusions>
<exclusion>
<artifactId>ehcache</artifactId>
<groupId>net.sf.ehcache</groupId>
</exclusion>
</exclusions>
And so on. But after doing this if I run 'mvn -X' again I still see this:
[DEBUG] org.springmodules:spring-modules-validation:jar:0.8:compile
(selected for compile)
[DEBUG] commons-lang:commons-lang:jar:2.2:compile (removed - nearer
found: 2.1)
It's grabbing commons-lang-2.1 instead of 2.3.
What gives? I've been puring over the Maven docs and I can't find anything
like this ...
Anyone?
Cheers,
Bob
mraible wrote:
>
> On 7/17/07, syg6 <[EMAIL PROTECTED]> wrote:
>>
>> Hi Matt,
>>
>> I would have thought the opposite - it seems some library (Spring
>> validator)
>> is somehow 'bundling' version 2.1 of commons-lang when in fact it needs
>> 2.3.
>> It seems to me that I need to tell it to use 2.3, not 2.1.
>
> Sorry, I misunderstood. You sound like you know what you're doing
though.
> ;-)
>
>>
>> What I don't get is why this broke only after exploding Appfuse, and
who
>> is
>> 'including' version 2.1. I ran the 'mvn -X' command and
>> 'commons-lang-2-1'
>> is popping up all over the place. Is there any way to make those apps
>> that
>> depend on 2.1 instead use 2.3? I am a Maven newb, as you can probably
>> tell
>
> You can use <exclusions> to exclude commons-lang from those
> dependencies. Is there a dependency that actually references 2.3 and
> it's just not getting picked up? If so, I've seen this happen before -
> usually Maven picks the shortest path. That's the reason why putting
> it in your pom.xml explicitly should fix the problem.
>
> Matt
>
>> ...
>>
>> Thanks!
>> Bob
>>
>>
>>
>> mraible wrote:
>> >
>> > If you add an explicit dependency on commons-lang-2.1 to your pom.xml
,
>> > it should fix any transitive dependency issues. The problem is likely
>> > because struts-menu (or another library) depends on a newer version
of
>> > commons-lang. You can run "mvn -X > mvn.log" to see the full
>> > dependency list in mvn.log.
>> >
>> > Matt
>> >
>> > On 7/17/07, syg6 <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I have been working with Appfuse M5 for a couple weeks now. I had no
>> >> problem
>> >> with anything while working with the JAR-ed and WAR-ed version.
>> >>
>> >> But then I have 'exploded' Appfuse into my Eclipse using 'mvn
>> >> appfuse:full-source' and 'mvn eclipse:eclipse'. And now when I run
>> 'mvn
>> >> test
>> >> -Dtest=PersonControllerTest' I get this error:
>> >>
>> >> java.lang.NoSuchFieldError: IS_JAVA_1_6
>> >> at
>> >>
>> org.springmodules.validation.util.LibraryUtils.<clinit>(
LibraryUtils.java:40)
>> >>
>> >> http://forum.springframework.org/archive/index.php/t-35083.html This
>> >> post
>> >> seems to say that the Spring Validation framework has a dependency
on
>> >> commons-lang-2.1, whereas Appfuse uses commons-lang-2.3.
>> >>
>> >> But I can't find commons-lang-2.1 anywhere in Appfuse and this
wasn't
>> >> happening before using the exploded verison of Appfuse.
>> >>
>> >> Btw, I am using Spring MVC Basic.
>> >>
>> >> Many thanks!
>> >> Bob
>> >> --
>> >> View this message in context:
>> >>
>>
http://www.nabble.com/Problems-executing-controller-test-after-running-mvn-appfuse%3Afull-source-tf4097676s2369.html#a11652009
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >>
---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > http://raibledesigns.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Problems-executing-controller-test-after-running-mvn-appfuse%3Afull-source-tf4097676s2369.html#a11652420
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Problems-executing-controller-test-after-running-mvn-appfuse%3Afull-source-tf4097676s2369.html#a11666344
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]