Sure guys sorry. I've just tried running the code with Ant 1.7 beta2 and
the error remains.

The core build.xml contains the following (relevant) code:
===================================
<target name="pre-junit" description="Runs the optional junt-setup ant
script" if="junit.setup.required">
        <ant inheritAll="true" inheritRefs="true"
antfile="${ebldtool.dir}/PROJ/${proj.name}/junit-setup.xml"
target="pre"/>
</target> 

....
....
....


<target name="clover-junit" depends="clover-compile,pre-junit"
if="use.clover">
                <echo message="Copying all non-(.java/.class) files from
source to bin directory should they be needed by JUnit..."/>
                                
                <macrodef name="subproj.unittest">
                        <attribute name="subproj.junit.name" />
                        <attribute name="subproj.junit.classpath" />
                        <attribute name="subproj.junit.jvmargs" />
                        <attribute name="subproj.junit.include" />
                        <attribute name="subproj.junit.exclude" />
                        
                        <sequential>
                                <echo message="Starting JUnit Testing on
@{subproj.junit.name}..." />                    
                                <path id="clover.junit.classpath">
                                        <path
refid="@{subproj.junit.classpath}" />
                                        <path
location="${clover.dir}/lib/clover.jar"/>
                                </path>
                                
                                <junit fork="on"
forkmode="${proj.junit.forkmode}" haltonfailure="false"
printsummary="withOutAndErr" showoutput="false">
                                        <classpath
refid="clover.junit.classpath" />
                                        <jvmarg
line="@{subproj.junit.jvmargs}" />
                                        <formatter type="xml"
usefile="true" />
                        
                                        <batchtest fork="yes"
todir="${output.dir}/@{subproj.junit.name}/reports/junit">
                                                <fileset
dir="${output.dir}/@{subproj.junit.name}/bin/test">
                                                        <!--Classes that
will be included to run the tests-->
                                                        <include
name="@{subproj.junit.include}" />
                                                        <!--Classes that
will be exlcuded from the tests-->
                                                        <exclude
name="@{subproj.junit.exclude}" />
                                                </fileset>
                                        </batchtest>
                                </junit>
                        </sequential>
                </macrodef>
        
                <copy file="${dummy.dir}/TESTS-TestSuites.xml"
tofile="${output.dir}/DUMMY/reports/junit/TESTS-TestSuites.xml" />
                <echo message="Running JUnit Tests..."/>
                <subproj.unittest
subproj.junit.name="${proj.compile.1st.name}" 
        
subproj.junit.classpath="proj.junit.1st.classpath" 
        
subproj.junit.jvmargs="${proj.junit.1st.jvmargs}" 
        
subproj.junit.include="${proj.junit.1st.include}" 
        
subproj.junit.exclude="${proj.junit.1st.exclude}" />
                <subproj.unittest
subproj.junit.name="${proj.compile.2nd.name}" 
        
subproj.junit.classpath="proj.junit.2nd.classpath" 
        
subproj.junit.jvmargs="${proj.junit.2nd.jvmargs}" 
        
subproj.junit.include="${proj.junit.2nd.include}" 
        
subproj.junit.exclude="${proj.junit.2nd.exclude}" />
                <subproj.unittest
subproj.junit.name="${proj.compile.3rd.name}" 
        
subproj.junit.classpath="proj.junit.3rd.classpath" 
        
subproj.junit.jvmargs="${proj.junit.3rd.jvmargs}" 
        
subproj.junit.include="${proj.junit.3rd.include}" 
        
subproj.junit.exclude="${proj.junit.3rd.exclude}" />
        

                <macrodef name="subproj.test.report">
                        <attribute name="subproj.junit.report.name" />
                        <sequential>
                                <echo message="Generating JUnit reports
for @{subproj.junit.report.name}..." />
                                <junitreport
todir="${output.dir}/@{subproj.junit.report.name}/reports/junit">
                                        <fileset
dir="${output.dir}/@{subproj.junit.report.name}/reports/junit">
                                                <include name="*.xml" />
                                        </fileset>
                                        <report format="frames"
todir="${output.dir}/@{subproj.junit.report.name}/reports/junit/html" />
                                </junitreport>
                        </sequential>
                </macrodef>
                
                <echo message="Generating JUnit reports for each
sub-project..."/>
                <subproj.test.report
subproj.junit.report.name="${proj.compile.1st.name}" />
                <subproj.test.report
subproj.junit.report.name="${proj.compile.2nd.name}" />
                <subproj.test.report
subproj.junit.report.name="${proj.compile.3rd.name}" />
                
                <!--The following section consolidates all of the
subcomponent JUnit test results together to generate an "overall"
report.-->
                <echo message="Combining individual sub-project JUnit
reports into an overall report..."/>
                <junitreport todir="${output.dir}/OverallJunit">
                        <fileset
dir="${output.dir}/${proj.compile.1st.name}/reports/junit">
                                <include name="*.xml" />
                        </fileset>
                        <fileset
dir="${output.dir}/${proj.compile.2nd.name}/reports/junit">
                                <include name="*.xml" />
                        </fileset>
                        <fileset
dir="${output.dir}/${proj.compile.3rd.name}/reports/junit">
                                <include name="*.xml" />
                        </fileset>
                        
                        <report format="frames"
todir="${output.dir}/OverallJunit" />
                </junitreport>
                <antcall target="post-junit"/>
        </target>

....
....
....

<target name="post-junit" description="Runs the optional junt-setup ant
script" if="junit.setup.required">
        <ant inheritAll="true" inheritRefs="true"
antfile="${ebldtool.dir}/PROJ/${proj.name}/junit-setup.xml"
target="post"/>
</target>
========================================================================
==========================================
The junit-setup.xml contains the following:
========================================================================
==========================================
<?xml version="1.0" encoding="UTF-8"?>
        <project name="junit-setup">
        <!--This entire file can be almost completely controlled by each
user as long as the "pre" and "post" targets are present.--> 
        <!--Every property and classpath that ebldtool already uses can
also be used in this file-->
        <!--Its main purpose is to provide users with a means of kicking
off live servers/mc's with which to run their unit tests against.-->
        <!--While the unit tests themselves are run by ebldtool,
everything that happens right up to,and directly after them, can be
specified here.-->
        <!--This file is only examined and its targets run if the user
has the junit.setup.required property set to "true" in their
build.properties file.-->
                
                <target name="pre" depends="" description="this is the
target that ebldtool looks to for instructions to carry out before
running unit tests">
                <echo message="pre-junit"
                </target>
                
                <target name="post" depends="" description="this is the
target that ebldtool looks to for instructions to carry out before
running unit tests">
                </target>
                
        </project>
========================================================================
==========================================

I know that the properties being passed to junit are ok, because when I
bypass the call to the external junit-setup file, junit proceeds as
normal. So it's literally running the <ant> task in the <pre-junit> and
<post-junit> targets in the core build.xml snippets above that causes
the problem.

/Dave



-----Original Message-----
From: Dominique Devienne [mailto:[EMAIL PROTECTED] 
Sent: 22 September 2006 14:15
To: Ant Users List
Subject: Re: "java.lang.ClassCastException:
org.apache.tools.ant.types.Path" error after using <ant> task within ant

On 9/22/06, David Corley (AT/LMI) <[EMAIL PROTECTED]> wrote:
> 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"

Please share the relevant excerpts of yours builds. Thanks, --DD

---------------------------------------------------------------------
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]

Reply via email to