Hi,
If one places a softlink in Play's conf dir, e.g. like so:
$ ll conf/local
conf/local -> ../../conf-local/
then running stage or dist results in a StringIndexOutOfBoundsException in PlaySettings.scala, because that file uses file.getCanonicalPath but that results in the wrong path to the softlinked files. I replaced getCanonicalPath with file.getAbsolutePath and that solves the problem for me.
Here are the changes I made to avoid stage and dist dying:
$ gid
diff --git a/framework/src/sbt-plugin/src/main/scala/PlaySettings.scala b/framework/src/sbt-plugin/src/main/scala/PlaySettings.scala
index 5904579..f0501fd 100644
--- a/framework/src/sbt-plugin/src/main/scala/PlaySettings.scala
+++ b/framework/src/sbt-plugin/src/main/scala/PlaySettings.scala
@@ -235,11 +235,11 @@ trait Settings {
mappings in Universal <++= (confDirectory) map {
confDirectory: File =>
- val confDirectoryLen = confDirectory.getCanonicalPath.length
+ val confDirectoryLen = confDirectory.getAbsolutePath.length
val pathFinder = confDirectory ** ("*" -- "routes")
pathFinder.get map {
confFile: File =>
- confFile -> ("conf/" + confFile.getCanonicalPath.substring(confDirectoryLen))
+ confFile -> ("conf/" + confFile.getAbsolutePath.substring(confDirectoryLen))
}
},
Would it be possible to have this fixed in 2.2.x? (Should I open some issue somewhere?)
(Please note that fixing only the last getCanonicalPath above doesn't suffice, in case there are softlinks to child projects.
(In my case I have a softlink to SecureSocial's module-code directory: ./modules/securesocial --> ./modules/securesocial-git/module-code/ ).)
Someone else also has encountered this:
[2.2] Stage or dist gives a java.lang.StringIndexOutOfBoundsException
(Don't know if this applies to 2.3.x too)
Best regards, KajMagnus