Tôi đang cố gắng tạo ANT báo cáo HTML về thử nghiệm JUNIT trong Eclipse nhưng sau khi tạo bản xây dựng ANT, tôi nhận được các lỗi sau khi tôi chạy nó:Lỗi! Đối số đầu tiên cho hàm Java không tĩnh 'thay thế' không phải là tham chiếu đối tượng hợp lệ
[junitreport] Processing C:\Documents and Settings\Administrator\workspace\Home\junit\TESTS-TestSuites.xml to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\null785926900
[junitreport] Loading stylesheet jar:file:/C:/ANT/apache-ant-1.8.3/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process C:\Documents and Settings\Administrator\workspace\Home\junit\TESTS-TestSuites.xml
Tôi cần phải làm gì để khắc phục sự cố này?
Dưới đây là các phần của build.xml của tôi, tôi đang cố gắng để chạy:
<target name="Home">
<mkdir dir="${junit.output.dir}"/>
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="Home" todir="${junit.output.dir}"/>
<classpath refid="Home.classpath"/>
</junit>
</target>
<target name="junitreport">
<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.output.dir}"/>
</junitreport>
</target>
Thứ hai, làm thế nào chúng ta nên biết gì sai nếu bạn không gửi mã không? –
Sau khi chỉ xây dựng ANT cho JDK thay vì JRE, tôi đã có thể nhận được báo cáo HTML. – user1397000
Bạn đã xây dựng ANT như thế nào cho JDK thay vì JRE ??? –