Introduction
To improve the productivity of development, you can take advantage of the auto deployment in JBoss AS. You can check your work immediately after code changes.
In this article, I will demonstrate how to configure the JBoss AS 7.1 for the auto deployment. Since JBoss AS 7.0 release, the server architecture has been changed, including deployment configuration and location. So the following steps won't work on the previous major versions.
JBoss has two types of servers, standalone and domain. In this article, I will use the standalone server as an example.
Standalone Server
In the standalone server, the configuration file is in standalone/configuration/standalone.xml. The application will be deployed to standalone/deployements folder. The JBoss will create a folder called YourApplicationName.war for a Java Dynamic Web application.
To understand the above structure is important as the configuration is changed based on that theory.
Configuration Change
I assume you have already created a JBoss 7.1 server in Eclipse. If you don't know how to do so, please check the JBoss Eclipse Plugin section at the end of this article.
Before going into the configuration change, you need to change your WebContent folder to YourApplicationName.war, ie. helloWorldApp.war (helloWorldApp is the project name).
Now expand your JBoss server in the Server tab in eclipse, you will see XML Configuration, expand that, you will see JBoss Management. Double click "JBoss Management", it will open the configuraiton file standalone.xml which is copied from the main one in the JBoss installation directory.
Then search for deployment-scanner XML tag in the standalone.xml file. You will see the default deployment path in the path attribute and its relative parent directory in relative-to attribute. Now do the following:
*Change the path to your absolute project path, ie: c:/workspace/helloWorldApp.
*Remove relative-to attritute and its value.
*Add attribute auto-deploy-exploded="true".
After the above change, it should look like the following configuration.
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0" >
deployment-scanner name="default" path="c:\workspaces\helloWorldApp" scan-enabled="true" scan-interval="5000" auto-deploy-exploded="true" deployment-timeout="60" />
</subsystem>
You now can restart your server and enjoy the deployment on the fly for your development.
JBoss Eclipse Plugin
The eclipse update url for indigo Eclipse is: http://download.jboss.org/jbosstools/updates/development/indigo/.
There are many plugins offered by JBoss, only select JBossAS plugin under "JBoss Web and Java EE Development"