1
votes

I have installed Flink, Scala and sbt Flink Version: 1.9.1 Scala Version: 2.10.6 Sbt Version: 1.3.7

I made relevant changes in build.sbt. Compile command is failing Here is the relevant information. Any information is greatly appreciated

**Versions Information

[osboxes@osboxes local]$ scala -version

Scala code runner version 2.10.6 -- Copyright 2002-2013, LAMP/EPFL

[osboxes@osboxes local]$ flink --version

Version: 1.9.1, Commit ID: 4d56de8

[osboxes@osboxes readcsvfile]$ sbt -version

sbt version in this project: 1.3.7

sbt script version: 1.3.7

** build.sbt changes

val flinkVersion = "1.9.1"

val flinkDependencies = Seq(
  "org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided")

** Compile Errors

sbt:readCsvfile> compile
[info] Updating 
[info] Resolved  dependencies
[warn] 
[warn]  Note: Unresolved dependencies path:
[error] stack trace is suppressed; run last update for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.apache.flink:flink-streaming-scala_2.13:1.9.1
[error]   Not found
[error]   Not found
[error]   not found: /home/osboxes/.ivy2/local/org.apache.flink/flink-streaming-scala_2.13/1.9.1/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/apache/flink/flink-streaming-scala_2.13/1.9.1/flink-streaming-scala_2.13-1.9.1.pom
[error] Error downloading org.apache.flink:flink-scala_2.13:1.9.1
[error]   Not found
[error]   Not found
[error]   not found: /home/osboxes/.ivy2/local/org.apache.flink/flink-scala_2.13/1.9.1/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/apache/flink/flink-scala_2.13/1.9.1/flink-scala_2.13-1.9.1.pom
[error] Total time: 4 s, completed Jan 30, 2020 3:59:12 PM
sbt:readCsvfile>
2
I don't think flink supports Scala 2.13 yet. Try explicitly pulling the version for 2.12sinanspd
Scala code runner version 2.10.6 -- Copyright 2002-2013, LAMP/EPFL is my Scala versionSarma
it doesn't matter what version of Scala is installed on your computer. Check the project Scala version (in build.sbt), it is apparently trying to pull 2.13. flink-scala_2.13:1.9.1 the 2.13 in there is the Scala version and 1.9.1 is the flink version. It should be pulling flink-scala_2.12:1.9.1sinanspd
Scala 2.10 is too old and 2.13 is too new, try with 2.12 as @sinanspd suggested. Also, you have to understand that you do not have to install everything in local, Scala works different than Python. SBT creates like a virtual env for each project, you there configure everything you need, sbt version, Scala version, dependencies and their versions. The only thing that you have to install in your machine is the JDK.Luis Miguel Mejía Suárez

2 Answers

1
votes

Few points I want to mention here regarding the SBT dependencies issues are:

  1. Please add scalaVersion := "2.12.11" in build.sbt file like this, which includes the Scala version in your SBT dependencies automatically due to this%%.
name := "flink-streaming-demo"

scalaVersion := "2.12.11"

val flinkVersion = "1.10.0"

libraryDependencies += "org.apache.flink" %% "flink-scala" % flinkVersion % "provided"
libraryDependencies += "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided"
  1. If you want Scala version specific SBT dependencies then use % like this:
libraryDependencies += "org.apache.flink" % "flink-scala_2.12" % flinkVersion % "provided"
libraryDependencies += "org.apache.flink" % "flink-streaming-scala_2.12" % flinkVersion % "provided"
  1. In worst case if all these does not work then simply delete or rename these existing .sbt and .ivy2 hidden folder in your system home directory, where your all dependecies and plugins get sotred after downloading from maven central and then refresh/build the SBT project.

  2. SBT dependency format

libraryDependencies += groupID % artifactID % revision % configuration
  1. Meaning of % and %%
    • %: A method used to construct an Ivy Module ID from the strings you supply.
    • %%: When used after the groupID, it automatically adds your project’s Scala version (such as _2.12) to the end of the artifact name.

NOTE: To get more details click here.

0
votes

summing up the comments since perhaps it is a bit hard to know what you should do

In general, if you get an "Unresolved dependencies" error, look at mvnrepository.com, search for your artifact:

https://mvnrepository.com/artifact/org.apache.flink/flink-scala

This tells you (second column) which Scala versions are supported by it. In this case, the library is available for 2.11.x and 2.12.x.

Thus, you have to use a Scala version compatible with that in your build, in build.sbt:

ThisBuild / scalaVersion := "2.12.10"