-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't compile JavaFX projects (regression?) #767
Comments
It is probably an change in coursier, which might got a version bump as a transitive dependency. Might be related to #759 Maybe @alexarchambault sees more and can comment? Here is the <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
<parent>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>13</version>
</parent>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
<classifier>${javafx.platform}</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>13</version>
</dependency>
</dependencies>
</project> (I posted this before: https://gitter.im/lihaoyi/mill?at=5e3175b5433e1d40397320f8) |
I've just tried with Actually, I tried with some garbage classifiers like |
coursier does fetch the OS-dependent artifacts. It does from the CLI at least: $ cs fetch org.openjfx:javafx-controls:13
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-base/13/javafx-base-13-linux.jar
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-graphics/13/javafx-graphics-13.jar
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-graphics/13/javafx-graphics-13-linux.jar
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-base/13/javafx-base-13.jar
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-controls/13/javafx-controls-13-linux.jar
~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjfx/javafx-controls/13/javafx-controls-13.jar Same kind of result on macOS. You might be missing OS and JDK-related infos in the way you're calling the coursier API. The high level API of coursier sets them up this way. @lefou If that's a possibility for you, I would advise using the higher level API ( |
@alexarchambault Thanks for your comments. I'll have a look. |
For the record, bumped into that as well when updating mill to > 0.5.3 |
Hello, any news on this issue? Thanks. |
No, we discussed the implementation a bit (in #775), but nobody did the work yet. |
I may need to work around this issue, and wanted advice. I have done the following for now, and it seems to work. Is this likely to cause some trouble somewhere else?
|
@siddhartha-gadgil |
Thanks. I will watch out for this, especially with transitive dependencies. |
I updated PR #775 to gather some feedback. |
Just a head's up for those who have not been following. Positive feedback at scalafx/scalafx#343 (comment). Discussion found here. @lefou Nice work! 8-) |
I merged PR #775. Give it some time to build and publish. After that you should be able to pull the latest mill snapshot release or mill >= 0.9.7 when available. You need to adapt the coursier resolution process by overriding import mill._
import mill.scalalib._
object javafx extends JavaModule {
override def resolutionCustomizer = T.task {
Some((_: coursier.core.Resolution).withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap)))
}
def ivyDeps = Agg(ivy"org.openjfx:javafx-controls:13.0.2")
} This example reads all OS properties from the current system properties, but of course you could also set specific props. |
Isn’t it possible to have the |
@s-bernard Sure, it is possible, but it also makes the build less reproducible, as those variables may differ on different machines. |
OK but as you say, even with the current default, a build is already not completely reproducible between different machines. And this setting still makes build deterministic on a given system, which is the most important. Finally, wasn’t the goal of maven profiles to adapt the build to the current system? Specially to allow the use of system library like javafx does? On the plus side, it will really make BTW, thank you very much for solving this issue. |
Unless more users vote in, I'm not going to make it the default. My reasons are based on personal experience being a developer for more than 2 decades. I could imaging that we add some extra trait |
I like the idea of a trait. I prefer |
Sorry to resurrect this issue, but @lefou's workaround isn't working for me.
Nor is @alexarchambault's CLI command.
Did something change with coursier or with JavaFX 17? |
Something rings a bell, but I don't know if it is related. A quick search revealed this sbt issue sbt/sbt#6564 and this ScalaFX issue scalafx/scalafx#362 |
@charego You can take a look at the javaFXMill project for a working example. Unfortunately I have not updated to the latest Mill version. But it may provide hints as to why your example is not working. EDIT: working with 0.9.11 now (0.10.0-M5 also works but you need to use millw) |
Thanks! I can proceed by tweaking the resolution customizer with @s-bernard's suggestion: override def resolutionCustomizer = T.task {
Some((_: coursier.core.Resolution)
.withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap))
.withExtraProperties(Seq(("javafx.monocle", "false")))
)
} This makes sense because mill 0.9.11 depends on an older coursier that doesn't have the fix in coursier/coursier#2176. It's unclear why my |
More precisely, since commit a124774, a simple JavaFX project cannot compile and log the following errors:
Basically it cannot find the JavaFX packages.
Latest commit tested: 80eb7e0
Tested with java-11-graalvm and java-11-openjdk.
Was working as expected before a124774.
Sample code
cat build.sc
cat javafx/src/ButtonApp.java
cat javafx/src/Main.java
The text was updated successfully, but these errors were encountered: