Javafx plugin


#1

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


#2

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

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


#3

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


#4

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)


#5

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


#6

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.