我有 Maven JMeter 项目,它使用“mvn verify”从我的主文件夹完美运行,但是当我尝试从 Jenkins 运行它时,我收到错误消息到控制台:
[workspace] $ mvn verify FATAL: command execution failed java.io.IOException: Cannot run program "mvn" (in directory "/var/lib/jenkins/jobs/PerformanceTests/workspace"): error=2, No such
文件或目录”
如果我尝试从 Jenkins 尝试运行它的文件夹(/var/lib/jenkins/jobs/PerformanceTests/workspace)手动运行“mvn verify”,我会收到错误消息:
无法在项目 jmeter 上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test):创建用于分叉的属性文件时出错;嵌套异常是 java.io.IOException: No such file or directory -> [Help 1]
我的pom是:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>perftest</groupId>
<artifactId>jmeter</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jmeter</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.8.1</version>
<configuration>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
同一 Jenkins 基本文件夹“/var/lib/jenkins/jobs”中的所有其他作业都运行良好。我还在 Jenkins 中使用 git 插件。