0

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!

Shihad Salam
  • 79
  • 2
  • 11
  • The Evosuite plugin needs to be updated to be compatible with Java 11. – Robert Jul 24 '20 at 12:32
  • @Robert Hi Robert, Thanks for your reply. I'm using the latest version of evosuite, 1.0.6 – Shihad Salam Jul 24 '20 at 12:35
  • 1.0.6 was released in Apr 2018 and it seems to to be Java 11 ready. Have you tried to compile the latest version from source? https://github.com/EvoSuite/evosuite – Robert Jul 24 '20 at 12:42
  • The cause could understand if you look for the text *"Could not find artifact com.sun:tools:jar:1.0.0"* in the Q&As. – Naman Jul 24 '20 at 12:52
  • @Naman - I tried researching forums using the same text, but couldn't find a valid post for Java 11. There are issues with previous version, where they have manually added the dependency for tools.jar. That's not the case with Java 11 as tools.jar is removed here. Please provide valid reference posts if you find some. Thanks! – Shihad Salam Jul 24 '20 at 12:58
  • @Robert Yes, I tried with the latest from source as you mentioned, still no help :( One thing I noted in the evosuite source is that there is dependency management for tools.jar. Not sure if they are still referring it in java_home/lib/tools.jar ```` com.sun tools 1.0.0 ${java.home}/lib/tools.jar ```` – Shihad Salam Jul 24 '20 at 13:44

1 Answers1

1

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

Jack Johns
  • 59
  • 7