I made a detour until I could do it, so make a note. The environment is IntelliJ. I don't know because I don't use Eclipse.
You can use org.javamodularity.moduleplugin to run modular project tests without any special configuration, but if you use TestFX Had to make the module visible using the JVM's'--add-opens' option.
Below is a sample build.gradle
build.gradle
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
id 'org.beryx.jlink' version '2.10.4'
id "org.javamodularity.moduleplugin" version "1.5.0"
}
group 'com.sample'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.12
mainClassName = "$moduleName/com.sample.Main"
repositories {
mavenCentral()
}
//javafx plugin settings
javafx {
version = "12"
modules = ['javafx.controls', 'javafx.fxml']
}
//jlink plugin settings
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher{
name = "$moduleName"
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
testCompile group: 'org.testfx', name: 'testfx-junit5', version: '4.0.15-alpha'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
//Options for TestFX
jvmArgs = [
'--add-opens', "$moduleName/com.sample.foo=org.testfx.junit5",
'--add-opens', 'javafx.graphics/com.sun.javafx.application=org.testfx'
]
}
Recommended Posts