Just like previous versions (AS5 and AS6), JBoss AS7 allows you to deploy applications from an external deployment folder. i.e. you don't have to place the deployment within the JBoss AS installation directory hierarchy for it to be picked up and deployed by the server. The following sections will explain how you can configure AS7 to look for deployments in an external deployment directory.
Standalone server:
By default, the standalone server looks for deployments in JBOSS_HOME/standalone/deployments folder. In this example, we will configure the AS7 standalone server to additionally pick up deployments from a folder named /home/me/as7/mydeployments.
- Stop the standalone server, if it is already running.
- Open the JBOSS_HOME/standalone/configuration/standalone.xml file in a text editor of your choice
- Look for <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0"> subsystem in that file. You'll notice that it already contains a <deployment-scanner> child element which configures the server to look for deployments in a folder named "deployments" relative-to the jboss.server.base.dir.
- Now let's add a new deployment-scanner which will look for deployments under the folder named /home/me/as7/mydeployments:
<deployment-scanner name="my-external-deployment-scanner" path="/home/jpai/as7/deployments" scan-interval="5000" />
Notice that we have named this deployment-scanner "my-external-deployment-scanner". You can give it a (unique) name of your choice. The "path" points to /home/jpai/as7/deployments folder, which is where we will be placing our deployments. The "scan-interval" is the interval in milliseconds for the scanner thread to run, to check for hot deployment.
- With this addition, the susbsystem section will now look like:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" />
<deployment-scanner name="my-external-deployment-scanner" path="/home/jpai/as7/deployments" scan-interval="5000" />
</subsystem>
- Let's now save the changes in the standalone.xml file and start the standalone server:
jpai@jpai-laptop:bin$./standalone.sh
If you had any deployments in /home/jpai/as7/deployments folder, then you'll notice that the server has picked up those deployments for deploying. Also, if you add any new deployments, to this folder while the server is running, they will be picked up too (unless you configure the deployment scanner to disable hot deployment).
For complete reference on what the deployment-scanner element configuration allows, take a look at the jboss-deployment-scanner.xsd here https://github.com/jbossas/jboss-as/blob/master/deployment-scanner/src/main/resources/schema/jboss-deployment-scanner.xsd