激活器编译从未完成/如何调试?

时间:2016-05-14 23:00:39

标签: playframework sbt

我正在尝试构建一个播放2.3.10应用程序。有329个源文件,我无法完成构建。在异常(太长)的时间内,在#34;编译329 Scala源..."之后,任务管理器开始显示高CPU使用率和过于规则的模式,使其看起来好像sbt(或进程)处于某种循环中。

我最近没有添加任何新库,因此请勿立即查看依赖项是如何更改的。我尝试过激活干净(并更新干净)。我在JAVA_OPTS和SBT_OPTS中增加了内存大小。我已经将sbt从13.7升级到13.8然后再升级到13.11。我已将Scala从2.11.7更新到2.11.8,将JDK更新到1.7.0_80。我已经重新开始了这个项目。我已经尝试更新激活器并删除了常春藤缓存。并重新启动:)。当我在build.sbt中set logLevel := Level.Debug并查看来自sbt的调试输出时,似乎没有任何异常,只列出类路径和其他变量,之后输出完全静音。

最后一个输出是

[info] Done updating.
[info] Compiling 329 Scala sources and 1 Java source to ...\target\scala-2.11\classes...

这个项目直到最近才成功建设。仅添加了新视图,新控制器方法和新路径。

build.sbt或多或少看起来像这样:

name := """AppName"""

version := "1.050"

lazy val scalacOptions = Seq ("-feature")

lazy val root = (project in file(".")).enablePlugins(PlayScala).enablePlugins(SbtTwirl)

scalaVersion := "2.11.8"

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  ws,
  "org.webjars" % "bootstrap" % "3.3.6",
  "org.webjars" %% "webjars-play" % "2.3.0-2",
  "org.webjars" % "handlebars" % "1.3.0",
  "org.webjars" % "typeaheadjs" % "0.10.5",
  "mysql" % "mysql-connector-java" % "5.1.38",
  "com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1",
  "com.github.nscala-time" %% "nscala-time" % "1.2.0",
  "org.webjars" % "jquery" % "1.9.0",
 "org.webjars" % "dustjs-linkedin" % "2.4.0-1",
  "org.webjars" % "tablesorter" % "2.15.5"11  
)

fork in run := true

使用激活器调试,显示以下sbt调试输出:

[info] Loading project definition from C:\Users\admin\Documents\workspace\AppName\project
[info] Set current project to AppName (in build file:/C:/Users/admin/Documents/workspace/AppName/)
[debug] > compile
[debug] Evaluating tasks: compile:compile
[debug] Running task... Cancel: Null, check cycles: false, forcegc: true
[debug] [naha]
[debug] [naha] Initial source changes:
[debug] [naha]  removed:Set()
[debug] [naha]  added: Set(C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\v
...
scala, C:\Users\admin\Documents\workspace\AppName\app\controllers\MeasureActivities.scala, C:\Users\admin\Documents\workspace\AppName\app\models\OrganisationType.scala)
[debug] [naha]  modified: Set()
[debug] [naha] Invalidated products: Set()
[debug] [naha] External API changes: API Changes: Set()
[debug] [naha] Modified binary dependencies: Set()
[debug] [naha] Initial directly invalidated sources: Set(C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\school\runs.template.scala, C:\Users\admin\Documents\workspace\AppName\app\models\LearningItem.scala, C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\user\noAccess.template.scala, 
...
C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\tag\list.template.scala, C:\Users\admin\Documents\workspace\AppName\app\models\SyncAction.scala, C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\province\list.template.scala, C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\apiConsumer\form.template.scala, C:\Users\admin\Documents\workspace\AppName\app\controllers\MeasureActivities.scala, C:\Users\admin\Documents\workspace\AppName\app\models\OrganisationType.scala)
[debug] [naha]
[debug] [naha] Sources indirectly invalidated by:
[debug] [naha]  product: Set()
[debug] [naha]  binary dep: Set()
[debug] [naha]  external source: Set()
[debug] All initially invalidated sources: Set(C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\school\runs.template.scala, C:\Users\admin\Documents\workspace\AppName\app\models\LearningItem.scala,
...
C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\tag\list.template.scala, C:\Users\admin\Documents\workspace\AppName\app\models\SyncAction.scala, C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\province\list.template.scala, C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\twirl\main\views\html\apiConsumer\form.template.scala, C:\Users\admin\Documents\workspace\AppName\app\controllers\MeasureActivities.scala, C:\Users\admin\Documents\workspace\AppName\app\models\OrganisationType.scala)
[debug] [naha] Recompiling all 330 sources: invalidated sources (330) exceeded 50.0% of all sources
[info] Compiling 329 Scala sources and 1 Java source to C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\classes...
[debug] Getting org.scala-sbt:compiler-interface:0.13.11:component from component compiler for Scala 2.11.8
[debug] Getting org.scala-sbt:compiler-interface:0.13.11:component from component compiler for Scala 2.11.8
[debug] Running cached compiler 4d0e0074, interfacing (CompilerInterface) with Scala compiler version 2.11.8
[debug] Calling Scala compiler with arguments  (CompilerInterface):
[debug]         -deprecation
[debug]         -unchecked
[debug]         -encoding
[debug]         utf8
[debug]         -bootclasspath
[debug]         C:\Program Files\Java\jdk1.7.0_80\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_80\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_80\jre\classes;C:\Users\admin\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.11.8.jar
[debug]         -classpath
[debug]         C:\Users\admin\Documents\workspace\AppName\target\scala-2.11\classes;C:\Users\admin\.ivy2\cache\com.typesafe.play\twirl-api_2.11\jars\twirl-api_2.11-1.1.1.jar;C:\Users\admin\.ivy2\cache\org.apache.commons\commons-lang3\jars\commons-lang3-3.4.jar;C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar;C:\Users\admin\.ivy2\cache\com.typesafe.play\play_2.11\jars\play_2.11-2.3.10.jar;C:\Users\admin\.ivy2\cache\com.typesafe.play\build-link\jars\build-link-2.3.10.jar;C:\Users\admin\.ivy2\cache\com.typesafe.play\play-exceptions\jars\play-exceptions-2.3.10.jar;
...
C:\Users\admin\.ivy2\cache\org.bouncycastle\bcprov-jdk14\jars\bcprov-jdk14-1.38.jar;C:\Users\admin\.ivy2\cache\org.bouncycastle\bcmail-jdk14\jars\bcmail-jdk14-1.38.jar;C:\Users\admin\.ivy2\cache\org.xhtmlrenderer\flying-saucer-core\jars\flying-saucer-core-9.0.7.jar;C:\Users\admin\.ivy2\cache\nu.validator.htmlparser\htmlparser\bundles\htmlparser-1.4.jar;C:\Users\admin\.ivy2\cache\log4j\log4j\bundles\log4j-1.2.17.jar

使用scalacOptions的-verbose设置,会产生大量编译器消息,并且输出在这些行之后停止:

...
[info] [loaded class file C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar(scala/xml/Text.class) in 2ms]
[info] [loaded class file C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar(scala/xml/Atom.class) in 2ms]
[info] [loaded class file C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar(scala/xml/SpecialNode.class) in 2ms]
[info] [loaded class file C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar(scala/xml/pull/package.class) in 2ms]
[info] [loaded package loader pull in 6ms]
[info] [loaded class file C:\Users\admin\.ivy2\cache\org.scala-lang.modules\scala-xml_2.11\bundles\scala-xml_2.11-1.0.1.jar(scala/xml/pull/XMLEvent.class) in 2ms]
[info] [loaded class file C:\Users\admin\.ivy2\cache\com.typesafe.play\play_2.11\jars\play_2.11-2.3.10.jar(views/html/helper/textarea.class) in 1ms]

似乎不太可能,虽然我猜这个问题可能与textarea.class ...

有某种关系

sbt会检测并解决循环依赖关系吗?任何关于对过程进行故障排除的指导都将受到赞赏。

1 个答案:

答案 0 :(得分:0)

这种情况下的问题是视图源代码中的语法错误。但Eclipse无法显示它(可能遭受相同的非完成编译),并且scala编译器没有返回,因此很难跟踪。