Scala Play 2.3.5 - 工作服sbt插件java.io.IOException:无法下载JavaScript

时间:2014-10-22 22:38:39

标签: scala playframework playframework-2.3 coveralls

我目前正在尝试使用travis,heroku和coveralls sbt插件为codecoverage设置一个play scala项目buildchain。 我用激活器创建了一个干净的scala播放应用程序,只是添加了工作服插件和travis.yml。

当我推送项目并触发构建时,我会在travis运行测试时得到以下异常:

[error] c.g.h.h.HtmlPage - Error loading JavaScript from [http://localhost:19001/assets/javascripts/hello.js].
java.io.IOException: Unable to download JavaScript from 'http://localhost:19001/assets/javascripts/hello.js' (status 404).
  at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1106) ~[htmlunit-2.13.jar:2.13]
  at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1039) ~[htmlunit-2.13.jar:2.13]
  at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:409) [htmlunit-2.13.jar:2.13]
  at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:266) [htmlunit-2.13.jar:2.13]
  at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:286) [htmlunit-2.13.jar:2.13]

我发现这个旧主题(https://groups.google.com/forum/#!topic/play-framework/yj4NT3BO0Os)具有相同的错误消息但很遗憾没有一个解决方案适用于我。

这里有没有人使用工作服或知道我的问题的解决方案?我已经附加了所有配置文件。

build.sbt

import scoverage.ScoverageSbtPlugin.instrumentSettings
import org.scoverage.coveralls.CoverallsPlugin.coverallsSettings

name := """buildchain"""

version := "1.0-SNAPSHOT"

scalaVersion := "2.11.1"

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

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  ws
)

instrumentSettings

CoverallsPlugin.coverallsSettings

ScoverageKeys.minimumCoverage := 1

ScoverageKeys.failOnMinimumCoverage := true

plugins.sbt:

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += Classpaths.sbtPluginReleases

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.5")

// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

// code coverage
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "0.99.7.1")

addSbtPlugin("org.scoverage" %% "sbt-coveralls" % "0.99.0")

travis.yml

language: scala
scala:
  - 2.11.2
script: "sbt coveralls"
notifications:
  email: false

3 个答案:

答案 0 :(得分:1)

问题在于sbt-scoverage,并已在1.0.0版中修复。请注意,您必须更新使用插件的方式,因此请参阅自述文件中的设置指南。

https://github.com/scoverage/sbt-scoverage

答案 1 :(得分:0)

错误显示您收到HTTP 404(未找到)错误:

java.io.IOException: Unable to download JavaScript from 'http://localhost:19001/assets/javascripts/hello.js' (status 404)

所以我认为这对你的工具来说不是一个问题,而只是一个简单的老问题" not found"问题。 您的项目中是否有assets / javascripts / hello.js文件?

答案 2 :(得分:0)

似乎这是sbt-scoverage插件和游戏的问题。我希望将来能够解决这个问题...

https://github.com/scoverage/sbt-scoverage/issues/52