我正在将JPMS
应用于我的JavaFX
和Spring Boot
应用程序:
module lmsfx {
requires java.base;
requires java.logging;
requires transitive javafx.base;
requires transitive javafx.fxml;
requires transitive javafx.graphics;
requires transitive javafx.controls;
requires transitive spring.beans;
requires transitive spring.core;
requires transitive spring.context;
requires transitive spring.tx;
requires transitive spring.data.commons;
requires transitive spring.data.jpa;
requires transitive spring.boot;
requires transitive spring.boot.autoconfigure;
requires transitive commons.logging;
exports app.lmsfx;
}
这是我的build.gradle
:
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
id 'org.beryx.jlink' version '2.6.5'
id 'com.github.ben-manes.versions' version '0.20.0'
}
// Application Configuration
ext {
appName = "LMSFX"
appLauncher = "lmsfx"
appPackaging = "lmsfx"
appModuleName = "lmsfx"
appMainClass = "io.github.julianjupiter.lmsfx.Main"
}
mainClassName = "${ext.appModuleName}/${ext.appMainClass}"
repositories {
mavenCentral()
}
javafx {
modules = ['javafx.controls', 'javafx.fxml', 'javafx.graphics']
}
jlink {
imageZip = project.file("${buildDir}/distributions/${appPackaging}-${javafx.platform.classifier}.zip")
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = "${appLauncher}"
}
}
task dist {
dependsOn clean, jlinkZip
description "Calls clean and then jlinkZip [default]"
}
defaultTasks 'dist'
dependencies {
compile('org.springframework.boot:spring-boot-starter:2.1.3.RELEASE') {
exclude group: 'commons-logging', module: 'commons-logging'
}
compile('org.springframework.boot:spring-boot-starter-data-jpa:2.1.3.RELEASE') {
exclude group: 'commons-logging', module: 'commons-logging'
}
compile group: 'commons-validator', name: 'commons-validator', version: '1.6'
}
我的应用程序在没有JPMS的情况下已经可以运行,并且Maven是构建系统。但我发现了Bruno Borges
的作品。描述说:
A JavaFX starter project with Gradle and jlink support
及其来源可在以下网址找到:https://github.com/brunoborges/javafx-jlink-starter-gradle
我能够构建他的项目,并且真正实现了其目的,即构建不再需要外部JRE / JavaFX SDK,因为它们已打包在应用程序中。
但是我无法解决很多问题:
$ ./gradlew dist run
> Configure project :
Found module name 'lmsfx'
> Task :compileJava FAILED
error: the unnamed module reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: the unnamed module reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.autoconfigure reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.autoconfigure reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.data.jpa reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.data.jpa reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.data.commons reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.data.commons reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.tx reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.tx reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.context reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.context reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.core reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.core reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.starter.data.jpa reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.starter.data.jpa reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.starter.aop reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.starter.aop reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.starter.jdbc reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.starter.jdbc reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.starter reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.starter reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module commons.validator reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module commons.validator reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module javafx.controlsEmpty reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module javafx.controlsEmpty reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module javafx.graphicsEmpty reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module javafx.graphicsEmpty reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module javafx.baseEmpty reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module javafx.baseEmpty reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.boot.starter.logging reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.boot.starter.logging reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module java.annotation reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module java.annotation reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.aop reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.aop reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.orm reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.orm reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.jdbc reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.jdbc reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.expression reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.expression reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module java.transaction reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module java.transaction reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module org.hibernate.orm.core reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module org.hibernate.orm.core reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.aspects reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.aspects reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module commons.beanutils reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module commons.beanutils reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module commons.digester reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module commons.digester reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module commons.collections reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module commons.collections reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module logback.classic reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module logback.classic reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module org.apache.logging.slf4j reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module org.apache.logging.slf4j reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module jul.to.slf4j reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module jul.to.slf4j reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.jcl reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.jcl reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module org.aspectj.weaver reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module org.aspectj.weaver reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module com.zaxxer.hikari reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module com.zaxxer.hikari reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module java.activation reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module java.activation reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module org.hibernate.commons.annotations reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module org.hibernate.commons.annotations reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module org.jboss.logging reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module org.jboss.logging reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module java.persistence reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module java.persistence reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module javassist reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module javassist reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module net.bytebuddy reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module net.bytebuddy reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module antlr reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module antlr reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module jandex reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module jandex reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module com.fasterxml.classmate reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module com.fasterxml.classmate reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module dom4j reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module dom4j reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module slf4j.api reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module slf4j.api reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module logback.core reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module logback.core reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module commons.logging reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module commons.logging reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
error: module spring.beans reads package org.apache.commons.logging from both spring.jcl and commons.logging
error: module spring.beans reads package org.apache.commons.logging.impl from both spring.jcl and commons.logging
C:\workspace\github\lmsfx\src\main\java\module-info.java:1: error: module lmsfx reads package org.apache.commons.logging from both spring.jcl and commons.logging
module lmsfx {
^
97 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
2 actionable tasks: 2 executed
排除commons-logging
并没有帮助。
请帮助我。谢谢。
注意:我见过类似的帖子,但不清楚它们是否已修复,包括建议重复的内容。建议的解决方案也不起作用。