Tried using arrow-kt 1.0.1 and I can not import ar...
# arrow
o
Tried using arrow-kt 1.0.1 and I can not import arrow.core Version 1.0.0 seems to work. Any idea why arrow.core is unavailable in 1.0.1? (project uses maven)
s
It’s working fine for me in this project. https://github.com/nomisRev/Saga/blob/main/libs.versions.toml#L2
d
Same here. I’ve just started looking into it though.
o
I tried 1.0.2-SNAPSHOT and I still can not import arrow.core Made a hello world maven project with the issue: https://github.com/ovidiu-ionescu/broken-arrow
s
Ah, I see you’re using maven. I think the docs on this might be outdated. We support Kotlin MPP now, and I think the dependency for Maven needs to have a postfix
-jvm
.
Copy code
<dependency>
    <groupId>io.arrow-kt</groupId>
    <artifactId>arrow-core-jvm</artifactId>
</dependency>
☝️ 1
Gradle can automatically resolve that but I guess Maven cannot.
r
I was just replying the same, i wonder how it works in maven for KMP stuff.
d
I’m using gradle though. Still cannot import it.
Btw, I’m looking at the gradle cache. The pom file dependencies on version 1.0 is
Copy code
<dependencies>
    <dependency>
      <groupId>io.arrow-kt</groupId>
      <artifactId>arrow-core-jvm</artifactId>
      <version>1.0.0</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
And version 1.0.1
Copy code
<dependencies>
    <dependency>
      <groupId>io.arrow-kt</groupId>
      <artifactId>arrow-continuations</artifactId>
      <version>1.0.1</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>io.arrow-kt</groupId>
      <artifactId>arrow-annotations</artifactId>
      <version>1.0.1</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>animal-sniffer-annotations</artifactId>
      <version>1.19</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-common</artifactId>
      <version>1.5.31</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
o
I used arrow-core-jvm and now it works Out of curiosity: if I click on external libraries in Intellij and expand arrow-core -> arrow -> core I can see Either listed as a Kotlin class. Same for arrow-core-jvm. What makes one work and the other not?
d
Yep, I did the same thing. Replaced
"io.arrow-kt:arrow-core:$arrowVersion"
with
"io.arrow-kt:arrow-core-jvm:$arrowVersion"
r
The way I understand this in KMP is that the root artifact
arrow-core
contains the commonMain metadata and IR stuff for each platform and the actual platform specific binaries or IRs live in the
-jvm
,
-whateverPlatform
I think the issue here is that previously arrow was just a JVM project published at the same root coordinates.
JVM only projects need to change the artifact id to use the jvm platform now unless they use the gradle KMP plugin and setup the project with a jvmMain target
In that case they can use just
arrow-core
and gradle resolves the platform specific artifacts for each configured target
j
in only jvm projects there is no need to use
-jvm
too, that is strange, I will try
it is working for me, maybe a old cache is generating a conflict?
o
I looked inside the pom file of release 1.0.0. of arrow-core and it has a dependency on arrow-core-jvm. In 1.0.1 the dependency entry is gone from the pom. I think this is the reason 1.0.0 works and 1.0.1 does not.
t
j
The problem is only with maven, Gradle should work. A fix will be added asap