-1

this is my build.sbt file and I am getting error about "PlayScala" cannot resolve addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19") this is already added in plugin.sbt and there's no issue in the version

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"
    )
  )
Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66

1 Answers1

0
  • The best way to create a new Play project is
sbt new playframework/play-scala-seed.g8

https://www.playframework.com/getting-started

  • What is sbt version for your project? Look at project/build.properties.

Use sbt 1.7.2-

If you're using sbt 1.7.3+ (1.8.x) you should add the following to project/plugins.sbt

ThisBuild / libraryDependencySchemes ++= Seq(
  "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)

https://github.com/playframework/playframework/issues/11522

  • Where did you get guice 5.1.1? Mvnrepository knows 5.1.0-

https://mvnrepository.com/artifact/com.google.inject/guice

5.1.1 is snapshot

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/

  • What is your Java?

JDK 8 is default. JDK 11 is supported since Play 2.8.x

https://www.playframework.com/documentation/2.8.19/Highlights28#Java-11-support

In JDK 17 some adjustments are needed

If you are using Guice you have to make use of the latest version ...

https://github.com/playframework/playframework/releases/2.8.15

But you're already using the latest (and even fresher) Guice so this should be ok.

  • Sometimes there can be incompatibilities between Play and sbt versions

NoSuchMethodError with Play scala.tools.nsc.Settings.bootclasspath()

(but this is at runtime, not build time).

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66