Phani Kumar wrote:
I removed <pathelement path="${c:\junit4.5\junit-4.5.jar}"/> from <JUnit>
target and test runs fine, i got result.xml file .. but could not able to
get the reports.. is there anything wrong in this report Target code?
i have put the jar file outside of Ant\lib still getting same result
i am using jdk 15 and Ant 1.7, installed xalan also

Try using JDK 1.6. Run ant -diagnostics after this to make sure ant picking 1.6 version and that Xalan implementation is also picked from Sun JDK.
below is the result of my build.xml also u can find the latest build.xml

C:\Test1>ant -f build.xml
Buildfile: build.xml

init:
    [mkdir] Created dir: C:\Test1\build
    [mkdir] Created dir: C:\Test1\reports
    [mkdir] Created dir: C:\Test1\reports\html

compile:
    [javac] Compiling 1 source file to C:\Test1\build

test:
    [junit] Running NewTest
    [junit] Testsuite: NewTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec

    [junit] Testcase: testNew took 66.468 sec

report:

BUILD FAILED
java.lang.NoSuchMethodError:
org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V

Total time: 1 minute 25 seconds
C:\Test1>

build.xml
======

<project name="MyProject" default="report" basedir=".">
  <description> simple example build file </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="reports" location="reports"/>
  <property name="html" location="${reports}/html"/>

    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${src}"/>
    <mkdir dir="${reports}"/>
    <mkdir dir="${reports}/html"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

<target name="test" depends="compile"
        description="runs all junit test cases" >
<!-- Runs .class files from ${build} -->
    <junit printsummary="yes" haltonfailure="yes">
  <classpath>
    <pathelement location="${build}"/>
  </classpath>
  <formatter type="plain" usefile="false"/>
   <test name="NewTest" haltonfailure="no" outfile="result"
todir="${reports}">
    <formatter type="xml"/>
  </test>
</junit>
</target>

<target name="report" depends="test"
        description="Generates JUnit HTML report" >
        <junitreport todir="${reports}">
        <fileset dir="${reports}">
            <include name="*Test-*.xml"/>
        </fileset>
      <!-- <report format="frames" todir="${html}"/> -->
      <report format="noframes"
styledir="org\apache\tools\ant\taskdefs\optional\junit\xsl"/>
    </junitreport>
    </target>


  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>


On Fri, Dec 12, 2008 at 4:25 PM, Mark Salter <marksal...@talktalk.net>wrote:

Phani Kumar wrote:

I am trying to generate html report through ant build.xml file, in that
process i am able to run my test successfully but it fails to generate
html
report and it giving me error "java.lang.NoSuchMe
thodError:org.apache.tools. ant.types. resources. Resources.
dieOnCircularRef erence()V"
This looks to me that you have a circular reference somewhere in your
processing.
i am giving my build.xml file below.. please let me know where did i went
wrong..and with what changes it works successfully
Which task is failing please?

    <pathelement path="${c:\junit4.5\junit-4.5.jar}"/>
Using ${ to indicate a variable when an absolute path is given looks
very odd to me, but could it cause this problem?

So more people can consider helping...

...Could you post:-
- the full stack trace (copy/paste),
- any messages issued by ant - there must be some?


Also take a look at the verbose output from ant -verbose, you might find
something useful there.

You might also - if you have a spare second - take a quick look at :-

       
www.catb.org/~esr/faqs/smart-questions.html<http://www.catb.org/%7Eesr/faqs/smart-questions.html>

As you have already spent time on this over the last two weeks, it is
probably worth spending a bit more so you can pose a smart question,
which may in turn get you the answer you need.

--
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to