Should have also mentioned I'm using Ant 1.6.5 with JDK 1.4.2_10 -----Original Message----- From: David Corley (AT/LMI) [mailto:[EMAIL PROTECTED] Sent: 22 September 2006 14:11 To: Ant Users List Subject: "java.lang.ClassCastException: org.apache.tools.ant.types.Path" error after using <ant> task within ant
I have a situation where I have a common core build.xml for many users, with an optional junit-setup.xml build file called by ant if the user sets a particular property, junit.setup.required. The junit-setup file is a standard file of the ant build.xml format, and contains two empty, predefined targets called "post", and "pre" If the user sets the junit.setup.required property in their properties file, then ant will call the junit-setup build file and run the "pre" target, then return control to the core build.xml and run junit, before jumping back out to the junit-setup.xml and running the "post" target. Now when I remove the junit.setup.required, the junit tasks run. When I turn the property on, Ant runs, jumps out to the junit-setup.xml file and runs the "pre" target, but when it returns to carry out the junit task, I get the following error: ======================================================================== =================================================================== pre-junit: Project base dir set to: C:\tools\ebldtool\PROJ [ant] calling target(s) [pre] in build file C:\tools\ebldtool\PROJ\AM\R5-junit-setup.xml parsing buildfile C:\tools\ebldtool\PROJ\AM\R5-junit-setup.xml with URI = file:///C:/tools/ebldtool/PROJ/AM/R5-junit-setup.xml Project base dir set to: C:\tools\ebldtool\PROJ [ant] Entering C:\tools\ebldtool\PROJ\AM\R5-junit-setup.xml... Build sequence for target(s) `pre' is [pre] Complete build sequence is [pre, post, ] pre: [echo] Pre jnuit... [ant] Exiting C:\tools\ebldtool\PROJ\AM\R5-junit-setup.xml. junit: [copy] Copying 1 file to C:\tmp\ebldtool\edecrya\20060922\AM\DUMMY\reports\junit [copy] Copying C:\tools\ebldtool\DUMMY\TESTS-TestSuites.xml to C:\tmp\ebldtool\edecrya\20060922\AM\DUMMY\reports\junit\TESTS-TestSuites .xml [echo] Running JUnit Tests... BUILD FAILED C:\tools\ebldtool\PROJ\build.xml:1460: java.lang.ClassCastException: org.apache.tools.ant.types.Path at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut or.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Caused by: java.lang.ClassCastException: org.apache.tools.ant.types.Path at org.apache.tools.ant.taskdefs.MacroInstance.copy(MacroInstance.java:273) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:3 75) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 10 more --- Nested Exception --- java.lang.ClassCastException: org.apache.tools.ant.types.Path at org.apache.tools.ant.taskdefs.MacroInstance.copy(MacroInstance.java:273) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:3 75) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut or.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Press any key to continue . . . ======================================================================== ====================================================================== I neither understand the error nor why it's happening. I know the junit properties and classpath are correctly set, as they work when I don't jump to the external file. I'm guessing it's a bug in Ant? /Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]