Search code examples
mavenmodulejarjbossdependencies

Jboss module vs JAR in deployment descriptor


What will take precedence, a module added as maven dependency and added in EAR's deployment descriptor or a Jboss module, for ex. jaxb jar?


Solution

  • At first, why do you want to add maven dependency to deployment descriptor? It is weird.

    If your code want to use jaxb classes then class loader will find them in EAR (maven dependency).

    If your code want to use a class from some third module (ex. jax-ws) and that module want to call jaxb then class loader will find jaxb in JBoss module. If versions are different errors can appears. It can be cause of redeploy memory leak.

    I recommend to make maven scope provided. And use module from JBoss.