SBT Won´t update .classpath in a Play Scala project - eclipse

I am creating a new Play Scala project within Eclipse + Scala IDE.
The original build.sbt file is:
name := """portal"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
jdbc,
cache,
ws
)
I've edited it to include some more dependencies:
libraryDependencies ++= Seq(
jdbc,
javaEbean,
cache,
ws,
"org.postgresql" % "postgresql" % "9.3-1100-jdbc4",
"org.scalatestplus" %% "play" % "1.1.0" % "test"
)
I can't figure out why SBT won't include Ebean, postgresql, nor scalatest in my classpath. Any help?

It happened that I needed to run the command
activator eclipse
again, and refresh the IDE.

Related

IntelliJ: Symbol 'type org.scalatest.compatible.Assertion' is missing from the classpath

Writing scala tests, I am encountering an error:
Symbol 'type org.scalatest.compatible.Assertion' is missing from the classpath.
This symbol is required by 'type org.scalatest.Assertion'.
Make sure that type Assertion is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'package.class' was compiled against an incompatible version of org.scalatest.compatible.
My build.sbt is very simple:
import sbt.Keys.libraryDependencies
ThisBuild / scalaVersion := "2.13.2"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
lazy val root = (project in file("."))
.settings(
name := "myproj",
libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.9",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.9" % "test",
libraryDependencies += "org.scalatest" %% "scalatest-funsuite" % "3.2.9" % "test",
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
)
This problem only occurs when I build my project within IntelliJ. Using sbt itself it compiles well.
sbt version in this project: 1.3.10
sbt script version: 1.3.6
Any idea of how to fix it in IntelliJ?
Most of the problems related to IntelliJ being broken I resolve by doing so:
sbt clean compile in terminal on root folder
View -> Tool Windows -> sbt and within tab Reload SBT project (right click on project)

Build a universal sbt file in apache spark

Hello i have a sbt file like this:
name := "Myexample"
version := "1.0"
scalaVersion := "2.11.12"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-sql" % "2.4.4",
"org.apache.spark" %% "spark-mllib" % "2.4.4"
)
I want to fix a universal sbt file. If other computer has other scala version or spark version can i make a sbt file dynamic, not declaring my own scalaVersion at all, but declaring in every computer their own scalaversion or apache spark version??

IntelliJ Idea 2016.2.4 cannot resolve symbol spark_2.11

I made a following dependency in build.sbt file for apache-spark 2.11.
name := "Project1"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.0.1"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % "2.11.8",
"org.scala-lang" % "scala-reflect" % "2.11.8",
"org.scala-lang.modules" % "scala-parser-combinators_2.11" % "1.0.4",
"org.scala-lang.modules" % "scala-xml_2.11" % "1.0.4"
)
However Intellij could not resolve spark-core_2.11 dependency . I tried multiple times but could not succeed. Thanks in Advance.
I had the same problem in IntelliJ 2016.3.2 with almost the same Scala/Spark versions:
name := "some-project"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.1.0"
To get it to work I had to manually add the spark-core jar to my project libraries, ie:
Right click on the project -> Open Module Settings
Under Project Settings -> Libraries click + and select the 'Java' option.
Browse for the jar. I found it in my Ivy cache - I assume it got there because I had run the 'update' task from the sbt console previously.

Build issues for apache spark

I have been having a sbt dependency issue when I try to build my apache spark project. I have Apache Spark 1.3.1.
My .sbt file is this:
name := "Transaction"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.1"
resolvers ++= Seq(
"Akka Repository" at "http://repo.akka.io/releases/",
"Spray Repository" at "http://repo.spray.cc/")
And I keep getting this error:
[error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.spark#spark-core_2.10;1.3.1: not found
I have looked all over and this seems to be a persistent issue, but no one has really solved it.
Thanks for your help!
I used
“org.apache.spark” % “spark-core_2.10” % “1.3.1”
instead of
“org.apache.spark” %% “spark-core” % “1.3.1”
and it worked!
EDIT:
However, I was able to get the latter statement to work after specifically making my scalaVersion 2.10 so:
scalaVersion := "2.10"
Probably because it tries to look for a specific 2.10.4 jar which doesn't exist.
I actually figured it out. You just need to put "provided"after the spark version.
name := "Transaction Fraud"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.1" % "provided"
resolvers ++= Seq(
"Akka Repository" at "http://repo.akka.io/releases/",
"Spray Repository" at "http://repo.spray.cc/")

Play framework compilation issues with dependencies

I'm having issues with running a simple scala play app with a few dependencies. The below is happening when trying to run my app.
[error] /Users/roland/play-scala/app/domain/UserModule.scala:2:
object softwaremill is not a member of package com
[error] import com.softwaremill.macwire.MacwireMacros.wire
UserModule:
package domain
import com.softwaremill.macwire.MacwireMacros.wire
trait UserModule {
lazy val userRepository = wire[UserRepository]
lazy val userService = wire[UserService]
}
and my build.sbt is
name := """play-scala"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.10.3"
resolvers += "Maven Central Server" at "http://repo1.maven.org/maven2"
resolvers += "Neo4j Scala Repo" at "http://m2.neo4j.org/content/repositories/releases"
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws,
"org.webjars" % "coffee-script-node" % "1.7.1",
"net.liftweb" %% "lift-json" % "3.0-SNAPSHOT",
"eu.fakod" %% "neo4j-scala" % "0.3.1-SNAPSHOT",
"com.softwaremill.macwire" %% "macros" % "0.7.3",
"com.softwaremill.macwire" %% "runtime" % "0.7.3"
)
It seems to be totally fine when looking at it in intellij idea and looking in my ivy cache I have the dependencies there but the application when it runs through the play console seems to be very unhappy. Sorry for the lack of info but im quite new to scala and play so been struggling all day with this issue.
Indeed the maven repo is named macros_2.10 but there is scalaVersion := "2.10.3" in build.sbt
Try to remove this line.