9

I have a Maven project depending on couple other Maven projects. I am using Spring 3.1.1 in my project and dependent projects have 3.0.6. I am trying to exclude Spring 3.0.6 when deploying since having both isn't possible. I have added an explicit exclusion in my POM for that but for some reason I still see old version of spring core jars in the WEB-INF/lib folder when I start the Tomcat server. Can someone point me out where I am going wrong. Here is my pom.xml:

<project> .... <properties> <org.springframework-version>3.1.1.RELEASE</org.springframework-version> </properties> <dependency> <groupId>com.test.abc</groupId> <artifactId>abc</artifactId> <version>1.0</version> <type>war</type> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework-version}</version> <exclusions> <!-- Exclude Commons Logging in favor of SLF4j --> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>3.0.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-xml</artifactId> <version>1.0-m2</version> </dependency> .... </project> 
9
  • are you sure you excluded it from all dependencies which depended on it? Commented Feb 22, 2013 at 17:58
  • yes i did. i am going crazy with this already. Commented Feb 22, 2013 at 18:05
  • what is your output if you run mvn dependency:tree? Commented Feb 22, 2013 at 18:13
  • weird thing is my dependency tree output doesn't show those spring 3.0.6 jars in it. do you want me to post the output? Commented Feb 22, 2013 at 18:24
  • if the dependency:tree did not show them, then they are not being included. did you run mvn clean after you added the exclusion? Commented Feb 22, 2013 at 18:25

2 Answers 2

4

Your dependency type is war so there is no resolution happening here. Maven overlays the war contents over your project.

When the war is published to repository, the artifact will contain dependent libraries in WEB-INF lib folder. During overlay it does not treat lib folder any different from any static resource unless you tell it to exclude in different way.Check 'overlay' property here

Sign up to request clarification or add additional context in comments.

Comments

1

In my case I thought I excluded the right dependency. With eclipse, on dependency hierarchy tab you can right click on it and click exclude artifact and it excluded the right dependency (they both had the same artifactId but different groupId)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.