【发布时间】:2021-08-04 11:57:53
【问题描述】:
This question 看起来非常相似,如果不完全相同的话。在那个问题中,Slaw 的第二个建议涉及修复module-info 以进行正确的模块管理似乎是合适的。但这究竟是什么意思?或者更确切地说,javafx 抱怨的我的模块有问题还是它正在谈论的其他模块?
这是我的模块信息.java
module myprogram.main {
requires javafx.controls;
requires javafx.fxml;
requires janino;
requires commons.compiler;
requires org.fxmisc.richtext;
requires wellbehavedfx;
requires zt.process.killer;
requires zt.exec;
exports com.bla.myprogram;
opens com.bla.myprogram to javafx.fxml;
}
jdk:jdk16.0.1+9
java -jar .\MyProgram.jar
@Override
public void start(Stage primaryStage) throws Exception {
System.out.println("enter start");
...
public static void main(String[] args) {
System.out.println("enter main");
launch();
}
enter main
Aug 04, 2021 1:22:52 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @6203f37a'
enter start
(如果有任何意义,这是我的 gradle.build)
plugins {
id 'java-library'
id 'application'
id 'org.openjfx.javafxplugin' version "0.0.10"
}
group 'com.bla.myprogram'
version '0.3'
def currentOS = org.gradle.internal.os.OperatingSystem.current()
def platform
if (currentOS.isWindows()) {
platform = 'win'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'mac'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
implementation "org.openjfx:javafx-base:11:${platform}"
implementation "org.openjfx:javafx-graphics:11:${platform}"
implementation "org.openjfx:javafx-controls:11:${platform}"
implementation "org.openjfx:javafx-fxml:11:${platform}"
implementation group: 'org.codehaus.janino', name: 'janino', version: '3.0.7'
implementation group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.10.6'
implementation group: 'org.fxmisc.wellbehaved', name: 'wellbehavedfx', version: '0.3.3'
implementation group: 'org.zeroturnaround', name: 'zt-process-killer', version: '1.10'
implementation group: 'org.zeroturnaround', name: 'zt-exec', version: '1.12'
}
test {
useJUnitPlatform()
}
javafx {
version = "16"
modules = [ 'javafx.controls', 'javafx.fxml']
}
mainClassName = 'com.bla.myprogram.Main'
jar {
manifest {
attributes "Main-Class": 'com.bla.myprogram.Main'
}
from { (configurations.runtimeClasspath).collect { it.isDirectory() ? it : zipTree(it) } } {
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
task createProperties(dependsOn: processResources) {
doLast {
new File("$buildDir/resources/main/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p['name'] = rootProject.name.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
【问题讨论】:
标签: java gradle javafx java-module