michael nesterenko
michael nesterenko

Reputation: 14439

spring dependencies

I just found one daunting thing. There are two versions of spring dependency coordinates.

Project has dependencies on spring mvc and spring flow. There are two parallel sets of dependencies.

Spring MVC has dependencies of the following scheme: org.springframework:spring-asm.

Spring Flow has dependencies of the following scheme: org.springfrmaework:org.springframework.asm.

Why are there two different sets of the same dependency? How can it be overcome?

<dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.webflow</artifactId>
        <version>2.3.1.RELEASE</version>
    </dependency>


<dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.4.RELEASE</version>
    </dependency>

Upvotes: 2

Views: 1026

Answers (1)

ElderMael
ElderMael

Reputation: 7101

It's basically a question of the artifacts you are using:

<dependency>
    <groupId>org.springframework.webflow</groupId>
    <artifactId>org.springframework.webflow</artifactId>
    <version>2.3.1.RELEASE</version>
</dependency>

Is an artifact from the SpringSource Enterprise Bundle Repository and those artifacts are OSGi compliant. I quote:

Welcome to the SpringSource Bundle Repository. Here you'll find OSGi-ready versions of hundreds of open source enterprise libraries that are commonly used when developing Spring applications.

On the other hand, you have:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.0.4.RELEASE</version>
</dependency>

Is a standard artifact from the maven repository.

org.springframework.asm

Is a patched version of the asm artifact for use with OSGi.

The best solution to fix this is only using the SEBR repository artifacts.

I recommend this because one time I had a problem with the jars from the maven central repo (they were corrupt) so I try to use the SEBR for any spring dependency. But I quote from the documentation:

If OSGi does not matter to you, either place works, though there are some pros and cons between them. In general, pick one place or the other for your project; do not mix them. This is particularly important since EBR artifacts necessarily use a different naming convention than Maven Central artifacts.

Upvotes: 3

Related Questions