Skip to content

scala-cli can't fetch JavaFX related dependencies for ScalaFX #3168

Open
@Dieken

Description

@Dieken

Version(s)

$ scala-cli version
Scala CLI version: 1.5.0
Scala version (default): 3.5.0

$ java -version
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)

Describe the bug

$ cat scalafx.scala 
//> using scala 3.5.0
//> using toolkit 0.5.0
//> using dep "org.scalafx::scalafx:22.0.0-R33"

import scalafx.application.JFXApp3
import scalafx.geometry.Insets
import scalafx.scene.Scene
import scalafx.scene.effect.DropShadow
import scalafx.scene.layout.HBox
import scalafx.scene.paint.*
import scalafx.scene.paint.Color.*
import scalafx.scene.text.Text

import scala.language.implicitConversions

object ScalaFXHelloWorld extends JFXApp3 :

  override def start(): Unit =

    stage = new JFXApp3.PrimaryStage :
      //    initStyle(StageStyle.Unified)
      title = "ScalaFX Hello World"
      scene = new Scene :
        fill = Color.rgb(38, 38, 38)
        content = new HBox :
          padding = Insets(50, 80, 50, 80)
          children = Seq(
            new Text :
              text = "Scala"
              style = "-fx-font: normal bold 100pt sans-serif"
              fill = new LinearGradient(endX = 0, stops = Stops(Red, DarkRed))
            ,
            new Text :
              text = "FX"
              style = "-fx-font: italic bold 100pt sans-serif"
              fill = new LinearGradient(endX = 0, stops = Stops(White, DarkGray))
              effect = new DropShadow :
                color = DarkGray
                radius = 15
                spread = 0.25
          )

To Reproduce

$ scala-cli scalafx.scala
[error] ./scalafx.scala:2:19
[error] Error fetching artifacts:
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-controls/22/javafx-controls-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-controls/22/javafx-controls-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-media/22/javafx-media-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-media/22/javafx-media-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-graphics/22/javafx-graphics-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-graphics/22/javafx-graphics-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-swing/22/javafx-swing-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-swing/22/javafx-swing-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-fxml/22/javafx-fxml-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-fxml/22/javafx-fxml-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-base/22/javafx-base-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-base/22/javafx-base-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-web/22/javafx-web-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-web/22/javafx-web-22-${javafx.platform}.jar
[error] //> using toolkit 0.5.0
[error]                   ^^^^^
[error] ./scalafx.scala:3:16
[error] Error fetching artifacts:
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-controls/22/javafx-controls-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-controls/22/javafx-controls-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-media/22/javafx-media-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-media/22/javafx-media-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-graphics/22/javafx-graphics-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-graphics/22/javafx-graphics-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-swing/22/javafx-swing-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-swing/22/javafx-swing-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-fxml/22/javafx-fxml-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-fxml/22/javafx-fxml-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-base/22/javafx-base-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-base/22/javafx-base-22-${javafx.platform}.jar
[error] https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-web/22/javafx-web-22-${javafx.platform}.jar: not found: https://maven-central-asia.storage-download.googleapis.com/maven2/org/openjfx/javafx-web/22/javafx-web-22-${javafx.platform}.jar
[error] //> using dep "org.scalafx::scalafx:22.0.0-R33"
[error]                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expected behaviour

It should runs successfully. The SBT project https://github.com/scalafx/scalafx-hello-world works for scalafx-21.0.0-R32 and scalafx-22.0.0-R33.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoursierIssues tied with coursier integration.javafxIssues tied with JavaFX and ScalaFX

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions