javafx-gradle-plugin
javafx-gradle-plugin copied to clipboard
Using javafxplugin break the gradle test task
I cannot run the gradle test to test the spring boot javafx application, I got this error when I run gradle test
java.lang.LayerInstantiationException: Package io.learning.dauto.test in both module io.dauto.main and module io.dauto.test
This is my build.gradle.kts file
plugins {
java
application
id("org.springframework.boot") version "2.3.1.RELEASE"
id("io.spring.dependency-management") version "1.0.9.RELEASE"
id("org.openjfx.javafxplugin") version "0.0.9" // when I commend this, the gradle test run successfully, but I cannot test javafx
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
testImplementation("org.testfx:testfx-junit5:4.0.16-alpha")
implementation("org.springframework.boot:spring-boot-starter")
}
plugins.withType<JavaPlugin>().configureEach {
configure<JavaPluginExtension> {
modularity.inferModulePath.set(true)
}
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
}
application {
mainModule.set("io.dauto.main")
mainClass.set("io.learning.dauto.MainApplication")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
my minimized project structure
src
|-main
|-io.learning.dauto // package
|-MainApplication.java
|-module-info.java
|-test
|-io.learning.dauto.test // package
|-FirstTest.java
|-module-info.java
build.gradle.kts
my main module-info.java
module io.dauto.main {
}
my test `module-info.java
open module io.dauto.test {
requires org.junit.jupiter.api;
requires org.testfx.junit5;
exports io.learning.dauto.test;
}
I am using
- Gradle 6.4
- openJDK 11