我正在使用带有 JDK 12.0.1 和org.beryx.jlink
插件 (2.10.4) 的 Gradle(4.10.3,但我已经尝试了 5.4.1 以上的大多数版本),但是每次我尝试创建jlink 图片:
-> 任务:createMergedModule
无法从服务加载程序调用派生使用子句:com/fasterxml/jackson/databind/ObjectMapper$2.run()。
无法从服务加载程序调用派生使用子句:com/fasterxml/jackson/databind/ObjectMapper.secureGetServiceLoader()。
无法从服务加载程序调用派生使用子句:org/apache/commons/compress/utils/ServiceLoaderIterator.()。
C:\Users\MyName\IdeaProjects\myapp\build\jlinkbase\tmpjars\myapp.merged.module\module-info.java:393:错误:服务实现没有默认构造函数:XBeansXPath 提供 org.apache.xmlbeans .impl.store.PathDelegate.SelectPathInterface 与 org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath;
C:\Users\MyName\IdeaProjects\myapp\build\jlinkbase\tmpjars\myapp.merged.module\module-info.java:394:错误:服务实现没有默认构造函数:XBeansXQuery 提供 org.apache.xmlbeans .impl.store.QueryDelegate.QueryInterface 与 org.apache.xmlbeans.impl.xquery.saxon.XBeansXQuery;2 个错误
-> 任务:createMergedModule 失败
当我单击在合并中抛出错误的行时module-info.java
,它指向这两个:
provides org.apache.xmlbeans.impl.store.PathDelegate.SelectPathInterface with org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath;
provides org.apache.xmlbeans.impl.store.QueryDelegate.QueryInterface with org.apache.xmlbeans.impl.xquery.saxon.XBeansXQuery;
我的build.gradle
文件如下所示:
plugins {
id 'application'
id 'idea'
id 'java'
id 'org.openjfx.javafxplugin' version '0.0.7'
id 'org.beryx.jlink' version '2.10.4'
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.apache.commons:commons-csv:1.6'
compile 'org.apache.poi:poi-ooxml:4.1.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.9.9'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.9'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.9'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.5.0-M1'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.5.0-M1'
}
// ### Application plugin settings
application {
mainClassName = "$moduleName/path.to.myapp"
}
// ### Idea plugin settings
idea {
module {
outputDir = file("out/production/classes")
}
}
// ### Java plugin settings
sourceCompatibility = JavaVersion.VERSION_11
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
test {
useJUnitPlatform()
testLogging {
events 'PASSED', 'FAILED', 'SKIPPED'
}
}
// ### JavaFX plugin settings
javafx {
version = "12.0.1"
modules = ['javafx.controls', 'javafx.fxml']
}
// ### jlink plugin settings
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'myapp'
}
}
关于如何解决这个问题的任何想法?