0
votes

I'm working on a back-end project using for the first time Scala and the Play Framework with IntelliJ IDEA.

I've been reading a lot of documentation and topics:

I can't understand how to import dependencies.

When I try to append a new dependency, IntelliJ underlines it and shows either "Unknown artifact. Not resolved or indexed" or a log shows up and says "SBT unknown import".

Every dependency I add is from the Maven Repository.

Here is the build.sbt file:

name := "server"

version := "1.0" 

lazy val `server` = (project in file(".")).enablePlugins(PlayScala)

resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"

resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"

resolvers := ("Atlassian Releases" at "https://maven.atlassian.com/public/") +: resolvers.value

scalaVersion := "2.12.2"

libraryDependencies ++= Seq(
  jdbc,
  ehcache,
  ws,
  specs2 % Test,
  guice,
  "org.mongodb.scala" %% "mongo-scala-driver" % "2.1.0",
  "com.mohiva" %% "play-silhouette" % "5.0.2",
  "com.mohiva" %% "play-silhouette-password-bcrypt" % "5.0.2",
  "com.mohiva" %% "play-silhouette-crypto-jca" % "5.0.2",
  "com.mohiva" %% "play-silhouette-persistence" % "5.0.2",
  "com.mohiva" %% "play-silhouette-testkit" % "5.0.2" % "test"
)

unmanagedResourceDirectories in Test <+=  baseDirectory ( _ /"target/web/public/test" )  
1

1 Answers

1
votes

These dependencies were specified using a shorthand that is defined by the Play plugin:

jdbc,
ehcache,
ws,
specs2 % Test,
guice

So for them to work, be sure to include a line like the following in an .sbt file in the project directory:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.10")

That should fix your problem.

Bonus tip: No need for the following lines, and because each additional resolver slows down SBT, you should delete them:

resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"

resolvers += "Akka Snapshot Repository" at "http://repo.akka.io/snapshots/"

resolvers := ("Atlassian Releases" at "https://maven.atlassian.com/public/") +: resolvers.value