Reputation: 806
I've been trying to get this to work for about 1.5 hrs now...
I have Emma running within Jenkins and have Jenkins moving the Emma reports to the artifacts directory so they can be viewed within the Jenkins build. This all works fine except the reports are encoded with ISO-8859-1. When I run Jenkins via java -jar jenkins.war or put the jenkins.war in my local Tomcat, both of them show the Emma coverage pages with the spaces appearing as question marks within a solid diamond.
I have my jvm and local Tomcat set to UTF-8 and don't want to (can't really) change them. As a quick test, I loaded one of the HTML files into my editor (Geany) and I changed the HTML's content-type to UTF-8 and had Geany change the encoding of the file to UTF-8 and when I view that it looks fine (no diamonds). I found this page: http://emma.sourceforge.net/reference/ch03s02.html that says:
Property: report.out.encoding
Default: report.out.encoding defaults to the JRE file.encoding system property and is overridden for the HTML and XML report types:
report.html.out.encoding: ISO-8859-1
report.xml.out.encoding: UTF-8
but either it doesn't work or I haven't stumbled on the correct incantation to get it to work.
I have tried adding to the ANT file (in numerous places in my build.xml):
<property name="emma.report.html.out.encoding" value="UTF-8" />
<property name="report.html.out.encoding" value="UTF-8" />
I tried adding
report.html.out.encoding=UTF-8
emma.report.html.out.encoding=UTF-8
to a properties file and changed the emma run (within ant) to read it (I don't have the example XML handy now since it didn't work and I removed it).
I added
<jvmarg value="-Demma.report.html.out.encoding=UTF-8" />
to the ant build file right under another emma setting in my build.xml.
I tried running Tomcat with both
-Demma.report.html.out.encoding=UTF-8
and
-Dreport.html.out.encoding=UTF-8
and finally, I tried running the jenkins.war file with both
java -Demma.report.html.out.encoding=UTF-8 -jar jenkins.war
and
java -Dreport.html.out.encoding=UTF-8 -jar jenkins.war
and none of these worked.
Any ideas?
Upvotes: 3
Views: 1419
Reputation: 806
Well, I finally got it work... I tried a bunch of things all at once and one of them worked. Then I started removing them one by one. This is what worked...
In my ant built file, in the emma task (mine starts with
<emma enabled="${emma.enabled}" >
I added this as the first line of the task:
<property name="report.html.out.encoding" value="UTF-8" />
That's it. By doing this, the Emma reports served up by the standalone Jenkins server are now encoded in UTF-8 and don't have the nasty diamond question marks for spaces.
Upvotes: 3