0

我目前正在尝试使用 travis、heroku 和 coveralls sbt 插件设置一个 play scala 项目构建链以进行代码覆盖。我用激活器创建了一个干净的 scala play 应用程序,并添加了工作服插件和一个 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)具有相同的错误消息,但不幸的是,那里的解决方案都不适合我。

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

构建.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

插件.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
4

3 回答 3

1

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

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

于 2014-11-20T19:43:48.997 回答
0

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

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

所以我认为这不是你的工具的问题,而只是一个简单的老“未找到”问题。你的项目中有 assets/javascripts/hello.js 文件吗?

于 2014-10-22T23:33:29.303 回答
0

这似乎是 sbt-scoverage 插件和播放的问题。我希望这个问题将在未来得到解决......

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

于 2014-10-23T23:43:47.160 回答