etorreborre/specs2 — pull request #206 by asflierl (2013-10-31 10:25:52+00:00)
Title: Proposing a fix for HTML resource copying

Hi Eric,

in the current specs2 version (2.3), the CSS and Javascript resources are not copied properly to the HTML output directory. The cause is twofold:

1) In case of the single JAR publication, the single JAR does not even contain the resources. I fixed this in the SBT build.

2) In case of the multiple JAR publication, the issue was (most unsurprisingly) class loading. The class used to locate the JAR (an anonymous inner class of org.specs2.reporter.OutputDir) is located in a different JAR (in specs2-core) than the HTML resources (which are in specs2-html).

Therefore (in both cases) the copying (silently) did nothing.

I also added a (probably not too useful) test.

Hope this helps.

Kind regards
Andreas

P.S. I'm not sure why you used the thread context class loader. Was this because of a bug in the past and/or something I overlooked?

P.P.S. I took the liberty to wrap some file handling in try/finally to avoid resource leaks.