We have disabled JaCoCo execution reports because they do not work
with SFT correctly. This problem boils down to running the right JVM
with JaCoCo options -- it should not be the surefire JVM, but rather
Karaf we start from it.
Use @{argLine} special handling in surefire to pass the argLine (set by
JaCoCo) as a system property rather than it being a JVM argument.
This does not solve integration with Sonar, as we still need to deal
with the XML report being empty, but it is a start and an example for
others using pax-exam.
JIRA: ODLPARENT-274
Change-Id: I9b33e5b5c9b3b3b2b347f4f4ef034acb677d501a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
// Install SCR
features(maven().groupId("org.apache.karaf.features").artifactId("standard").type("xml")
.classifier("features").versionAsInProject(), "scr"),
+
+ // Enable JaCoCo, if present
+ jacocoOption(),
};
if (JavaVersionUtil.getMajorVersion() <= 8) {
new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*"));
}
+ private static Option jacocoOption() {
+ final String sftArgLine = System.getProperty("sftArgLine");
+ return sftArgLine == null || sftArgLine.isBlank() ? null : new VMOption(sftArgLine);
+ }
+
private static String getNewJFRFile() throws IOException {
return File.createTempFile("SingleFeatureTest-Karaf-JavaFlightRecorder", ".jfr").getAbsolutePath();
}
</additionalClasspathElements>
<skip>${skip.karaf.featureTest}</skip>
<systemPropertyVariables>
- <!-- Use the same repository for Pax Exam as is used for Maven -->
- <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}</org.ops4j.pax.url.mvn.localRepository>
+ <!-- Use the same repository for Pax Exam as is used for Maven -->
+ <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}</org.ops4j.pax.url.mvn.localRepository>
</systemPropertyVariables>
+
+ <!-- Disable argLine if present, but pass it to SFT -->
+ <argLine>-DsftArgLine='@{argLine}'</argLine>
</configuration>
<executions>
<execution>