无法使用Scala的sbt从存储库中获取插件 [英] Can't fetch plugins from repositories with scala's sbt

查看:323
本文介绍了无法使用Scala的sbt从存储库中获取插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用sbt编译/构建scala项目,project/plugins.sbt中提到了两个插件:

I try to compile/build scala project with sbt, there are two plugins mentioned in project/plugins.sbt:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.17")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.4")

导入sbt项目时出错:

Error while importing sbt project:

[error] sbt.librarymanagement.ResolveException: download failed: 
com.typesafe.play#sbt-plugin;2.6.17!sbt-plugin.jar
[error] download failed: com.typesafe.sbt#sbt-native-packager;1.3.4!sbt-native- 
packager.jar

似乎在存储库的证书中存在问题,因此我手动获取每个证书并使用命令将其添加到我的密钥库中(我使用ubuntu ):

Seems that problem in certificates for repositories, so i manually take each certificate and add it to my keystore with a command (i use ubuntu):

keytool -import -alias "artifact server2" -keystore /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -file _.bintray.com

但这没有帮助.

更新:我通过手动将来自回购主机的所有证书(结束和中间)添加到本地密钥库,解决了我的问题.

Update: i solved my problem by manual adding all certificates (end and intermediate) from repo's hosts to local keystore.

推荐答案

这个问题使我几乎准备将Macbook扔到窗外.

This issue had me almost ready to throw my macbook out the window.

在我的Mac上,java cacerts位于此处:

On my mac, the java cacerts is located here:

/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/security/cacerts

为了获得sbt-native-packager所需的证书,我使用了此证书(我从某人那里偷走了,现在找不到归属):

To get ahold of the required certificate for sbt-native-packager I used this (which I stole from someone, and now I can't find the attribution):

echo -n | openssl s_client -connect repo.scala-sbt.org:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/scala-sbt.cert

然后将其添加到Java信任库中,我在上面使用了Stanislav的解决方案:

Then to add it to the java trust store, I used Stanislav's solution above:

sudo keytool -import -alias "scala-sbt server" -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/security/cacerts -file /tmp/scala-sbt.cert

请记住,cacerts文件的默认密码为changeit

然后下次我运行sbt时,下载了该插件,我几乎流下了喜悦的眼泪.

And then the next time I ran sbt the plugin downloaded and I almost wept tears of joy.

这篇关于无法使用Scala的sbt从存储库中获取插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆