I want to put the following Maven dependency into my project.
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.9.9</version>
</dependency>
This dependency is dependent upon the following:
com.fasterxml.jackson.core:jackson-annotations:2.9.0com.fasterxml.jackson.core:jackson-core:2.9.9com.fasterxml.jackson.core:jackson-databind:2.9.9javax.servlet:javax.servlet-api:3.1.0joda-time:joda-time:2.7
I then want to deploy my application to a WildFly 8.2.1 server. While my particular dependency isn't provided by the server, its transitive dependencies are (under modules/system/layers/base).
com/fasterxml/jackson/core/jackson-annotations/main/jackson-annotations-2.4.1.jarcom/fasterxml/jackson/core/jackson-core/main/jackson-core-2.4.1.jarcom/fasterxml/jackson/core/jackson-databind/main/jackson-databind-2.4.1.jarjavax/servlet/api/main/jboss-servlet-api_3.1_spec-1.0.0.Finalorg/joda/time/main/joda-time-1.6.2.jar
Upon running the application, I get an error due to the databind dependency. My datatype dependency references a field in databind that did not appear in version 2.4.1. So I need to get the databind dependency up to 2.9.9.
Idea 1: Manually Include the Dependency
I tried manually including the updated dependency in my pom as follows (hoping it will override the WildFly version).
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
</dependency>
Result: Same error occurs.
Idea 2: Exclude the WildFly Version with jboss-deployment-structure.xml
I added a src/main/webapp/WEB-INF/jboss-deployment-structure.xml file with the following contents.
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="com.fasterxml.jackson.core.jackson-databind" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Result: Same error occurs.
Idea 3: Change WildFly Module
I add jackson-databind-2.9.9.jar directly to the WildFly module and update the corresponding module.xml to use the new JAR.
Result: Works. However, I do not want to do this as I want other developers to be able to use a fresh WildFly install without having to change anything.
Idea 4: Revert to Previous Version
I revert my original dependency to be in line with the WildFly versions of 2.4.1 as follows.
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.4.1</version>
</dependency>
Result: Works. However, a bunch of pre-existing code relies on the version being at 2.9.9 so I don't want to go backwards in the versioning.
Why is WildFly ignoring my attempts to override it's module? Is it possible to force the use of databind version 2.9.9. Thanks in advance for any help.