try {
if (rootDir != null)
- System.setProperty(AntConstants.ROOT_DIR_PROPERTY, rootDir
- .getURL().toString());
+ setSystemPropertyForRes(AntConstants.ROOT_DIR_PROPERTY, rootDir);
if (confDir != null)
- System.setProperty(AntConstants.CONF_DIR_PROPERTY, confDir
- .getURL().toString());
+ setSystemPropertyForRes(AntConstants.CONF_DIR_PROPERTY, confDir);
if (workDir != null)
System.setProperty(AntConstants.WORK_DIR_PROPERTY, workDir
.getCanonicalPath());
IOUtils.closeQuietly(in);
}
- for (String key : slcProperties.stringPropertyNames()) {
+ for (Object obj : slcProperties.keySet()) {
+ String key = obj.toString();
if (!System.getProperties().containsKey(key)) {
String value = SystemPropertyUtils
.resolvePlaceholders(slcProperties
}
}
+ /**
+ * Set property as an absolute file path if the resource can be located on
+ * the file system, or as an url.
+ */
+ private void setSystemPropertyForRes(String key, Resource res)
+ throws IOException {
+ String value = null;
+ try {
+ value = res.getFile().getCanonicalPath();
+ } catch (IOException e) {
+ value = res.getURL().toString();
+ }
+ System.setProperty(key, value);
+ }
+
protected ConfigurableApplicationContext createExecutionContext(
SlcExecution slcExecution) {
try {
String runtimeStr = slcExecution.getAttributes().get(
AntConstants.EXECATTR_RUNTIME);
if (runtimeStr == null)
- runtimeStr = "default";
+ runtimeStr = System.getProperty(AntConstants.RUNTIME_PROPERTY,
+ "default");
ResourceLoader rl = new DefaultResourceLoader(getClass()
.getClassLoader());