Stack Exchange
Maven downloads Spring-AOP 3.0.0.RC3 instead of 3.1.1.Final
I am trying to upgrade spring-aop from Maven. I tried to delete all Spring files from my .m2 repo, however, when I run mvn dependency:tree I see 3.0.0.RC3 instead of 3.1.1.final...
Dependency tree:
[INFO] com.abercrombie.loyalty:LoyaltyProvider:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-aop:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:compile
[INFO] +- com.thoughtworks.xstream:xstream:jar:1.3.1:compile
[INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- com.ibm.db2:db2jcc:jar:2.10.113:compile
[INFO] +- com.ibm.db2:db2jcc_license:jar:2.10.113:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] |  +- antlr:antlr:jar:2.7.6:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  +- javax.transaction:jta:jar:1.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] +- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] |  +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] |  \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.5.6:compile
[INFO] +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] |  \- asm:asm:jar:3.3.1:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.1.12:compile
[INFO] |  \- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |     +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |     \- javax.activation:activation:jar:1.1:compile
[INFO] +- com.sun.jersey:jersey-core:jar:1.11:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.11:compile
[INFO] \- com.sun.jersey.contribs:jersey-spring:jar:1.11:compile
[INFO]    \- com.sun.jersey:jersey-servlet:jar:1.11:compile

POM Dependencies
<spring.version>3.1.1.RELEASE</spring.version>
<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-aop</artifactId>
   <version>${spring.version}</version>
</dependency>
<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-beans</artifactId>
   <version>${spring.version}</version>
</dependency>
<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-context</artifactId>
   <version>${spring.version}</version>
   </dependency>
<dependency>

how do I get it using 3.1.1.Final?

Is this the full dependency section, cause it looks like you are picking up the 3.0.0.RC3 version somewhere in the war project? Do you have some dependencyManagement sections in your project (may be in a parent etc.?)

One of your other dependencies is almost definitely transitively pulling in a different version of spring. I confirmed that if I add a dependency on jersey-spring I get an older version of spring-aop. You can fix it by just adding a dependencyManagement section. To demonstrate the problem, try putting the following into an empty maven project:
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-spring</artifactId>
        <version>1.11</version>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Look at the output of mvn dependency:tree. You will see the correct spring-aop version. Then delete the dependencyManagement section. It will be an older version. Delete the dependency on jersey-spring and you get the correct version of spring-aop again.

+1 for saving my morning. The jersey dependency was causing the issue for me.

My guess would be that you may have dependency declared somewhere else (e.g. dependencyManagement section in this or parent project). Try to run mvn help:effective-pom to see the actual pom and then work from there.

Spring AOP depend on other jar use mvn dependency:tree to see full details . Which jar is dependent on other.
