1

I am trying to build a play 2.3.10 application. There are 329 source files and I am having trouble getting it to complete the build. After an unusually (too) long time during which there is no progress on "Compiling 329 Scala sources...", the task manager begins to show a high CPU usage and a too regular pattern that makes it look as though sbt (or the process) is in some kind of loop.

I have not added any new libraries recently, so don't immediately see how dependencies could have changed. I have tried activator clean (and update clean). I have increased memory size in JAVA_OPTS and SBT_OPTS. I have upgraded sbt from 13.7 to 13.8 and then 13.11. I have updated Scala from 2.11.7 to 2.11.8 and JDK to 1.7.0_80. I have recloned the project. I've tried updating activator and also deleted the ivy cache. And rebooted :). When I set logLevel := Level.Debug in build.sbt and look at the debug output from sbt, there does not appear to be anything unusual, just listing of classpath and other variables, after which the output quietens completely down.

The last output is

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

This project was building successfully until recently. Only a new view, new controller method and new route were added.

The build.sbt look more or less lie this:

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

Using activator debug, the following sbt debug output is shown:

[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

Using the -verbose setting for scalacOptions, a lot of compiler messages are produced, and output stops after these lines:

...
[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]

It seems unlikely, although I guess possible that the problem is somehow related to textarea.class...

Does sbt detect and resolve circular dependencies? Any guidance on troubleshooting the process would be appreciated.

5
  • Ok, found that an sbt file in projects had log level set to warn which was overriding. so now am getting more output, hoping to see something. any clues or guidance still very much appreciated.
    – wwkudu
    May 15, 2016 at 6:49
  • Nope, even debug level output shows nothing after the above.
    – wwkudu
    May 15, 2016 at 10:45
  • Can you post your sbt log somewhere? Is your project under vcs like git or similar? Can you post your build.sbt?
    – Teliatko
    May 15, 2016 at 14:52
  • @Teliatko - thanks for your comment/questions - have added an abbreviated debug log and build.sbt.
    – wwkudu
    May 15, 2016 at 18:30
  • It seems to be something to do with a syntax error in the view code that has just been added. Somehow the compiler gets in a knot and does not return - at least that's how it seems at this point. Still troubleshooting.
    – wwkudu
    May 15, 2016 at 21:43

1 Answer 1

0

The problem in this case was a syntax error in the view source code. But Eclipse was unable to show it (possibly suffering from the same non-completing compile), and the scala compiler did not return, so it became very difficult to track down.

2
  • Fine, that was also my idea to go back by commits and find out what caused the looping. Btw. never trust any IDE, while scala tooling is still weakest part of using scala. Command line and SBT are your best friends. Happy that you're located that so close already.
    – Teliatko
    May 16, 2016 at 6:26
  • @Teliatko Tks for the input. Frustrating though - no indication at all what was going wrong. Tks again.
    – wwkudu
    May 16, 2016 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.