openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
361 stars 62 forks source link

Non-modular support only works for the default "run" task #25

Open dgelessus opened 5 years ago

dgelessus commented 5 years ago

24 added support for non-modular projects (thank you!). This works fine when using the default run task provided by the application plugin, but not for other JavaExec tasks (the necessary --module-path and --add-modules args are not added for them).

This is a problem when using IntelliJ: if you run a class from IntelliJ (using an "Application" run configuration) in a Gradle-based project, IntelliJ creates and runs a JavaExec task on the fly based on the run configuration's settings. Since this is a new task and not the default run task, the additional arguments for OpenJFX are not added by the plugin.

I would say that all JavaExec tasks should have the additional JVM arguments added, but that might have unintended effects on tasks that execute something non-JavaFX-related. Maybe the plugin should check which tasks have the OpenJFX jars in the classpath, and add the extra options only for those tasks?

For now I've found two workarounds for this issue:

SimonCJacobs commented 1 week ago

This problem looks to arise from the extra arguments only being added to the run task when the run task is executed. So those extra arguments are not sitting on the Task object for other plugin authors to pick up.

This should be easy enough to fix if you are accepting PRs?