[英]How to resolve a Maven dependency of type pom?
我正在尝试在 Maven 中导入一个库,即Kotlin Multiplatform
。
这是它的 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 添加到项目中,因为这个答案解释了它:
<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>
这个依赖被解决了(它只能被解析为pom
type
。然后我将它添加为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
没有解决它。
这一定是我在这里不理解的非常简单的事情,请帮忙。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.