0

I use SBT to include dependencies in my project, but I couldn't find the reason why some dependencies are ignored randomly. Even if they exist in .ivy2/cache directory, I tried to delete the content of it and retry but I still have the same problem.

The version of my SBT is 0.13.15 here is an example:

import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import ScalateKeys._

val ScalatraVersion = "2.4.1"

ScalatraPlugin.scalatraSettings

scalateSettings

organization := "com.*****"

name := "****"

version := "0.1.0-SNAPSHOT"

scalaVersion := "2.10.5"

val sparkVersion = "1.6.0"

resolvers += Classpaths.typesafeReleases

libraryDependencies ++= Seq(
  "org.scalatra" %% "scalatra-json" % ScalatraVersion,
  "org.json4s"   %% "json4s-jackson" % "3.2.11",
  "org.scalatra" %% "scalatra" % ScalatraVersion,
  "org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
  "org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
  "ch.qos.logback" % "logback-classic" % "1.1.5" % "runtime",
  "org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container",
  "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
)
libraryDependencies += "org.apache.spark" %% "spark-core" % sparkVersion
libraryDependencies += "org.apache.spark" %% "spark-sql" % sparkVersion
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.2.14"

scalateTemplateConfig in Compile := {
  val base = (sourceDirectory in Compile).value
  Seq(
    TemplateConfig(
      base / "webapp" / "WEB-INF" / "templates",
      Seq.empty,  /* default imports should be added here */
      Seq(
        Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
      ),  /* add extra bindings here */
      Some("templates")
    )
  )
}

enablePlugins(JettyPlugin)

In my example, sometimes the scalatra jsonis ignored and when I retried to create a new project the sparkdependencies was ignored

Ismail Addou
  • 383
  • 1
  • 2
  • 17

1 Answers1

0

I finally found the solution of my issues, my project had to be converted to eclipse project through SBT with sbt eclipse command. Initially the Scalatra project was created via SBT with this command: sbt new scalatra/scalatra-sbt.g8

The trick is to eclipsify the project before beginning to import dependencies.

Ismail Addou
  • 383
  • 1
  • 2
  • 17