maven: reports do not generate correctly after a clean
Brought to you by:
vlad_r
As far as I can tell, the maven reports will not
generate correctly if run immediately after a clean.
No idea why this is happening. Here is an example of
the output:
emma:realreport:
[echo] Checking for coverage stats files (*.e*) at
D:\projects\emma-plugin-maventesting/target/emma-out
[echo] Reading coverage results files from
D:\projects\emma-plugin-maventesting/target/emma-out
[echo] EMMA Source Path:
D:\projects\emma-plugin-maventesting\src\main;D:\projects\emma-plugin-maventesting\src\test
processing input files ...
2 file(s) read and merged in 62 ms
nothing to do: no runtime coverage data found in any of
the data files
Logged In: YES
user_id=447346
This can be recreated with the current code in the maven
testing project, by executing the following:
1. maven clean
2. maven site (first run after clean fails to generate maven
report)
3. maven site (successfully generates maven report)
4. maven site (successfully generates maven report)
5. etc.
Logged In: YES
user_id=1013207
Based on this trace, I would say that two files are
definitely being read. However, neither one appears to
contain coverage data. I can't tell more without having the
files on hand. Could you attach them to this issue?
Also, if EMMA ANT tasks are switched to more verbose tracing
(setting attribute verbosity="verbose") there will be more
useful trace details.
coverage data immediately after a clean
product metadata immediately after a clean
test metadata immediately after a clean
Verbose trace of maven clean and maven site with emma enabled (no emma report generated)
coverage data after doing a clean, site, site
Logged In: YES
user_id=447346
I attached files and ran it with verbosity=trace3 and maven
tracing on. For the verbosity, is this supposed to be a
system property passed on the command line? The plugin
currently invokes emma as a java program, so I'm not sure if
I got the verbosity set correctly. around line 1240 of
maven_emma_plugin_trace.txt is where emma report is invoked.
The "after_clean_" files are the ones generated after
running maven clean then maven site, and no report is
generated (this corresponds to the trace).
The "after_clean_and_site_emma_coverage.ec" is after running
clean then site twice, which DOES generate a report
successfully.
This seems like something obvious, but I'm not getting it.
I need to look at it closely for a while, and I probably
won't have time for that for a few days.
Logged In: YES
user_id=1013207
Ok, although you didn't enable EMMA verbosity properly, I
think the verbose trace from maven gave me the clue:
- there are 3 *.e* files being generated alltogether, two
metadata (product and testing) and one coverage.
- at the time the report tool is run, only two of those
(metadata) exist), hence the "nothing to do" message from
EMMA. If you look into the trace file, the coverage file is
dumped only towards the end.
Remember that EMMA dumps coverage in a JVM exit hook, so if
you didn't fork a JVM for running your app/tests, the
coverage will be dumped when the Maven's own JVM exits,
which is probably not what you want.
Does this help?
Logged In: YES
user_id=447346
That was it - the coverage data didn't get written until
maven exited. I fixed this by:
1) giving a very verbose message if there is no coverage
data when the emma report runs, including instructions on
how to enable forking for tests
2) forcing a forked test run before reporting if there is no
existing coverage data.
This should make it more foolproof :)