Hi,

I am running into issues with JaCoCo in NB 11. It was working well in NB 10.

The problem is the following, it got introduced by NETBEANS-1768
<https://issues.apache.org/jira/browse/NETBEANS-1768> - "CodeCoverage
doesn't work when custom outputDirectory is used in a PluginExecution":

In the change done
<https://github.com/apache/netbeans/pull/1046/commits/174be96a61c8199950d0417929d0e44eb71523db>,
it is tested if the predetermined JaCoCo output directory exists. If it
doesn't exist, the outputDirectory variable is overwritten by the
outputDirectory configuration of the JaCoCo report goal. However, if this
is not defined, the outputDirectory variable becomes null. As a result, the
file is being watched via FileChangeAdapter becomes  C:\Program
Files\NetBeans 11.0\bin\jacoco.xml, or similar.

Now, often the Maven target directory, or at least the JaCoCo output
directory, doesn't exist yet when the Code Coverage report is opened. Due
to the issue described above, NB doesn't detect when jacoco.xml becomes
available and claims that there is no data yet.

As per my understanding NETBEANS-1768 was fixed incorrectly. The fix should
have been only to change line 128:
outputDirectory = PluginPropertyUtils.getPluginProperty(p, GROUP_JOCOCO,
ARTIFACT_JOCOCO, "outputDirectory", null, null);
to
outputDirectory = PluginPropertyUtils.getPluginProperty(p, GROUP_JOCOCO,
ARTIFACT_JOCOCO, "outputDirectory", "report", null);

As a result, the outputDirectory setting will be taken from the report goal
level but it will still picked up correctly if the plug configuration is
done at plugin level for example.

I have commented about this issue at NETBEANS-1997
<https://issues.apache.org/jira/browse/NETBEANS-1997>, which was reopened
by someone else. Possibly it would be better to create a new ticket. JaCoCo
0.8.3 is working well for me after applying the above change.

Cheers,
Mark

Reply via email to