You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Richard Chamberlain <ri...@caplin.com> on 2008/04/28 14:59:22 UTC

Compiled dependencies are different when using different java versions

Hi All,

 

I've got a problem consistently resolving a project transitive
dependency when using different java versions. In my project xercesImpl
is defined as a transitive dependency for two artefacts:

 

Project

+- dependency1

|  +- xerces:xercesImpl:jar:2.6.2:compile

+- dependency2

|  +- xerces:xercesImpl:jar:2.8.1:compile

 

In this situation i'm not sure which version is included in compilation.


 

However what I didn't expect was that if I switch JDK versions between
jdk1.5.0 and jdk1.6.0 that what is compiled would be different!

 

Below is the dependency tree when run on the same machine, with the same
settings, but with different JAVA_HOME variables set.

 

 

 

Java 5

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.5.0_08

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...

 [INFO] |  +- xerces:xercesImpl:jar:2.6.2:compile

...

 [INFO] \- caplin.datasource:datasource-java:jar:4.4.8:compile

 

 

Java 6

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.6.0

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- caplin.datasource:datasource-java:jar:4.4.8:compile

[INFO] |  \- xerces:xercesImpl:jar:2.8.1:compile

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...


RE: Compiled dependencies are different when using different java versions

Posted by Richard Chamberlain <ri...@caplin.com>.
Thanks for the answer! We've experienced some nasty issues in our test
code due to collection ordering. 

Rich

-----Original Message-----
From: Brian E. Fox [mailto:brianf@reply.infinity.nu] 
Sent: 28 April 2008 15:06
To: Maven Users List
Subject: RE: Compiled dependencies are different when using different
java versions

You need to use 2.0.9 and then the order will be consistent. In the past
we didn't use linked collections so it was subject to the natural
ordering, which changed between 1.5 and 1.6. In 2.0.9, the order as
defined in the pom is preserved so you can reorder if you want to tweak
the resolution. All other things being equal (depth, scope etc) Maven
prefers the version found first.

-----Original Message-----
From: Richard Chamberlain [mailto:richard.chamberlain@caplin.com] 
Sent: Monday, April 28, 2008 8:59 AM
To: Maven Users List
Subject: Compiled dependencies are different when using different java
versions

Hi All,

 

I've got a problem consistently resolving a project transitive
dependency when using different java versions. In my project xercesImpl
is defined as a transitive dependency for two artefacts:

 

Project

+- dependency1

|  +- xerces:xercesImpl:jar:2.6.2:compile

+- dependency2

|  +- xerces:xercesImpl:jar:2.8.1:compile

 

In this situation i'm not sure which version is included in compilation.


 

However what I didn't expect was that if I switch JDK versions between
jdk1.5.0 and jdk1.6.0 that what is compiled would be different!

 

Below is the dependency tree when run on the same machine, with the same
settings, but with different JAVA_HOME variables set.

 

 

 

Java 5

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.5.0_08

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...

 [INFO] |  +- xerces:xercesImpl:jar:2.6.2:compile

...

 [INFO] \- caplin.datasource:datasource-java:jar:4.4.8:compile

 

 

Java 6

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.6.0

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- caplin.datasource:datasource-java:jar:4.4.8:compile

[INFO] |  \- xerces:xercesImpl:jar:2.8.1:compile

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Compiled dependencies are different when using different java versions

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
You need to use 2.0.9 and then the order will be consistent. In the past
we didn't use linked collections so it was subject to the natural
ordering, which changed between 1.5 and 1.6. In 2.0.9, the order as
defined in the pom is preserved so you can reorder if you want to tweak
the resolution. All other things being equal (depth, scope etc) Maven
prefers the version found first.

-----Original Message-----
From: Richard Chamberlain [mailto:richard.chamberlain@caplin.com] 
Sent: Monday, April 28, 2008 8:59 AM
To: Maven Users List
Subject: Compiled dependencies are different when using different java
versions

Hi All,

 

I've got a problem consistently resolving a project transitive
dependency when using different java versions. In my project xercesImpl
is defined as a transitive dependency for two artefacts:

 

Project

+- dependency1

|  +- xerces:xercesImpl:jar:2.6.2:compile

+- dependency2

|  +- xerces:xercesImpl:jar:2.8.1:compile

 

In this situation i'm not sure which version is included in compilation.


 

However what I didn't expect was that if I switch JDK versions between
jdk1.5.0 and jdk1.6.0 that what is compiled would be different!

 

Below is the dependency tree when run on the same machine, with the same
settings, but with different JAVA_HOME variables set.

 

 

 

Java 5

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.5.0_08

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...

 [INFO] |  +- xerces:xercesImpl:jar:2.6.2:compile

...

 [INFO] \- caplin.datasource:datasource-java:jar:4.4.8:compile

 

 

Java 6

 

> mvn -version

 

Maven version: 2.0.7

Java version: 1.6.0

OS name: "windows xp" version: "5.1" arch: "x86"

 

> mvn dependency:tree

 

...

[INFO] +- caplin.datasource:datasource-java:jar:4.4.8:compile

[INFO] |  \- xerces:xercesImpl:jar:2.8.1:compile

...

[INFO] +- jaxen:jaxen:jar:1.1.1:compile

...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org