Wednesday, February 15, 2012

mybatis-spring 1.0.2 crash with springframework 3.1? introduce maven dependency exclusions

As a new in maven, after setting up maven dependency with springframework 3.1 and mybatis-spring 1.0.2 .
It crashed. It worked before I set up maven.
why it is not working with maven. Should I dump maven?

I was looking into it.
the reason was mybatis has dependency to spring 3.0.6. WTH
and bring spring 3.1 jars from my configurations and 3.0.6 jars from mybatis.

<dependency>
   <groupId>org.mybatis</groupId>
   <artifactId>mybatis-spring</artifactId>
   <version>1.0.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-jdbc</artifactId>
    </exclusion>
    <exclusion>
     <groupId>org.springframework</groupId>
     <artifactId>spring-test</artifactId>
    </exclusion>
    <exclusion>
     <groupId>org.springframework</groupId>
     <artifactId>spring-tx</artifactId>
    </exclusion>
   </exclusions>
  </dependency>


That's the solution to bring only spring 3.1 jars.

By they way, I had to type it all on by one. I was wonder if there is any smarter way with wild card.
like this. would it be working? it would be so great if it works.

<dependency>
   <groupId>org.mybatis</groupId>
   <artifactId>mybatis-spring</artifactId>
   <version>1.0.2</version>
   <exclusions>
    <exclusion>
     <groupId>org.springframework</groupId>
     <artifactId>*</artifactId>
    </exclusion>
   </exclusions>
  </dependency>


But, It is not working, I hope it works soon.
Maven team is working on this.  there is already the same issue in maven jira
http://jira.codehaus.org/browse/MNG-3832

No comments:

Post a Comment