我将模板导入设置为导入模板所需的依赖项,但是没有使用IntelliJ解析任何依赖项。
这是我的整个Build.scala:
import play.sbt.PlayImport._
import play.sbt.PlayScala
import play.sbt.routes.RoutesKeys._
import play.twirl.sbt.Import.TwirlKeys
import sbt._
import sbt.Keys._
object Build extends Build {
lazy val core = Project(id = "core", base = file(".")).settings(
name := "core",
version := "0.1",
scalaVersion := "2.11.6",
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
filters,
specs2 % Test,
"com.typesafe.play" %% "anorm" % "2.4.0",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.apache.commons" % "commons-lang3" % "3.3.2",
"com.googlecode.xmemcached" % "xmemcached" % "2.0.0",
"com.amazonaws" % "aws-java-sdk-s3" % "1.10.49",
"io.argonaut" %% "argonaut" % "6.0.4",
"com.sksamuel.scrimage" %% "scrimage-core" % "2.1.2",
"javax.mail" % "mail" % "1.4.7",
"io.fastjson" % "boon" % "0.31",
"net.debasishg" %% "redisclient" % "2.13",
"com.mohiva" %% "play-html-compressor" % "0.5.0" exclude("rhino", "js"),
"com.yahoo.platform.yui" % "yuicompressor" % "2.4.7" exclude("rhino", "js"),
"com.github.jreddit" % "jreddit" % "1.0.2",
"com.notnoop.apns" % "apns" % "1.0.0.Beta6",
"com.sksamuel.scrimage" %% "scrimage-canvas" % "1.4.2"
),
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases",
doc in Compile <<= target.map(_ / "none"),
routesGenerator := InjectedRoutesGenerator,
TwirlKeys.templateImports += "core.data.db.models._",
unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )
).enablePlugins(PlayScala)
}
我已经确认所有包裹路线都是正确的。我该如何解决这个问题?
答案 0 :(得分:0)
为了让intellij IDEA帮助开发模板,您需要更新最新的Scala插件的Intellij IDEA Ultimate。 https://www.jetbrains.com/idea/features/
它应该在build.sbt
中没有任何特殊配置的情况下工作作为参考,您可以创建一个新的Play2项目并查看模板是否正常工作 https://www.jetbrains.com/idea/help/getting-started-with-play-2-x.html
通过此设置,您可以使用TwirlKeys.templateImports来避免将导入添加到所有模板。