Managing exploded deployments in WildFly

An exploded deployment is an application which is not packaged in a .war, .ear or .jar file but it’s contained in a directory using these extensions (.ear, .war, etc.).

Exploded deployments are not deployed by default by WildFly. If a directory with a standard extension (.ear, .war, etc.) is placed in the deployments directory, a log message like this will be emitted:

11:21:18,021 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found demo.war in deployment directory. To trigger deployment create a file called demo.war.dodeploy

So, by default, you have to add a file named <applicationname>.dodeploy into the deployments folder to trigger the exploded deployment.

$ touch ./standalone/deployments/demo.war.dodeploy

Configuring the Deployment Scanner to auto-deploy Exploded Deployments

In order to enable automatically the scanner to deploy exploded deployments, configure it setting the auto-deploy-exploded attribute to true as follows:

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
    <deployment-scanner path="deployments" 
                        relative-to="jboss.server.base.dir" 
                        scan-interval="5000" 
                        auto-deploy-exploded="true"/>
</subsystem>

Once configured, the deployment scanner will pick up and deploy exploded applications.

How to explode the application from WildFly CLI

By using WildFly CLI or Web console, the archive can be expanded in any local directory accessible to the application server, not necessarily under the deployments directory. Let’s see how to explode an application named test.war:

/deployment=test:add(runtime-name="test.war", enabled=true, content=[{"path"=>"/home/jboss/exploded-test-dir.war", "archive"=>false}])

You need to provide appropriate values to the “runtime-name” and the “path” attributes.

  • runtime-name” must end with the same extension as the original artifact. For example, if an WAR is deployed, the runtime name must end in “.war”.
  • path” must contain the absolute path of the exploded directory. As mentioned in the “Explode” the JEE archive section, the name must end with the appropriate JEE extension.

A successful deployment will update the standalone server configuration file with a section similar to:

    <deployments>
        <deployment name="test" runtime-name="test.war">
            <fs-exploded path="/home/jboss/exploded-test-dir.war"/>
        </deployment>
    </deployments>

Exploding a deployment using the web console

Navigate to “Deployments” and select the deployment you want to browse. Then open the context menu and choose Browse Content:

wildfly exploded deployment wildfly exploded deployment

Select Explode to explode the deployment.