Hi,

Maven supports the specify the spring version dependencies in your pom to override the CXF's spring dependencies, you don't need to use the exclusion tags everywhere.

Here is an example in camel-cxf module pom.xml[1] which override the Spring version from 2.0.8 to 2.5.5.

[1] https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/pom.xml

Willem

Tarjei Huse wrote:
Tarjei Huse wrote:
Hi, I'm trying to use CXF with Maven and Spring 2.5.5.

My problem is that the CXF poms depend on Spring 2.0.8 resulting in the
following error when I try to write tests:

org.apache.maven.surefire.booter.SurefireExecutionException:
org/springframework/core/AliasRegistry; nested exception is
java.lang.NoClassDefFoundError: org/springframework/core/AliasRegistry
java.lang.NoClassDefFoundError: org/springframework/core/AliasRegistry

My question is:

Does anyone know how I can configure Maven to override the spring
dependencies so that CXF will use 2.5.5 instead of 2.0.8?

Or, do I have to rip out maven and use ant so that I can have local libs
instead?

Ok, this is what I ended up with:
   <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-api</artifactId>
      <version>2.1.2</version>
            <exclusions>
          <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>

I had to add this exclusion to every cxf dependency. It seems to work
for now. Maybe something for the FAQ?

Regards,
Tarjei


kind regards,
Tarjei



Reply via email to