模块从两者读取包

发布于 2025-01-11 10:22:40 字数 2505 浏览 0 评论 0原文

我发现了与我的问题类似的东西,但它与maven而不是gradle相关: java 9 未命名模块从两者读取包 [X] ...同时调试(使用 IntelliJ)

我最终决定开始在 java 中使用 new-ish 模块系统在我现有的项目上。我创建了一个 module-info.java,其中包含:

requires com.sothawo.mapjfx;
requires MaterialFX;
requires thymeleaf;
requires org.apache.httpcomponents.httpclient;
requires com.fasterxml.jackson.databind;
requires org.apache.httpcomponents.httpcore;
requires bugsnag;
requires org.jfxtras.styles.jmetro;
requires org.slf4j;
requires javafx.swing;
requires itext;
requires flying.saucer.pdf;

和我的 build.gradle:

dependencies {
implementation ('io.github.palexdev:materialfx:11.13.0') {
    exclude group: 'org.openjfx'
}

implementation ('org.jfxtras:jmetro:11.6.15') {
    exclude group: 'org.openjfx'
}

implementation 'org.thymeleaf:thymeleaf:3.1.0.M1'
implementation 'org.xhtmlrenderer:flying-saucer-pdf:9.1.22'

implementation 'com.fasterxml.jackson.core:jackson-core:2.13.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'

implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-simple:1.7.36'

implementation 'com.bugsnag:bugsnag:3.6.3'

implementation 'com.sothawo:mapjfx:3.1.0'

testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}

每次尝试构建时,我都会收到此类错误:(

module ChanceTracker.main reads package org.bouncycastle.tsp.cms from both bctsp.jdk14 and org.bouncycastle.pkix

error: the unnamed module reads package org.xhtmlrenderer.simple from both flying.saucer.pdf and flying.saucer.core

以及一堆其他似乎非常密切相关的错误)

运行依赖项显示了这一点(此处仅显示相关部分):

+--- org.xhtmlrenderer:flying-saucer-pdf:9.1.22
|    +--- com.lowagie:itext:2.1.7
|    +--- org.bouncycastle:bcmail-jdk14:1.64
|    |    +--- org.bouncycastle:bcprov-jdk14:1.64
|    |    \--- org.bouncycastle:bcpkix-jdk14:1.64
|    |         \--- org.bouncycastle:bcprov-jdk14:1.64
|    +--- org.bouncycastle:bctsp-jdk14:1.46
|    |    +--- org.bouncycastle:bcprov-jdk14:1.46 -> 1.64
|    |    \--- org.bouncycastle:bcmail-jdk14:1.46 -> 1.64 (*)
|    +--- org.bouncycastle:bcprov-jdk14:1.64
|    \--- org.xhtmlrenderer:flying-saucer-core:9.1.22

我很少尝试使用 gradle,但我在依赖项中尝试了不同的“排除”,但没有成功。

I found something similar to my problem, but it is related to maven not gradle: java 9 unnamed module reads package [X] from both ... while debugging (with IntelliJ)

I finally decided to start using the new-ish module system in java on my existing project. I created a module-info.java that contains:

requires com.sothawo.mapjfx;
requires MaterialFX;
requires thymeleaf;
requires org.apache.httpcomponents.httpclient;
requires com.fasterxml.jackson.databind;
requires org.apache.httpcomponents.httpcore;
requires bugsnag;
requires org.jfxtras.styles.jmetro;
requires org.slf4j;
requires javafx.swing;
requires itext;
requires flying.saucer.pdf;

And my build.gradle:

dependencies {
implementation ('io.github.palexdev:materialfx:11.13.0') {
    exclude group: 'org.openjfx'
}

implementation ('org.jfxtras:jmetro:11.6.15') {
    exclude group: 'org.openjfx'
}

implementation 'org.thymeleaf:thymeleaf:3.1.0.M1'
implementation 'org.xhtmlrenderer:flying-saucer-pdf:9.1.22'

implementation 'com.fasterxml.jackson.core:jackson-core:2.13.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'

implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-simple:1.7.36'

implementation 'com.bugsnag:bugsnag:3.6.3'

implementation 'com.sothawo:mapjfx:3.1.0'

testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}

I keep getting these sort of errors each time I try to build:

module ChanceTracker.main reads package org.bouncycastle.tsp.cms from both bctsp.jdk14 and org.bouncycastle.pkix

error: the unnamed module reads package org.xhtmlrenderer.simple from both flying.saucer.pdf and flying.saucer.core

(along with a bunch of others that seems to be very closely related)

running dependencies shows this (showing only the relevent parts here):

+--- org.xhtmlrenderer:flying-saucer-pdf:9.1.22
|    +--- com.lowagie:itext:2.1.7
|    +--- org.bouncycastle:bcmail-jdk14:1.64
|    |    +--- org.bouncycastle:bcprov-jdk14:1.64
|    |    \--- org.bouncycastle:bcpkix-jdk14:1.64
|    |         \--- org.bouncycastle:bcprov-jdk14:1.64
|    +--- org.bouncycastle:bctsp-jdk14:1.46
|    |    +--- org.bouncycastle:bcprov-jdk14:1.46 -> 1.64
|    |    \--- org.bouncycastle:bcmail-jdk14:1.46 -> 1.64 (*)
|    +--- org.bouncycastle:bcprov-jdk14:1.64
|    \--- org.xhtmlrenderer:flying-saucer-core:9.1.22

I rarely experiment with gradle, but I tried different 'excludes' in my dependencies with no luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜心小果奶 2025-01-18 10:22:40

固定为

implementation ('org.xhtmlrenderer:flying-saucer-pdf:9.1.22') {
    exclude group: 'org.bouncycastle'
    exclude group: 'org.xhtmlrenderer'
}

Fixed with

implementation ('org.xhtmlrenderer:flying-saucer-pdf:9.1.22') {
    exclude group: 'org.bouncycastle'
    exclude group: 'org.xhtmlrenderer'
}
冰葑 2025-01-18 10:22:40

就我而言,我必须排除该模块

implementation ("io.kubernetes:client-java:15.0.1") {
        exclude group:"com.google.code.findbugs", module: "jsr305"
}

,因为我没有看到它被使用

In my case I had to exclude the module

implementation ("io.kubernetes:client-java:15.0.1") {
        exclude group:"com.google.code.findbugs", module: "jsr305"
}

since I didn't see it being used anyway

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文