Multiple JBoss/WildFly deployment descriptors in a single WAR

826 Views Asked by At

Our application runs unchanged on JBoss 6 EAP and 7 Community. Now we want to add support for WildFly 9 and we found out that we need to change various JBoss deployment descriptors (jboss-deployment-structure.xml, jboss-scanning.xml, jboss-web.xml) that are packaged in the application WAR to make the app work on WildFly 9. Unfortunately these changes seem to break backward compatibility of our app with older JBoss releases.

Is there any way to have multiple JBoss deployment descriptor versions in a single WAR archive so that each JBoss version picks the highest version that it can support?

Our goal is to have a single application WAR that works unchanged on JBoss 6.x EAP, JBoss 7.x Community as well as WildFly 8.x and 9.x.

1

There are 1 best solutions below

0
Tea Curran On

Unfortunately, there is currently no way to do this with a single jboss-deployment-structure.xml file.

My teams have taken one of the following approaches to solving this:

  1. Create a custom module that gets installed in each app server and have the jboss-deployment-structure file only reference this custom module.

  2. have a separate maven profile for each app server you wish to deploy on. This isn't ideal because it produces different war files for your different servers. This is neccessary for projects where other files need to change as well such as beans.xml or web.xml.