Maven error in Jenkins JMeter project, "Error creating properties files for forking"

4.2k views Asked by At

I have Maven JMeter project which runs perfectly from my home folder using "mvn verify", but when I try to run it from Jenkins I get error message to console:

[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

file or directory"

If I try to run "mvn verify" manually from folder where Jenkins tries to run it (/var/lib/jenkins/jobs/PerformanceTests/workspace), I get error message:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project jmeter: Error creating properties files for forking; nested exception is java.io.IOException: No such file or directory -> [Help 1]

My pom is:

<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>

All other jobs in the same Jenkins base folder "/var/lib/jenkins/jobs" are working fine. I also use git plugin with Jenkins.

4

There are 4 answers

1
BPilgrim On

John, I just ran into this exact problem. I'm not 100% sure on the reason, but I was unable to get this to work when I created a standard Jenkins job and added a Maven build step. However, when I created a Maven project (currently called "Build a maven2/3 project" in the Jenkins New Job setup menu, Jenkins version 1.541), it worked just fine. Give that a try if you're still having a problem (though I know your question is a little old now).

Cheers.

0
Ravi Amlani On

Though it is too late to answer but still if it can be useful to someone. Just to answer your first error code block, Jenkins doesn't accept "mvn" as part of the command when trying to execute a Maven Job. Just pass your goals like, clean verify

0
AudioBubble On

If anyone's still struggling with this - I was able to solve it by changing owner of the directory to the current username, instead of root.

0
Amir Fo On

For me, the problem was the disk size! I removed a big file (nohup.out), it worked.