2

所以我遇到了一个项目的问题。Eclipse 会说 java.util.* 有导入错误的地方The package java.util is accessible from more than one module: <unnamed>, java.base

我挖了很多,似乎由于某种原因没有其他人真正遇到这个问题。我们办公室的每个人都是。他们告诉我,虽然我认为 2018 年的 Eclipse RC 版本可以工作,但这是他们唯一可以让它工作的版本。我稍后会尝试发布真实版本。所以我搜索了很多,然后开始使用包含的 gradle 文件。并发现问题仅在我包含 Cassandra-unit-spring testCompile 要求时才存在,因此它只会在测试用例方面引起问题。

我的假设是,这在某种程度上是 eclipse 的一个错误,因为 gradle 本身没有问题。以及 intelij。让我知道我还能在这里提供什么来进一步缩小范围。

Eclipse Build id: 20190917-1200
Eclipse with Lombok Lombok v1.18.10
Gradle 5.6.4
Oracle JDK 11.0.5
tried cassadnra-unit-spring versions 3.5.0.1 - 3.11.x
Also using spring boot 2.1.3.release

谢谢。

4

2 回答 2

0

I have excluded all (transitive) dependencies of cassandra-unit and re-included them one by one. Eventually, I found out that the library com.boundary:high-scale-lib, i.e., a transitive dependency included by org.apache.cassandra:cassandra-all, is responsible for the import errors.

The library is not Java 9+ ready, since it uses a java.base package name, i.e., java.util. This is not allowed. Unfortunately, you cannot exclude this transtive dependency, since it is required.

I found out that the release version of Eclipse 4.10 does not indicate errors in projects using the library. This is probably a UI bug in newer Eclipse versions, since I can compile and build my application with Gradle without any errors.

You can try this Eclipse version.

于 2020-07-04T15:17:53.117 回答
0

非常感谢辛科斯坦的辛勤工作

因此,根据您提供的信息,如果您在 build.gradle 文件中包含这样的 cassandra 单元测试

  testImplementation ('org.cassandraunit:cassandra-unit-spring:3.11.2.0') {
    exclude module: 'high-scale-lib'
  }

这使它可以在我的情况下工作。你当然需要使用你自己的版本等。此时这是 Gradle 6.3。

于 2020-07-14T21:42:21.897 回答