'Can I override an web.xml in a .war file within a .ear file with my JBoss overlay? And is it good paxis?

I'm no expert in the field but got the task to write an JBoss overlay cli skript which adapts the context root of our web-application for multiple environments (dev, tst, ..). I.e. overrides the application.xml in our EAR-File (we have to deliver our application in) like so

deployment-overlay add --name=great-app-dev --content=META-INF/application.xml=application.xml-tst/application.xml --deployments=great-app-dev-tst.ear --redeploy affected

This works like a charm locally. Next step is to insert environment entries in the same manner. I.e. override the web.xml which is inside the WAR file which is inside the EAR file as it holds the entries like so

<env-entry>
    <env-entry-name>java:app/env/api-url</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>theValue</env-entry-value>
</env-entry>

Is this possible? And do you see any problems with this approach? There is multiple other applications running within the same server-group which should not be affected by this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source