9.7. Deployment Descriptor Overrides

A new feature in EAP 6.1.x allows you to override deployment descriptors at runtime. A deployment overlay represents a ruleset of files that must be overriden in the archive. It also provides links to the new files that must be used instead of the overriden ones. If the file being overridden is not present in the deployment archive, it will be added back to the deployment.

Procedure 9.15. Override the deployment descriptor using the Management CLI

The following steps assume that you already have a deployed application called app.war and you wish to override it's WEB-INF/web.xml file with another web.xml file located in /home/user/web.xml.
  1. Add a deployment overlay and add content to it. You can achieve this in the following two ways:
    • Using DMR tree

      1. /deployment-overlay=myoverlay:add
      2. /deployment-overlay=myoverlay/content=WEB-INF\/web.xml:add(content={url=file:///home/user/web.xml})
        If you wish to, you may add more content rules using the second statement.
    • Using convenience methods

      deployment-overlay add --name=myoverlay --content=WEB-INF/web.xml=/home/user/web.xml
  2. Link the overlay to a deployment archive

    • deployment-overlay link --name=myoverlay --deployments=app.war
      You may specify multiple archive names separated by commas.
    • /deployment-overlay=myoverlay/deployment=app.war:add
      Note that the deployment archive name need not exist on the server yet. You are specifying the name, but not linking it to an actual deployment yet.
  3. Re-deploy the application

    /deployment=app.war:redeploy