Javafx plugin

javafx plugin not work in gradle.kts

project(“main”){
apply(plugin=“org.openjfx.javafxplugin”)
javafx{ /////////javafx plugin not found
modules=files(“javafx.controls”)
}
}

what is the problem
thank you in advance

plugins {
id(“org.openjfx.javafxplugin”) version(“0.0.7”)
}

use the plugins block instead of apply. and you probably also need a version

Please see the documentation on the plugin page. They’ve just updated it with kotlin dsl.

when i use plugin block
plugins {
id(“org.openjfx.javafxplugin”)version “0.0.7”
}

and i got error like this

Unresolved reference: javafx

The plugins {} block must not be used here. If you need to apply a plugin imperatively, please use apply() or apply(plugin = “id”) instead.
at org.gradle.kotlin.dsl.execution.InterpreterKt$locationAwareExceptionFor$2.invoke(Interpreter.kt:561)
at org.gradle.kotlin.dsl.execution.InterpreterKt.locationAwareExceptionFor(Interpreter.kt:568)
at org.gradle.kotlin.dsl.execution.InterpreterKt.locationAwareExceptionHandlingFor(Interpreter.kt:534)
at org.gradle.kotlin.dsl.execution.InterpreterKt.access$locationAwareExceptionHandlingFor(Interpreter.kt:1)

yes i followed steps for this code but i still got same error.

  plugins{
id("org.openjfx.javafxplugin")version"0.0.7"
}
maven{
setUrl("https://plugins.gradle.org/m2/")
}
dependencies{
        classpath("org.openjfx:javafx-plugin:0.0.7")
}
javafx{
modules("openjfx:javafx-controls")
}

still i got same error

Unresolved reference: javafx

Here is a working example: https://github.com/altavir/dataforge-vis/blob/master/dataforge-vis-spatial-fx/build.gradle.kts

The example from the site probably works only with dev version.

1 Like

Dead link

We stopped using javafx plugin and switched to our own extensions: https://github.com/mipt-npm/gradle-tools/blob/master/src/main/kotlin/ru/mipt/npm/gradle/internal/fx.kt. But Gluon plugin is still there, you can use it.