Learning Scala from the Scala for Data Science book and the companion Github repo, here I am particularly talking about the build file for Chapter 2, copied below (with minor modification) for reference.
name := "Logistic_regression"
organization := "My Organisation"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.11.7" // 3.2.2 does not work
libraryDependencies ++= Seq(
"org.scalanlp" %% "breeze" % "0.11.2",
"org.scalanlp" %% "breeze-natives" % "0.11.2",
"org.slf4j" % "slf4j-simple" % "1.7.5"
)
Being new to scala from python and C++, the idea of how different scala environments, dependencies etc. work is not entirely clear to me yet, but can I think of the build.sbt
as a form of Dockerfile, that can take care of the dependencies on any host by creating its own sandbox?
The repo itself uses scalaVersion := "2.11.7"
which works fine. But I wanted to match it to my system scala version (see below for the version details).
della@dell-xps ~/s/l/s/chap02 (master)> scala --version
Scala code runner version 3.2.2 -- Copyright 2002-2023, LAMP/EPFL
della@dell-xps ~/s/l/s/chap02 (master)> sbt --version
sbt version in this project: 1.8.2
sbt script version: 1.8.2
But changing it to 3.2.2 results in the following stack-trace (just the top part).
[warn] Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.scalanlp:breeze_3:0.11.2
[error] Not found
[error] Not found
[error] not found: /home/della/.ivy2/localorg.scalanlp/breeze_3/0.11.2/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/scalanlp/breeze_3/0.11.2/breeze_3-0.11.2.pom
So why is it that build.sbt cannot resolve the dependencies for a more recent scala version? Or, should it?
Further, if I want to work on the same project with the newer scala version, should I do it without sbt, and somehow installing the dependencies at the system level, available to all projects? How do I go around it?