这是我的
build.sbt
文件,我收到有关“PlayScala”无法解析的错误
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19")
这已经在plugin.sbt
中添加了并且版本没有问题
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(
name := """play-scala-hello-world-tutorial""",
organization := "com.example",
version := "1.0-SNAPSHOT",
scalaVersion := "2.13.10",
libraryDependencies ++= Seq(
"com.google.inject" % "guice" % "5.1.1",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test
),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-xfatal-warnings"
)
)
sbt new playframework/play-scala-seed.g8
https://www.playframework.com/getting-started
project/build.properties
.使用 sbt 1.7.2-
如果您使用的是 sbt 1.7.3+ (1.8.x),您应该将以下内容添加到
project/plugins.sbt
ThisBuild / libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)
https://github.com/playframework/playframework/issues/11522
https://mvnrepository.com/artifact/com.google.inject/guice
5.1.1 是快照
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
libraryDependencies ++= Seq(
"com.google.inject" % "guice" % "5.1.1-SNAPSHOT",
...
https://oss.sonatype.org/content/repositories/snapshots/com/google/inject/guice/
https://oss.sonatype.org/content/groups/public/com/google/inject/guice/
JDK 8 是默认的。自 Play 2.8.x 起支持 JDK 11
https://www.playframework.com/documentation/2.8.19/Highlights28#Java-11-support
在 JDK 17 中需要进行一些调整
如果您使用的是 Guice,则必须使用最新版本 ...
https://github.com/playframework/playframework/releases/2.8.15
但是你已经在使用最新的(甚至更新鲜的)Guice 所以这应该没问题。
Play scala.tools.nsc.Settings.bootclasspath()NoSuchMethodError()
(但这是在运行时,而不是构建时)。