Maven无法解析Kotlin Maven Plugin jar

不知道如何解决这个问题。

我想要这个版本的Kotlin运行时和maven插件 。

这些是在我的pom.xml中的位:

<dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-runtime</artifactId> <version>1.2-M2</version> </dependency> <build> <plugins> <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <version>1.2-M2</version> <executions> 

我把这个作为回购:

  <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>kotlin-bintray</id> <name>Kotlin Bintray</name> <url>http://dl.bintray.com/kotlin/kotlin-dev/</url> </repository> 

我得到这个错误:

在https://repo.maven.apache.org/maven2中找不到org.jetbrains.kotlin:kotlin-maven-plugin:jar:1.2-M2被缓存在本地仓库中,直到更新间隔才会重新解析中央已经过去或更新被迫

但是我没有看到任何可能是错误的。

顺便说一下,注意运行时jar被找到了,所以仓库部分必须是正确的,因为这个仓库是maven找到它的地方。 Maven的插件jar是由于某种原因不同的事情,虽然…

我刚刚修好了 这真的很愚蠢。 我发现,对于插件,需要定义一个插件库部分。

 <pluginRepositories> <pluginRepository> <id>kotlin-bintray</id> <name>Kotlin Bintray</name> <url>http://dl.bintray.com/kotlin/kotlin-dev</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> 

现在它工作。 我想我应该花更多的时间深入学习maven 🙂

为了确保它从Maven中心下载新鲜,你将需要删除你的本地副本,所以删除目录

〜/ .m2目录/回购/组织/ JetBrains的/科特林/科特林-行家-插件

你还需要在〜/ .m2的settings.xml文件中添加第三方的repo

 <settings> ... <profiles> ... <profile> <id>myprofile</id> <repositories> <repository> <id>my-repo2</id> <name>your custom repo</name> <url>https://dl.bintray.com/kotlin/kotlin-dev/</url> </repository> </repositories> </profile> ... </profiles> <activeProfiles> <activeProfile>myprofile</activeProfile> </activeProfiles> ... </settings>