-
stax-api dependency
Noticed that using different versions of maven can cause the pom of Spring BATCH (at least in 2.1.0-RELEASE) to sometimes include the stax-api 1.0.1 jar even though it is explicitly excluded in its pom via jettison.
Spring BATCH pom excluding stax-api.jar
Code:
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.1</version>
<exclusions>
<exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
My pom with Spring BATCH. Spring framework excluded to control the version I want (probably not the cause of this issue but I'm noting it here just in case)
Code:
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.1.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-transaction</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
</exclusions>
</dependency>
Now, when using maven version 2.0.8, I got this dependency tree which is fine since stax-api was not added.
Code:
Maven version: 2.0.8
Java version: 1.5.0_11
OS name: "linux" version: "2.6.23.1-42.fc8" arch: "i386" Family: "unix"
[INFO] +- org.springframework.batch:spring-batch-core:jar:2.1.0.RELEASE:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | +- stax:stax:jar:1.2.0:compile
[INFO] | \- com.thoughtworks.xstream:xstream:jar:1.3:compile
[INFO] | \- xpp3:xpp3_min:jar:1.1.4c:compile
However, when using maven 2.0.9, it got added.
Code:
Maven version: 2.0.9
Java version: 1.5.0_11
OS name: "linux" version: "2.6.26.8-57.fc8" arch: "i386" Family: "unix"
[INFO] +- org.springframework.batch:spring-batch-core:jar:2.1.0.RELEASE:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.3:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | \- stax:stax:jar:1.2.0:compile
[INFO] | \- stax:stax-api:jar:1.0.1:compile
This may be a maven issue but still the pom exclusion is done in BATCH and can be fixed in BATCH. Unfortunately, the latest maven versions are the ones causing the error. For now, I am forcing the exclusion of stax-api in my app's pom.