UnsupportedCharsetException during the building of scaladoc on Windows (under NetBeans)
I found two major issues while building akka on Windows (with NetBeans):
For the former issue, the resolution is only a single line change in AkkaBuild.scala, forcing to use utf-8 encoding:
Well, on the Eclipse based environment it might not occur because in Eclipse you can set the charset to utf-8 in the Preferences. But as the sbt is a console app and it can run stand alone, it's highly likely it will fail to compile on Windows.
If you find this fix worth to commit then I'll prepare a GitHub pull request along with.
- UnsupportedCharsetException - this occurs because the locale charset (aka. codepage on Windows) cannot be set to utf-8 (MS-DOS heritage and bad architectural decisions)
- Graphviz had to be installed and added to the PATH to succesfully compile scaladoc with diagrams
For the former issue, the resolution is only a single line change in AkkaBuild.scala, forcing to use utf-8 encoding:
diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala
index dc69f4c..5aa1bf8 100644
--- a/project/AkkaBuild.scala
+++ b/project/AkkaBuild.scala
@@ -893,7 +893,7 @@ object AkkaBuild extends Build {
val name = f.getName
if (name.endsWith(".html") && !name.startsWith("index-") &&
!(name.compare("index.html") == 0) && !(name.compare("package.html") == 0)) {
- val source = scala.io.Source.fromFile(f)
+ val source = scala.io.Source.fromFile(f)("utf-8")
val hd = source.getLines().exists(_.contains("<div class=\"toggleContainer block diagram-container\" id=\"inheritance-diner\">"))
source.close()
hd
Well, on the Eclipse based environment it might not occur because in Eclipse you can set the charset to utf-8 in the Preferences. But as the sbt is a console app and it can run stand alone, it's highly likely it will fail to compile on Windows.
If you find this fix worth to commit then I'll prepare a GitHub pull request along with.
Leave a comment