从playframework-2.2.4迁移到playframework-2.3.9后,我在运行时遇到以下错误:
[namek] $ run
java.util.NoSuchElementException: head of empty list
at scala.collection.immutable.Nil$.head(List.scala:337)
at scala.collection.immutable.Nil$.head(List.scala:334)
at play.runsupport.Reloader$.startDevMode(Reloader.scala:184)
at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:75)
at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$PlayRun$class$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:75)
at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:98)
at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:54)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.util.NoSuchElementException: head of empty list
[error] Total time: 3 s, completed 26-May-2015 12:35:03
在源文件Reloader.scala:184(https://github.com/playframework/playframework/blob/2.3.9/framework/src/run-support/src/main/scala/play/runsupport/Reloader.scala)中,我看到对" play-docs"的引用在docsClasspath的名称中:Classpath作为startDevMode中的参数接收。
val docsJarFile = {
val f = docsClasspath.filter(_.getName.startsWith("play-docs")).head
new JarFile(f)
}
我该怎么办?我无法找到关于此播放文档名称的任何参考。
UPDATE 似乎在旧版本中,playDocsJar使用了headOption而不是head(https://github.com/playframework/playframework/blob/848329be7d8a2d3d52d9031880332d46f845899e/framework/src/sbt-plugin/src/main/scala/play/sbt/PlaySettings.scala)
playDocsJar := (managedClasspath in DocsApplication).value.files.filter(_.getName.startsWith(playDocsName.value)).headOption,
答案 0 :(得分:0)
作为解决方法,我创建了一个DocsApplication并添加了一个虚拟库
libraryDependencies += "com.typesafe.play" %% "play-docs" % play.core.PlayVersion.current % "docs"