Home » Archived » IAM (Eclipse Integration for Apache Maven) » Picking up wrong version of dependency if dependent project open(Command line maven gets right version, but IAM pulls an old version from a different dependency tree)
Picking up wrong version of dependency if dependent project open [message #495083] |
Tue, 03 November 2009 12:41  |
Eclipse User |
|
|
|
Here's the outline of my problem.
I'm building a web service using CXF version 2.2.4. The web service pulls from a platform library that includes a dependency on CXF 2.0.4.
In my project POM, I exclude cxf-api from the dependency, and include cxf-api with the correct version as a dependency. Yet IAM fails to honor the exclusion if I have the platform library open as a project in Eclipse.
If I close the platform project, then IAM gets the correct CXF version from my repository.
In my project POM, the platform library is included as follows, note the exclusion of cxf-api:
<dependency>
<groupId>com.my.project</groupId>
<artifactId>proj-platform</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
</exclusion>
</exclusions>
</dependency>
Meanwhile, above that exclusion in the pom file, is this dependency inclusion. ${cxf.version} is defined above as 2.2.4:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>${cxf.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
There's another issue too, with IAM rearranging my library order. I'll mention that in a different post.
Mojo
--
Morris Jones
Monrovia, CA
http://mojo.whiteoaks.com
|
|
| |
Re: Picking up wrong version of dependency if dependent project open [message #495175 is a reply to message #495083] |
Tue, 03 November 2009 20:09   |
Eclipse User |
|
|
|
you need to use the dependencyManagement section in the pom to force
versions. Using exclusions is not the right way to force versions.
On 11/3/09 9:41 AM, Morris Jones wrote:
> Here's the outline of my problem.
>
> I'm building a web service using CXF version 2.2.4. The web service
> pulls from a platform library that includes a dependency on CXF 2.0.4.
>
> In my project POM, I exclude cxf-api from the dependency, and include
> cxf-api with the correct version as a dependency. Yet IAM fails to honor
> the exclusion if I have the platform library open as a project in Eclipse.
>
> If I close the platform project, then IAM gets the correct CXF version
> from my repository.
>
> In my project POM, the platform library is included as follows, note the
> exclusion of cxf-api:
>
>
> <dependency>
> <groupId>com.my.project</groupId>
> <artifactId>proj-platform</artifactId>
> <version>${project.version}</version>
> <exclusions>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-webmvc</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-jaxws</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http-jetty</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-api</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-core</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
>
> Meanwhile, above that exclusion in the pom file, is this dependency
> inclusion. ${cxf.version} is defined above as 2.2.4:
>
>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-api</artifactId>
> <version>${cxf.version}</version>
> <exclusions>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-beans</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-context</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-core</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-web</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
>
> There's another issue too, with IAM rearranging my library order. I'll
> mention that in a different post.
>
> Mojo
> --
> Morris Jones
> Monrovia, CA
> http://mojo.whiteoaks.com
|
|
| | | |
Re: Picking up wrong version of dependency if dependent project open [message #495455 is a reply to message #495423] |
Wed, 04 November 2009 17:56   |
Eclipse User |
|
|
|
On 11/4/09 11:12 AM, Morris Jones wrote:
> Carlos Sanchez wrote on Wed, 04 November 2009 13:24
>> talking from memory you can use something like this
>> if you wanna force a version just use dependencyManagement, not
>> exclusions
>>
>> to debug what's going on you can use the analyze dependencies view and
>> see what version is actually being picked up. IAM will pick the open
>> project if groupId, artifactId and version match
>
>
> Sorry, I still don't understand what you're suggesting that's different
> from what I'm already doing. The XML you posted looks like exactly what
> I'm using. I certainly have Maven Dependency Management turned on in
> Eclipse.
it's different, compare it. It uses the <dependencyManagement> section
in the pom to force versions.
http://maven.apache.org/guides/introduction/introduction-to- dependency-mechanism.html#Dependency_Management
>
> "Analyze dependencies" shows the correct version of CXF being a
> dependency (2.2.4) and yet Eclipse shows errors in the build because
> it's building with 2.0.6.
I think you may have an issue where you get 2 cxf jars from 2 different
groups, in that case Maven does not know that they are the same jar and
will include both in the classpath, and obviously the first one wins
You mentioned before that 2.0.4 was picked up and it's not in the repo
http://repo2.maven.org/maven2/org/apache/cxf/cxf-api/
>
> I can only solve this problem by keeping my platform project closed in
> Eclipse, which is sadly painful when I'm trying to work on both projects.
>
> I'm sorry I'm having real difficulty understanding your suggestion.
>
> Best regards,
> Mojo
|
|
| |
Re: Picking up wrong version of dependency if dependent project open [message #495467 is a reply to message #495462] |
Wed, 04 November 2009 19:33  |
Eclipse User |
|
|
|
did you check my other comment?
I think you may have an issue where you get 2 cxf jars from 2 different
groups, in that case Maven does not know that they are the same jar and
will include both in the classpath, and obviously the first one wins
You mentioned before that 2.0.4 was picked up and it's not in the repo
http://repo2.maven.org/maven2/org/apache/cxf/cxf-api/
If you send the output of
mvn dependency:tree -Dverbose
we could take a look
On 11/4/09 4:05 PM, Morris Jones wrote:
> Hmmm. I see your point now.
>
> So I tried adding a <dependencyManagement/> section to my POM,
> specifying a version for the cxf-api artifact. The project still builds
> fine from the command line, and in Eclipse, unless the dependent
> platform project is open in Eclipse, then it bombs from trying to link
> the old version.
>
> So still no joy. The Eclipse errors only go away if I close the
> dependent project.
>
> Maybe there's some way to unlink the two projects. I suspect not. :(
>
> So it still appears that IAM is not honoring either the exclusions or
> the <dependencyManagement/> section.
>
> Mojo
>
>
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571131 is a reply to message #495083] |
Tue, 03 November 2009 13:24  |
Eclipse User |
|
|
|
There's a related issue as well.
My main project includes CXF 2.2.4. It has a dependent project (platform) that has a dependency on CXF 2.0.6, and my main pom file excludes the CXF dependency from my platform dependency.
The older CXF version includes a dependency on jaxws-api-2.0, which has moved to the runtime library in Java 6. If I open the platform project, it pulls in the old jaxws-api-2.0 from the Maven dependencies instead of from the runtime library.
I can workaround the issue by either closing the platform project, or by changing the search order in the Build Path to search the runtime library ahead of the Maven dependencies.
If I change the Build Path order, IAM changes it back on each project clean.
Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571159 is a reply to message #495083] |
Tue, 03 November 2009 20:09  |
Eclipse User |
|
|
|
you need to use the dependencyManagement section in the pom to force
versions. Using exclusions is not the right way to force versions.
On 11/3/09 9:41 AM, Morris Jones wrote:
> Here's the outline of my problem.
>
> I'm building a web service using CXF version 2.2.4. The web service
> pulls from a platform library that includes a dependency on CXF 2.0.4.
>
> In my project POM, I exclude cxf-api from the dependency, and include
> cxf-api with the correct version as a dependency. Yet IAM fails to honor
> the exclusion if I have the platform library open as a project in Eclipse.
>
> If I close the platform project, then IAM gets the correct CXF version
> from my repository.
>
> In my project POM, the platform library is included as follows, note the
> exclusion of cxf-api:
>
>
> <dependency>
> <groupId>com.my.project</groupId>
> <artifactId>proj-platform</artifactId>
> <version>${project.version}</version>
> <exclusions>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-webmvc</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-jaxws</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http-jetty</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-api</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-core</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
>
> Meanwhile, above that exclusion in the pom file, is this dependency
> inclusion. ${cxf.version} is defined above as 2.2.4:
>
>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-api</artifactId>
> <version>${cxf.version}</version>
> <exclusions>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-beans</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-context</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-core</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-web</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
>
> There's another issue too, with IAM rearranging my library order. I'll
> mention that in a different post.
>
> Mojo
> --
> Morris Jones
> Monrovia, CA
> http://mojo.whiteoaks.com
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571175 is a reply to message #495175] |
Wed, 04 November 2009 10:42  |
Eclipse User |
|
|
|
Carlos Sanchez wrote on Tue, 03 November 2009 20:09
> you need to use the dependencyManagement section in the pom to force
> versions. Using exclusions is not the right way to force versions.
That sounds like a good idea, but I thought I was forcing a version by putting a <version/> element on the dependency. And given that command line Maven works perfectly for this POM, it's definitely picking up the right version. It's only in Eclipse that it fails, when the dependent platform project is open.
That said I'd love an example of how to force a version to be included that's different from what I've done!
Best regards,
Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571186 is a reply to message #571175] |
Wed, 04 November 2009 13:24  |
Eclipse User |
|
|
|
talking from memory you can use something like this
if you wanna force a version just use dependencyManagement, not exclusions
to debug what's going on you can use the analyze dependencies view and
see what version is actually being picked up. IAM will pick the open
project if groupId, artifactId and version match
<dependency>
<groupId>com.my.project</groupId>
<artifactId>proj-platform</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
</exclusion>
</exclusions>
</dependency>
....
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
On 11/4/09 7:42 AM, Morris Jones wrote:
> Carlos Sanchez wrote on Tue, 03 November 2009 20:09
>> you need to use the dependencyManagement section in the pom to force
>> versions. Using exclusions is not the right way to force versions.
>
>
> That sounds like a good idea, but I thought I was forcing a version by
> putting a <version/> element on the dependency. And given that command
> line Maven works perfectly for this POM, it's definitely picking up the
> right version. It's only in Eclipse that it fails, when the dependent
> platform project is open.
>
> That said I'd love an example of how to force a version to be included
> that's different from what I've done!
>
> Best regards,
> Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571197 is a reply to message #495413] |
Wed, 04 November 2009 14:12  |
Eclipse User |
|
|
|
Carlos Sanchez wrote on Wed, 04 November 2009 13:24
> talking from memory you can use something like this
> if you wanna force a version just use dependencyManagement, not exclusions
>
> to debug what's going on you can use the analyze dependencies view and
> see what version is actually being picked up. IAM will pick the open
> project if groupId, artifactId and version match
Sorry, I still don't understand what you're suggesting that's different from what I'm already doing. The XML you posted looks like exactly what I'm using. I certainly have Maven Dependency Management turned on in Eclipse.
"Analyze dependencies" shows the correct version of CXF being a dependency (2.2.4) and yet Eclipse shows errors in the build because it's building with 2.0.6.
I can only solve this problem by keeping my platform project closed in Eclipse, which is sadly painful when I'm trying to work on both projects.
I'm sorry I'm having real difficulty understanding your suggestion.
Best regards,
Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571212 is a reply to message #495423] |
Wed, 04 November 2009 17:56  |
Eclipse User |
|
|
|
On 11/4/09 11:12 AM, Morris Jones wrote:
> Carlos Sanchez wrote on Wed, 04 November 2009 13:24
>> talking from memory you can use something like this
>> if you wanna force a version just use dependencyManagement, not
>> exclusions
>>
>> to debug what's going on you can use the analyze dependencies view and
>> see what version is actually being picked up. IAM will pick the open
>> project if groupId, artifactId and version match
>
>
> Sorry, I still don't understand what you're suggesting that's different
> from what I'm already doing. The XML you posted looks like exactly what
> I'm using. I certainly have Maven Dependency Management turned on in
> Eclipse.
it's different, compare it. It uses the <dependencyManagement> section
in the pom to force versions.
http://maven.apache.org/guides/introduction/introduction-to- dependency-mechanism.html#Dependency_Management
>
> "Analyze dependencies" shows the correct version of CXF being a
> dependency (2.2.4) and yet Eclipse shows errors in the build because
> it's building with 2.0.6.
I think you may have an issue where you get 2 cxf jars from 2 different
groups, in that case Maven does not know that they are the same jar and
will include both in the classpath, and obviously the first one wins
You mentioned before that 2.0.4 was picked up and it's not in the repo
http://repo2.maven.org/maven2/org/apache/cxf/cxf-api/
>
> I can only solve this problem by keeping my platform project closed in
> Eclipse, which is sadly painful when I'm trying to work on both projects.
>
> I'm sorry I'm having real difficulty understanding your suggestion.
>
> Best regards,
> Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571238 is a reply to message #495083] |
Wed, 04 November 2009 19:05  |
Eclipse User |
|
|
|
Hmmm. I see your point now.
So I tried adding a <dependencyManagement/> section to my POM, specifying a version for the cxf-api artifact. The project still builds fine from the command line, and in Eclipse, unless the dependent platform project is open in Eclipse, then it bombs from trying to link the old version.
So still no joy. The Eclipse errors only go away if I close the dependent project.
Maybe there's some way to unlink the two projects. I suspect not. :(
So it still appears that IAM is not honoring either the exclusions or the <dependencyManagement/> section.
Mojo
|
|
|
Re: Picking up wrong version of dependency if dependent project open [message #571267 is a reply to message #495462] |
Wed, 04 November 2009 19:33  |
Eclipse User |
|
|
|
did you check my other comment?
I think you may have an issue where you get 2 cxf jars from 2 different
groups, in that case Maven does not know that they are the same jar and
will include both in the classpath, and obviously the first one wins
You mentioned before that 2.0.4 was picked up and it's not in the repo
http://repo2.maven.org/maven2/org/apache/cxf/cxf-api/
If you send the output of
mvn dependency:tree -Dverbose
we could take a look
On 11/4/09 4:05 PM, Morris Jones wrote:
> Hmmm. I see your point now.
>
> So I tried adding a <dependencyManagement/> section to my POM,
> specifying a version for the cxf-api artifact. The project still builds
> fine from the command line, and in Eclipse, unless the dependent
> platform project is open in Eclipse, then it bombs from trying to link
> the old version.
>
> So still no joy. The Eclipse errors only go away if I close the
> dependent project.
>
> Maybe there's some way to unlink the two projects. I suspect not. :(
>
> So it still appears that IAM is not honoring either the exclusions or
> the <dependencyManagement/> section.
>
> Mojo
>
>
|
|
|
Goto Forum:
Current Time: Tue Jul 22 17:28:51 EDT 2025
Powered by FUDForum. Page generated in 0.29132 seconds
|