+\r
+ /** Executes all paths of the provided target of the Ant URL. */\r
+ public static Project runAll(URL url, String target, Properties properties) {\r
+ if (log.isDebugEnabled())\r
+ log.debug("Runs all paths of Ant URL " + url);\r
+ Project p = new Project();\r
+ p.setUserProperty("ant.file", url.toString());\r
+ // p.setBaseDir(url.toString());\r
+ p.init();\r
+ ProjectHelper helper = new SlcProjectHelper();\r
+ p.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);\r
+ helper.parse(p, url);\r
+\r
+ if (properties != null) {\r
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {\r
+ p.setUserProperty(entry.getKey().toString(), entry.getValue()\r
+ .toString());\r
+ }\r
+ }\r
+\r
+ runProject(p, target);\r
+ return p;\r
+ }\r
+\r
+ /** Executes all paths of the default target of the Ant file. */\r
+ public static Project runAll(File antFile) {\r
+ return runAll(antFile, null);\r
+ }\r
+\r
+ protected static void runProject(Project p, String target) {\r
+ p.fireBuildStarted();\r
+ Throwable exception = null;\r
+ try {\r
+ p.executeTarget(target != null ? target : p.getDefaultTarget());\r
+ } catch (Throwable e) {\r
+ exception = e;\r
+ } finally {\r
+ p.fireBuildFinished(exception);\r
+ }\r
+ }\r