【发布时间】:2021-02-15 21:18:15
【问题描述】:
我正在尝试在 Maven 中导入库 Kotlin Multiplatform。
This 是 Github 仓库吗(当然其实并不重要)
重点是,它表示可以使用 Gradle 的此依赖项导入它:
dependencies {
implementation("com.github.ajalt.colormath:colormath:2.0.0")
}
显然,仅将其转换为 Maven 是行不通的:
<dependencies>
...
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
</dependencies>
所以我将它的 pom 添加到项目中,正如 this answer 解释的那样:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
这个依赖被解析了(只能解析为pomtype。然后我添加为dependency:
<dependencies>
...
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
</dependencies>
还是找不到。
我还添加了repo1,因为我没有看到Maven 在哪里寻找这个工件:
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
但仍然没有成功。我不明白为什么它不起作用。
代码可以在repo1找到,但是Maven没有解决。
这一定是个很简单的东西我这里没看懂,请大家帮忙。
【问题讨论】:
标签: java maven kotlin kotlin-multiplatform