databricks / sbt-spark-package

Sbt plugin for Spark packages
Apache License 2.0
151 stars 32 forks source link

UNRESOLVED DEPENDENCIES fetching for scala 2.12 instead of 2.11 #35

Open dumoulma opened 7 years ago

dumoulma commented 7 years ago

Hi!

Can't use sbt-spark-package because the plugin can't be found. I saw two other closed issues with similar problem and tried the resolutions there, but it doesn't seem to work.

I defined scalaVersion as 2.11.11 and it's trying to get for scala 2.12

~/d/m/h/tmz2-spark-sbt ❯❯❯ sbt                                                                                     ⏎ master ✚ ✱ ◼
[info] Loading settings from assembly.sbt,plugins.sbt ...
[info] Loading project definition from /Users/mdumoulin/dev/mapr-engagement/hpe/tmz2-spark-sbt/project
[info] Updating {file:/Users/mdumoulin/dev/mapr-engagement/hpe/tmz2-spark-sbt/project/}tmz2-spark-sbt-build...
[warn]  module not found: org.spark-packages#sbt-spark-package;0.2.6
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/org.spark-packages/sbt-spark-package/scala_2.12/sbt_1.0//0.2.6/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.spark-packages/sbt-spark-package/scala_2.12/sbt_1.0//0.2.6/ivys/ivy.xml
[warn] ==== local: tried
[warn]   /Users/mdumoulin/.ivy2/local/org.spark-packages/sbt-spark-package/scala_2.12/sbt_1.0//0.2.6/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/spark-packages/sbt-spark-package_2.12_1.0/0.2.6/sbt-spark-package-0.2.6.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/mdumoulin/.sbt/preloaded/org.spark-packages/sbt-spark-package/0.2.6/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/mdumoulin/.sbt/preloaded/org/spark-packages/sbt-spark-package_2.12_1.0/0.2.6/sbt-spark-package-0.2.6.pom
[warn] ==== Artima Maven Repository: tried
[warn]   http://repo.artima.com/releases/org/spark-packages/sbt-spark-package_2.12_1.0/0.2.6/sbt-spark-package-0.2.6.pom
[warn] ==== bintray-spark-packages: tried
[warn]   https://dl.bintray.com/spark-packages/maven/org/spark-packages/sbt-spark-package_2.12_1.0/0.2.6/sbt-spark-package-0.2.6.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.spark-packages#sbt-spark-package;0.2.6: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      org.spark-packages:sbt-spark-package:0.2.6 (scalaVersion=2.12, sbtVersion=1.0)

Relevant part of by build.sbt:

name := """tmz2-spark"""
version := "1.0"

**scalaVersion := "2.11.11"**

spName := "mapr/tmz2-spark"
sparkVersion := "2.1.0"
sparkComponents += Seq("core", "sql")
spDistDirectory := "dist"

relevant part of plugins.sbt

resolvers += "bintray-spark-packages" at "https://dl.bintray.com/spark-packages/maven/"
addSbtPlugin("org.spark-packages" % "sbt-spark-package" % "0.2.6")
WesleyBatista commented 7 years ago

Exactly same issue here :/

WesleyBatista commented 7 years ago

I was using the latest version (1.0.3) of sbt. Downgrading the sbt.version at project/build.properties to 0.13.16 fixed the problem for me.

WesleyBatista commented 7 years ago

It seems like the Scala used by SBT and the one that we specify at our build.sbt are different things.

I noticed this when using sbt on version 1.0.3 it was using Scala 2.12 do resolve the dependencies, while in my build.sbt I was specifying 2.11.11

Today I've reinstalled sbt, and by default the sbt new scala/scala-seed.g8 command creates a new project with the following:

build.sbt

import Dependencies._

lazy val root = (project in file(".")).
  settings(
    inThisBuild(List(
      organization := "com.example",
      scalaVersion := "2.12.4",
      version      := "0.1.0-SNAPSHOT"
    )),
    name := "Hello",
    libraryDependencies += scalaTest % Test
  )

project/build.properties

sbt.version=0.13.16

Then I've ran the command 'sbt' for the first time inside the project folder, and looking at the logs, it appears:

Getting org.scala-sbt sbt 0.13.16 ...

downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.16/jars/sbt.jar ...
    [SUCCESSFUL ] org.scala-sbt#sbt;0.13.16!sbt.jar (3491ms)
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/test-agent/0.13.16/jars/test-agent.jar ...
    [SUCCESSFUL ] org.scala-sbt#test-agent;0.13.16!test-agent.jar (3344ms)
downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/apply-macro/0.13.16/jars/apply-macro.jar ...
    [SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.16!apply-macro.jar (3535ms)

[...]

:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    49 artifacts copied, 0 already retrieved (17616kB/54ms)
Getting Scala 2.10.6 (for sbt)...
downloading https://repo1.maven.org/maven2/org/scala-lang/jline/2.10.6/jline-2.10.6.jar ...
    [SUCCESSFUL ] org.scala-lang#jline;2.10.6!jline.jar (994ms)
downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ...
    [SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (664ms)
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    5 artifacts copied, 0 already retrieved (24494kB/31ms)

Getting Scala 2.10.6 (for sbt)...

I did not catch the problem early because I've created the project with IntelliJ IDEA, then migrated to the command line. Missed the SBT's install part.

So, hope that this helps out someone else :)

And maybe it should be clear that it's required sbt on version 0.13 to get it working. What do you think?


EDIT 1: With the 'about' command inside sbt:

[info] This is sbt 0.13.16
[info] The current project is {file:/home/wesley/github/projects/mongo-scala-spark/}root 0.1.0-SNAPSHOT
[info] The current project is built against Scala 2.12.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin, sbtsparkpackage.SparkPackagePlugin, sbtassembly.AssemblyPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.6
>