sbt compile:几个"对象不是包view.html的成员"错误

时间:2017-10-04 12:42:06

标签: scala sbt playframework-2.0

我尝试使用sbt构建基于框架Play的Scala项目。当我尝试启动" sbt compile"从我的终端我得到几个编译错误,如下所示:

[error] <project.dir>/app/controllers/Application.scala:229: 
object database is not a member of package views.html
[error]     Ok(views.html.database(t2, JsonHelpers.TotalTip.langsForm))
[error]                   ^

这是我的build.sbt文件:

import play.sbt.PlayImport._
import com.typesafe.sbt.less.Import.LessKeys

name := """<app_name>"""
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.enablePlugins(GatlingPlugin)
.enablePlugins(BuildInfoPlugin, GitVersioning, GitBranchPrompt)
.settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "app")

https://github.com/puffnfresh/wartremover/issues/182
wartremoverWarnings ++= Warts.unsafe.filter(_ != Wart.Throw)

git.useGitDescribe := true
routesGenerator := InjectedRoutesGenerator
fork in run := true
scalaVersion := "2.11.8"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.4"
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
filters,
specs2 % Test,
"com.typesafe.play" % "anorm_2.11" % "2.5.0",
"org.webjars" % "bootstrap" % "3.3.2",
"org.webjars" % "metisMenu" % "1.1.3",
"org.webjars" % "morrisjs" % "0.5.1",
"org.webjars" % "font-awesome" % "4.3.0",
"org.webjars" % "jquery" % "2.1.3",
"org.webjars" % "flot" % "0.8.3",
"org.webjars" % "datatables" % "1.10.5",
"org.webjars" % "datatables-plugins" % "1.10.5",
"com.newrelic.agent.java" % "newrelic-agent" % "3.14.0",
"com.newrelic.agent.java" % "newrelic-api" % "3.14.0",
"org.pac4j" % "play-pac4j" % "2.6.2",
"org.pac4j" % "pac4j-saml" % "1.9.5",
"org.pac4j" % "pac4j-sql" % "1.9.5",
"org.pac4j" % "pac4j-oidc" % "1.9.5" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-openid" % "1.9.5" exclude("xml-apis" , "xml-apis"),
"org.pac4j" % "pac4j-jwt" % "1.9.5" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-mongo" % "1.9.5",
"org.pac4j" % "pac4j-http" % "1.9.5",
"org.pac4j" % "pac4j-oauth" % "1.9.5",
"org.pac4j" % "pac4j-stormpath" % "1.9.5",
"com.typesafe.play" % "play-cache_2.11" % "2.5.4",
"org.pac4j" % "pac4j-http" % "1.9.5",
"org.pac4j" % "pac4j-cas" % "1.9.5",
"commons-io" % "commons-io" % "2.5"
)

includeFilter in (Assets, LessKeys.less) := "sb-admin-2.less" | "tables.less"
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "2.1.7"
libraryDependencies += "io.gatling"            % "gatling-test-framework"    % "2.1.7"
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.1.5"
libraryDependencies += "org.reactivemongo" %% "reactivemongo" % "0.11.10"
libraryDependencies += "io.swagger" %% "swagger-play2" % "1.6.0"
libraryDependencies += "com.github.tototoshi" %% "play-json-naming" % "1.0.0"
libraryDependencies += "com.github.tototoshi" %% "scala-csv" % "1.3.4"
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.8.7"
libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.16.0"

resolvers ++= Seq(Resolver.mavenLocal, "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases", "Sonatype snapshots repository" at "https://oss.sonatype.org/content/repositories/snapshots/", "<internal repo>" at "<repo_url>")

是依赖性问题吗?有谁知道我为什么会收到这些错误?

由于

1 个答案:

答案 0 :(得分:0)

sbt clean compile

有时帮助

如果没有查看https://www.playframework.com/documentation/2.5.x/IDE