How to set environment variables in maven-surefire-plugin ?
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<CF_IP>127.0.0.1</CF_IP>
</environmentVariables>
</configuration>
The above configuration will set the environment variable “CF_IP” with value “127.0.0.1” and then System.getenv(“CF_IP”) will return “127.0.0.1” for all junits.
What are the possible reasons for the below Jacoco errors:
“java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_f3994fa/Offline”
“java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_f3994fa.Offline”
- The below jacoco agent dependency is missing
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<version>0.8.6</version>
</dependency>
2. Or the jacoco agent runtime dependency (mentioned above) and jacoco-maven-plugin versions doesn’t match. It is a good idea to keep the versions same.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>