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 17:41 |
Morris Jones Messages: 10 Registered: November 2009 |
Junior Member |
|
|
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] |
Wed, 04 November 2009 01:09 |
Carlos Sanchez Messages: 114 Registered: July 2009 |
Senior Member |
|
|
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 22:56 |
Carlos Sanchez Messages: 114 Registered: July 2009 |
Senior Member |
|
|
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 #571159 is a reply to message #495083] |
Wed, 04 November 2009 01:09 |
Carlos Sanchez Messages: 114 Registered: July 2009 |
Senior Member |
|
|
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 #571212 is a reply to message #495423] |
Wed, 04 November 2009 22:56 |
Carlos Sanchez Messages: 114 Registered: July 2009 |
Senior Member |
|
|
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
|
|
| | |
Goto Forum:
Current Time: Fri Apr 26 08:53:53 GMT 2024
Powered by FUDForum. Page generated in 0.04548 seconds
|