问题描述:构建Jenkins时报如下错误:

Started by user admin
Running as SYSTEM
Building in workspace /root/.jenkins/workspace/Jenkins调Jmeter(Jenkins可查看报告)
[Jenkins调Jmeter(Jenkins可查看报告)] $ /bin/sh -xe /tmp/jenkins3590030547148852689.sh
+ cd /opt/apache-jmeter-5.2.1/bin
+ ./jmeter.sh -n -t /opt/apache-jmeter-5.2.1/bin/jmeterRes/getBaiDu.jmx -l baidu1.jtl -e -o /opt/apache-jmeter-5.2.1/bin/jmeterRes/Report1
An error occurred: Cannot write to '/opt/apache-jmeter-5.2.1/bin/jmeterRes/Report1' as folder is not empty
Build step 'Execute shell' marked build as failure
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /opt/apache-jmeter-5.2.1/ant_demo/resultLog/html to /root/.jenkins/jobs/Jenkins调Jmeter(Jenkins可查看报告)/htmlreports/HTML_20Report
Finished: FAILURE

原因:这是Jenkins的一个bug,查看build的配置参数${BUILD_NUMBER} 没有生效,之前构建生成有.jtl文件,导致再次构建报文件已存在

解决办法:将/opt/apache-jmeter-5.2.1/bin目录下的.jtl文件全部删掉,再次构建,发现构建成功

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐