为什么 arrow-core 不适用于我的 kotlin maven 项目?

Why does arrow-core not work with my kotlin maven project?

我用 maven(3.8.3) 创建了一个 kotlin(1.6.10) 项目,spring 从 https://start.spring.io/

启动 2.6.2

然后我添加了以下依赖项:

        <dependency>
            <groupId>io.arrow-kt</groupId>
            <artifactId>arrow-core</artifactId>
            <version>1.0.1</version>
        </dependency>

如果我现在尝试在我的 kotlin 文件中包含 arrow.core.Either,它不起作用。它找不到 arrow 包。

如果我将依赖项更改为 -jvm 版本,它会起作用:

        <dependency>
            <groupId>io.arrow-kt</groupId>
            <artifactId>arrow-core-jvm</artifactId>
            <version>1.0.1</version>
        </dependency>

我也遇到过同样的问题:

<dependency>
      <groupId>io.github.microutils</groupId>
      <artifactId>kotlin-logging-jvm</artifactId>
      <version>2.1.21</version>
</dependency>

我想知道这是什么原因?为什么 -jvm 依赖项起作用而另一个不起作用?这个问题似乎与 Maven 有关,gradle 不需要 -jvm

请看这个问题:

https://github.com/arrow-kt/arrow/issues/2658

因此 1.0.1 版本中存在问题,现在恢复到 1.0.0 应该可以,或者您可以暂时使用带有 1.0.1 的 arrow-jvm 版本,并在下一次更改它发布可用。