lamecoder
lamecoder

Reputation: 1

scalafx in scala project intellij (unresolved dependencies path:)

i was compiling my scalafx code in intellij in a sbt file and they kept showing me this error, please help i tried everything but its still not working

[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.scalafx:scalafx_2.13:8.0.192-R14
[error]   Not found
[error]   Not found
[error]   not found: /Users/xxxxx/.ivy2/local/org.scalafx/scalafx_2.13/8.0.192-R14/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/scalafx/scalafx_2.13/8.0.192-R14/scalafx_2.13-8.0.192-R14.pom

this is my built.sbt

name := "practical4b"

version := "0.1"

scalaVersion := "2.13.1"

// https://mvnrepository.com/artifact/org.scalafx/scalafx
libraryDependencies += "org.scalafx"%%"scalafx"%"8.0.192-R14"

Upvotes: 0

Views: 661

Answers (1)

Mike Allen
Mike Allen

Reputation: 8289

The problem here is that there is no release of ScalaFX 8/R14 that works with Scala 2.13.

Each Scala release, with the exception of bug-fix releases, has different binary compatibility requirements. So if you're using a Scala-built library with, say, Scala 2.13, you need the build of that library created for the same Scala version. Libraries created from Java code typically have binary compatibility with any version of Scala.

To determine which Scala versions are supported, they are listed in the column under Scala on Maven Central (the site linked to in your code above the libraryDependencies property): enter image description here

You can resolve this problem either by switching to Scala 2.12, by changing the Scala version as follows:

scalaVersion := "2.12.12"

Or, you can use a more recent version of ScalaFX, that will work with Scala 2.13, by changing the library dependency as follows:

libraryDependencies += "org.scalafx" %% "scalafx" % "12.0.2-R18"

to use R18, or:

libraryDependencies += "org.scalafx" %% "scalafx" % "14-R19"

for R19.

A lot will depend upon which version of Java you are using. If you need to use Scala 2.13, with one of the more recent ScalaFX releases, I would recommend using Java 11 LTS. If you must use Java 8, then stay with the ScalaFX 8/R14 release and use Scala 2.12. Let me know if you have any questions.

Upvotes: 3

Related Questions