I'm trying to get the code coverage with integration test, which is the JUnit test run with WLP server. I have to attach the Jacoco agent to the WLP JVM to get the right coverage.Unfortunately, the customized Ant task of WLP doesn't provide a place to set the JVM options.
<taskdef resource="com/ibm/websphere/wlp/ant/antlib.xml" format="xml">
<classpath path="${liberty.server.wlp.dir}/dev/tools/ant/wlp-anttasks.jar"/>
</taskdef>
<server installDir="${liberty.server.wlp.dir}" operation="start" serverName="${
liberty.server.name}" />
So I have to hijack the server.bat under my WLP directory and change the JVM options as below:
set JVM_OPTIONS=-javaagent:C:\wa_devops\bssendpoint\lib\build\jacocoagent.jar=destfile=C:\wa_devops\bssendpoint\target\jacoco-integration.exec
Then I get the right coverage. But I don't like to do this way. Is there a better way to specify the JVM options in the build.xml?