jmeter+ant执行报错,求大神指点

jmeter+ant运行报错:

BUILD FAILED
/Users/chenjiawei/Downloads/apache-ant-1.10.6/report/concise/build.xml:19: The following error occurred while executing this line:
/Users/chenjiawei/Downloads/apache-ant-1.10.6/report/concise/build.xml:23: taskdef class org.programmerplanet.ant.taskdefs.jmeter.JMeterTask cannot be found
using the classloader AntClassLoader[]

报错截图:

图片说明

网上说把jmeter/extras目录下的ant-jmeter-1.1.1.jar复制到ant/lib目录下就行了,可是我试了还是不行,报同样的错,我换其他的jar包也不行,求各位大神支招

我的build.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<project name="ant-jmeter-test" default="run" basedir=".">
<tstamp>
<format property="time" pattern="yyyyMMddhhmm" />
</tstamp>
<!-- 需要改成自己本地的 Jmeter 目录-->
<property name="jmeter.home" value="/Users/chenjiawei/Downloads/apache-jmeter-5.1.2.1/extras" />
<!-- jmeter生成jtl格式的结果报告的路径-->
<property name="jmeter.result.jtl.dir" value="/Users/chenjiawei/Downloads/apache-ant-1.10.6/resultLog/jtl" />
<!-- jmeter生成html格式的结果报告的路径-->
<property name="jmeter.result.html.dir" value="/Users/chenjiawei/Downloads/apache-ant-1.10.6/resultLog/html" />
<!-- 生成的报告的前缀-->
<property name="ReportName" value="TestReport" />
<property name="jmeter.result.jtlName" value="${jmeter.result.jtl.dir}/${ReportName}${time}.jtl" />
<property name="jmeter.result.htmlName" value="${jmeter.result.html.dir}/${ReportName}${time}.html" />

<target name="run">
    <antcall target="test" />
    <antcall target="report" />
</target>
<target name="test">
    <taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
    <jmeter jmeterhome="${jmeter.home}" resultlog="${jmeter.result.jtlName}">
         <!-- 声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本-->
        <testplans dir="/Users/chenjiawei/Downloads/apache-jmeter-5.1.2.1/test" includes="baidu.jmx" />
        <property name="jmeter.save.saveservice.output_format" value="xml"/>
    </jmeter>
</target>

<path id="xslt.classpath">
    <fileset dir="${jmeter.home}/lib" includes="xalan*.jar"/>
    <fileset dir="${jmeter.home}/lib" includes="serializer*.jar"/>
</path> 

<target name="report">
    <tstamp><format property="report.datestamp" pattern="yyyy/MM/dd HH:mm"/></tstamp>
    <xslt 
          classpathref="xslt.classpath"
          force="true"
          in="${jmeter.result.jtlName}"
          out="${jmeter.result.htmlName}"
          style="${jmeter.home}/extras/jmeter-results-detail-report_21.xsl" >
          <param name="dateReport" expression="${report.datestamp}"/>
    </xslt>
            <!-- 因为上面生成报告的时候,不会将相关的图片也一起拷贝至目标目录,所以,需要手动拷贝 --> 
    <copy todir="${jmeter.result.html.dir}">
        <fileset dir="${jmeter.home}/extras">
            <include name="collapse.png" />
            <include name="expand.png" />
        </fileset>
    </copy>
</target>

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐