jruaux 2003/01/08 08:09:51
Modified: Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher
WarBuilder.java
Log:
Changed user web directory handling
Revision Changes Path
1.5 +18 -7
jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher/WarBuilder.java
Index: WarBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher/WarBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WarBuilder.java 7 Jan 2003 17:31:19 -0000 1.4
+++ WarBuilder.java 8 Jan 2003 16:09:51 -0000 1.5
@@ -171,19 +171,23 @@
}
Vector arguments = new Vector();
String jarFilesPath = jarFilesDir.getAbsolutePath();
+ arguments.add("-Djars.dir=" + jarFilesPath);
String webXMLPath = webXML.getAbsolutePath();
- String webFilesPath = webFilesDir.getAbsolutePath();
+ arguments.add("-Dwebxml.path=" + webXMLPath);
String classFilesPath = classFilesDir.getAbsolutePath();
+ arguments.add("-Dclasses.dir=" + classFilesPath);
String warFilePath = testWar.getAbsolutePath();
arguments.add("-Dwar.path=" + warFilePath);
- arguments.add("-Dwebxml.path=" + webXMLPath);
- arguments.add("-Dclasses.dir=" + classFilesPath);
- arguments.add("-Djars.dir=" + jarFilesPath);
// If a web dir is present in the user's project
- // we add it to the War file
- if (webFilesDir.exists()) {
- arguments.add("-Dwebfiles.dir=" + webFilesPath);
+ // we use it for the War file, otherwise we use a blank one
+ boolean userWebExists = webFilesDir.exists();
+ if (!userWebExists) {
+ String tempPath = System.getProperty("java.io.tmpdir");
+ webFilesDir = new File(tempPath,"web");
+ webFilesDir.mkdir();
}
+ String webFilesPath = webFilesDir.getAbsolutePath();
+ arguments.add("-Dwebfiles.dir=" + webFilesPath);
String[] antArguments = (String[]) arguments.toArray(new String[0]);
AntRunner runner = new AntRunner();
runner.setBuildFileLocation(buildFileLocation.getAbsolutePath());
@@ -191,6 +195,13 @@
String[] targets = { "testwar" };
runner.setExecutionTargets(targets);
runner.run();
+ // Delete the created Web dir, if any.
+ // Could not use deleteOnExit on this dir because the VM launched by
+ // Ant seems to be crashing when shut down by the 'stop' task
+ //
+ if (!userWebExists) {
+ webFilesDir.delete();
+ }
return testWar;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>