Exclude all modules from Wildfly 10

Viewed 803

I'm trying to deploy my Spring-boot app to a wildlfy server. However, i'm finding some conflicts between the libs. So, i want my app to use only what i define on my pom, and completely ignore all wildfly modules. Is it possible?

Using Wildfly 10 and spring-boot 2.x

1 Answers

Modules

Yes, it is possible. According to the RedHat docs, §3.4, and according to my practice which I have tested several times: You can PREVENT A Module being implicitly loaded. For this:

  1. Create (if not already existing) jboss-deployment-structure.xml file and add this into that file:

    <jboss-deployment-structure>
        <deployment>
           <exclusions>
              <module name="org.javassist" />
              <module name="org.dom4j" />
              <module name="org.apache.commons.configuration" />
              <!--and so on.. -->
           </exclusions>
        </deployment>
     </jboss-deployment-structure>
    
  2. add this (jboss-deployment-structure.xml) file to the project (For a web application (WAR) add this file to the WEB-INF directory. For an EJB archive (JAR) add it to the META-INF directory).

Sub-systems

On the other hand, EAR files (modules) will most likely include sub-systems, like WAR and JAR files. You can exclude only sub-system, from the module, as well. For this, include this snippet in the same (jboss-deployment-structure.xml) file:

<exclude-subsystems>
  <subsystem name="SUBSYSTEM_NAME" />
</exclude-subsystems>
Related