I think I posted something like this in the security section recently: I've never found a decent solution other than setting up an external instance of Tomcat 4 on a different port, with a web-app context set up which points to your development area. This isn't too inconvenient as long as you don't have to setup security as well.
Re-deploying the whole app while you're working on the presentation layer isn't very satisfactory in any case, as you loose the session state of the current user. If you're only modifying jsps, tomcat recompiles, you reload and only the layout will change.
If you come up with a better solution let me know :).
Is there a way to query JBoss, via code, as to where a given war application has been deployed to? Perhaps an Ant task can be written to do this.
One way to copy your JSPs (or any other presentation files like images) when working with jboss (tested with version 2.4.6) is to proceed as follows:
You will need:
- Ant 1.5
- bsf.jar (http://www-124.ibm.com/developerworks/projects/bsf)
bsf.jar and js.jar must be in your ant classpath.
In this script, I am copying .jsp and .inc files as found in the includes.
The ant script below is self explanatory. It just contains a lot of properties which contains the actual values for the directories and so on.
Hope it helps:
jbosshome = StandardBuild.getProperty("jboss2.jboss.home");
projectearfile = StandardBuild.getProperty("ear-war.jar.filename");
oDir = new java.io.File(jbosshome + "/tmp/deploy/Default/" + projectearfile);
oDirs = oDir.list();
for (i=0; i < oDirs.length; i++)
oWebDir = oDirs;
oCopyDir = new java.io.File(jbosshome + "/tmp/deploy/Default/" + projectearfile + "/" + oWebDir + "/jsp");
oMsg = StandardBuild.createTask("echo");
oMsg.setMessage("Copying to : " + oCopyDir.toString());
oFileset = copyjspFileset.clone();
copyjsp1 = StandardBuild.createTask("copy");