-
1. Re: Developing w/ Ant, JSP, JBoss
luke_t Jan 2, 2002 3:37 PM (in response to wpfeiffe)Hi,
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 :).
Luke. -
2. Re: Developing w/ Ant, JSP, JBoss
wpfeiffe Jan 2, 2002 10:01 PM (in response to wpfeiffe)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.
-
3. Re: Developing w/ Ant, JSP, JBoss
nexux Sep 19, 2002 6:27 AM (in response to wpfeiffe)Hi,
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)
-js.jar (http://www.mozilla.org/rhino/)
bsf.jar and js.jar must be in your ant classpath.
Add a target and use the following javascript in your ant build.xml to just copy the jsps to the deployed directory. You can easily guess how it works and add more enhanced functionality to your ant build scripts.
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:
<![CDATA[
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++)
{
if (oDirs.startsWith("web"))
oWebDir = oDirs;
}
oCopyDir = new java.io.File(jbosshome + "/tmp/deploy/Default/" + projectearfile + "/" + oWebDir + "/jsp");
oMsg = StandardBuild.createTask("echo");
oMsg.setMessage("Copying to : " + oCopyDir.toString());
oMsg.execute();
oFileset = copyjspFileset.clone();
copyjsp1 = StandardBuild.createTask("copy");
copyjsp1.setVerbose(true);
copyjsp1.setOverwrite(true);
copyjsp1.addFileset(oFileset);
copyjsp1.setTodir(oCopyDir);
copyjsp1.execute();
]]>