openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+

Home Page:https://openjfx.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin not working, starting with Gradle 7.5

FlorianKirmaier opened this issue · comments

According to my test (in 1 project),
the dependencies are no longer added with version 7.5 or 7.6.
It does work with 7.4.

There is no error, just the dependencies are not added.

Edit: Yesterday I was able to reproduce/not reproduce it, by switching the versions. For some reason that doesn't work today. So I don't know exactly whats happening, maybe some sort of caching? Guess I will watch out for it.
As far as I've checked, they did quite some changes to the dependency resolution in 7.5.

I really need this so I patched together a temporary fix here: https://github.com/raoulsson/javafx-gradle-plugin. If it works, make sure to switch back to the original, once the next working release is out.

As far as I can tell there are no relevant code changes here @raoulsson could you point me to it?

It seems like gradle's changes to dependency resolution in 7.5 have broken something with adding dependencies to a project within a plugin. Latest (currently 8.0.2) also has the same issue.

Either the API has changed without any warning or there's a bug somewhere

After a lot of reading - the fix is to put modules at the bottom of the extension block:
Before:

javafx {
    version = '11.0.2'
    modules = ['javafx.base', 'javafx.controls', 'javafx.fxml']
    configuration = 'implementation'
}

After:

javafx {
    version = '11.0.2'
    configuration = 'implementation'
    modules = ['javafx.base', 'javafx.controls', 'javafx.fxml']
}

This is because any change to the extension calls updateJavaFXDependencies, which immediately calls clearJavaFXDependencies removing the previously added modules.