JBoss deployment directory configuration
In this tutorial we are going to show how to provide an alternative directory or URL for deploying your JBoss applications. We will show all the possible variants (from the release 4.x to the newer 6.0 release of the AS).
Deploying applications to JBoss is a simple task: all you do to deploy an application in JBoss is dropping the archive into the deploy directory. The JBoss engine immediately inspects the contents of the archive and attempts to deploy the component(s). Undeploying is as easy as deleting the archive from the deploy directory.
Sometimes it can be convenient to deploy your applications in another directory or filesystem. Configuring another deploy directory in JBoss is different from one version to another:
Configuring JBoss deploy directory in 6.0 release
If you are using JBossAS-6, you can define a new deployment directory by adding it to the ProfileService bootstrap process. This will automatically pick up the specified directory and treat it as if you would put the content to the deploy/ folder.
Note that all specified folders need to be fully qualified url. So for example if you want to set the folder /home/user1 as deployment folder, you have to set is as file:///home/user1
So, in order to do that, you would need to edit the JBOSS_HOME/<servername>/conf/bootstrap/profile.xml. Find the UserProfileFactory bean in that file.
Configuring JBoss deploy directory in 5.0 release
JBoss 5.x doesn't use any more the older jboss-service.xml for configuring the deployment directory. Instead, you have to manipulate the server/xxx/conf/bootstrap/profile-repository.xml file.
Search for the SerializableDeploymentRepositoryFactory (about at the beginning of the file).
There, if you want to add for example the "deployments" beneath the JBoss Home, simply add another element in the array:
Configuring JBoss deploy directory in 5.1 release
When using JBoss 5.1 your configuration file will be server/xxxx/conf/bootstrap/profile.xml. Find the Bean named BootstrapProfileFactory and add your deploy folder to the list element:
In this example, we're adding the folder C:/JBossdeploy to the list of scanning directories.
Configuring JBoss deploy directory in 4.x release
The configuration file which we need to modify is server/xxxx/conf/jboss-service.xml
Open it and move almost at the end of the file. There you'll find the following attribute:
This is the list of scanned deployment directories. Supposing you want to add a secondary deployment directory in /var/deploy filesystem, you have to add:
You can even choose to deploy a specific application from a remote repository. For example, if you have a remote server which has a virtual path "deploy" under the Base directory, then you can use this path as repository for deploying your application named myapp.ear: http://www.remoteserver.com/deploy/myapp.ear
Good deployment!

