Evosuite Plugin Issue with Java 11

2k Views Asked by At

I'm facing issues with Evosuite maven plugin (version 1.0.6) when upgrading from Java 8 to Java 11. While running maven build, evosuite test class failed with the error java.lang.ClassNotFoundException Caused by: java.lang.IllegalArgumentException on my Sample_ESTest.java file.

pom.xml

    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>

    <dependency>
        <groupId>org.evosuite</groupId>
        <artifactId>evosuite-standalone-runtime</artifactId>
        <version>1.0.6</version>
        <scope>test</scope>
    </dependency>

        <plugin>
            <groupId>org.evosuite.plugins</groupId>
            <artifactId>evosuite-maven-plugin</artifactId>
            <version>1.0.6</version>
        </plugin>

Sample_ESTest.java

@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) 
public class Sample_ESTest {
...
}

To get more details of the issue, I tried executing evosuite help command (mvn evosuite:help) and got the following error:

Failed to execute goal org.evosuite.plugins:evosuite-maven-plugin:1.0.6:help (default-cli) on project java11-upgrade: Execution default-cli of goal org.evosuite.plugins:evosuite-maven-plugin:1.0.6:help failed: Plugin org.evosuite.plugins:evosuite-maven-plugin:1.0.6 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.0.0 at specified path C:\My_Space\Tools\JDK\jdk-11.0.8/../lib/tools.jar

Error says could not find artifact com.sun:tools:jar:1.0.0, but as per my understanding tools.jar is removed in Java11. Could you please help me in resolving this issue.

Thanks in advance!

1

There are 1 best solutions below

0
On

I don't think 1.0.6 is compatible with Java 11, that would be 1.1.0. Unfortunately, at the time of this answer the maven plugin for 1.1.0 isn't currently available so the next best thing would be to use the .jar files for 1.1.0 found here: https://github.com/EvoSuite/evosuite/releases/tag/v1.1.0