ScalaFX with mill instead sbt

32 views
Skip to first unread message

hubert_...@t-online.de

unread,
Apr 4, 2021, 11:16:37 PM4/4/21
to ScalaFX Users
With sbt I have successfully compiled the example "HelloStageDemo" from the web site of ScalaFX. With mill I got the following error messages:

19/25] HelloStageDemo.compileClasspath
1 targets failed
HelloStageDemo.compileClasspath Failed to load source dependencies
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-base/15.0.1/javafx-base-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-controls/15.0.1/javafx-controls-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-fxml/15.0.1/javafx-fxml-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-graphics/15.0.1/javafx-graphics-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-media/15.0.1/javafx-media-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-swing/15.0.1/javafx-swing-15.0.1-${javafx.platform}.jar
  not found: https://repo1.maven.org/maven2/org/openjfx/javafx-web/15.0.1/javafx-web-15.0.1-${javafx.platform}.jar

I suspect that the error is caused by my build.sc file:

// build.sc
import mill._, scalalib._

object HelloStageDemo extends ScalaModule{
  def scalaVersion = "2.13.2"
 

  // Determine OS version of JavaFX binaries
  lazy val osName = System.getProperty("os.name") match {
    case n if n.startsWith("Linux")   => "linux"
    case n if n.startsWith("Mac")     => "mac"
    case n if n.startsWith("Windows") => "win"
    case _                            => throw new Exception("Unknown platform!")
  }

  // Add dependency on JavaFX libraries, OS dependent
  val javaFXModules = List("base", "controls", "fxml", "graphics", "media", "swing", "web")
    .map(m => ivy"org.openjfx:javafx-$m:15.0.1;classifier=$osName")

  def ivyDeps = {
    Agg(
      ivy"org.scalafx::scalafx:15.0.1-R21"
    ) ++ javaFXModules
  }
}


But where the error is, I do not understand. I am grateful for support.

Hubert

Jarek

unread,
Apr 6, 2021, 9:31:40 PM4/6/21
to ScalaFX Users

There is something strange in your error message. You have:

javafx-base-15.0.1-${javafx.platform}.jar

but in you build.sc you have:

ivy"org.openjfx:javafx-$m:15.0.1;classifier=$osName"

so where ${javafx.platform} is coming from?

hubert_...@t-online.de

unread,
Apr 10, 2021, 12:16:16 PM4/10/21
to ScalaFX Users
Hello Jarek,
thanks for your reply. Unfortunately  in my build.sc file there was a line break before .map(...). Since I was using a narrow window, I didn't notice that a line break was present. Removing this now the .jar-files can be loaded and I can succesfully compile. However there are several run-time errors caused by parsing problems which I cannot solve. Though I like mill for the next time I will use sbt, because it works without problems.
Reply all
Reply to author
Forward
0 new messages