Skip to content
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

Support using JavaFX jars from gradle classpath or defined directory #85

Open
AstralStorm opened this issue Sep 20, 2017 · 5 comments
Open

Comments

@AstralStorm
Copy link

AstralStorm commented Sep 20, 2017

Currently the plugin always attempts to find the jars on its own.

Modifying it to actually first check gradle classpath if it contains the required classes would allow including OpenJFX in the same build as a dependency.

Alternatively, some way of defining where it attempts to pull the JavaFX jars from would be required.

@AstralStorm AstralStorm changed the title Support using JavaFX jars from gradle classpath Support using JavaFX jars from gradle classpath or defined directory Sep 20, 2017
@FibreFoX
Copy link
Owner

What do you mean with "gradle classpath", normally dependencies are not inside some classpath? Can you add some build-script?

@FibreFoX
Copy link
Owner

ping @AstralStorm

@AstralStorm
Copy link
Author

AstralStorm commented Jan 22, 2018

To build the project, you have to include JavaFX plugin in it in buildscript classpath.
Unfortunately the plugin checks for existence of JavaFX in a very roundabout way and does not verify if JavaFX classes are already in Gradle classpath which will be used to build the application.

E.g. if I include it like this:

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'de.dynamicfiles.projects.gradle.plugins:javafx-gradle-plugin:8.8.2'
    }
}

It checks for existence of JavaFX when included from system Java directories and not from gradle build script classpath and not when the task is running, so I cannot do:

dependencies {
  classpath project(':openjfx')
}

nor

buildscript {
  dependencies {
    classpath 'my.openjfx:1.8.0'
  }
}

and are forced to patch JDK install in Android Studio which is highly inconvenient.

The bug is in: https://github.com/FibreFoX/javafx-gradle-plugin/blob/master/src/main/java/de/dynamicfiles/projects/gradle/plugins/javafx/JavaFXGradlePlugin.java#L99

Which should check if JavaFX is already in classpath(s) before attempting to add a potentially nonexistent jar file. (And potentially also if ant-javafx is in classpath.)

@FibreFoX FibreFoX added the JDK 8 label Feb 16, 2018
@FibreFoX
Copy link
Owner

FibreFoX commented Feb 16, 2018

As the JDK 9+ are not having the related classes anymore sitting in that JAR-file, I'm supposed to rework the whole thing, adding some additional flag for disabling this on JDK 8. First I was tempted to decline such idea, but as I'm forced to rework some parts I'm now fine with this idea ;) thanks for reporting and using this plugin.

Only one drawback: I'm not able to custom-patch the class-files anymore for JDK 8 (but it's not possible for JDK 9+ anyway 😿 )

@FibreFoX
Copy link
Owner

I'm adding some flag to disable adding ant-javafx.jar, mostly because it might get dropped in some JDK versions, will provide some SNAPSHOT-version very soon.

@FibreFoX FibreFoX added this to the project rework milestone Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants