2017-08-30 66 views
0

不知道如何解决这个问题。Maven无法解析Kotlin Maven Plugin jar

我想Kotlin运行时的this versionmaven plugin

这些都是在我的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> 

我得到这个错误:

Failure to find org.jetbrains.kotlin:kotlin-maven-plugin:jar:1.2-M2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

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

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

+0

只是FYI,似乎这个jar是在maven central(不需要'repository'部分) - https://mvnrepository.com/artifact/org .jetbrains.kotlin/kotlin-maven-plugin/1.2-M2 –

+0

@DanW它不存在,甚至有评论指出回购是 – DPM

+0

(我需要这个特定版本,即使其他版本存在于maven中心) – DPM

回答

2

我只是固定的。这真的很愚蠢。我发现,对于插件,需要定义一个插件库部分。

<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 :)

+1

好的,我没有看到它在第三方回购站,我已经更新了我的答案,即使您现在已经修复了它。 –

1

,以确保它从下载中心行家新鲜的,你需要吹走你的本地副本,所以删除该目录

〜/ .m2目录/回购/组织/ JetBrains公司/科特林/科特林 - Maven的插件

您还需要第三方回购添加到您的settings.xml在〜/ .m2目录see here

<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> 
相关问题