加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – 我得到“不是一个有效的密钥:gen-idea”,干净安装sbt

发布时间:2020-12-16 19:09:35 所属栏目:安全 来源:网络整理
导读:我正在努力让创意发挥作用.这就是我安装sbt和idea插件的方法: http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html 我正在按照手动安装说明操作: $mkdir -p ~/bin$cd ~/bin$wget http://repo.typesafe.com/typesafe/ivy-releases/org.scala
我正在努力让创意发挥作用.这就是我安装sbt和idea插件的方法:

http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html

我正在按照手动安装说明操作:

$mkdir -p ~/bin
$cd ~/bin
$wget http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.0/sbt-launch.jar
$vi sbt

在sbt文件中我放了这个内容:

SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"

然后,保存后:

$chmod u+x ~/bin/sbt

./sbt

$./sbt
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]

.
.
.

$./sbt --version
sbt launcher version 0.13.0

然后我按照这些说明操作:

https://github.com/mpeltonen/sbt-idea

$vi ~/.sbt/plugins/build.sbt

我输入这个内容:

resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0-SNAPSHOT")

$cd ~/tmp
$~/bin/sbt
~/tmp$~/bin/sbt
[warn] The global sbt directory is now versioned and is located at /home/me/.sbt/0.13.
[warn]   You are seeing this warning because there is global configuration in /home/me/.sbt but not in /home/me/.sbt/0.13.
[warn]   The global sbt directory may be changed via the sbt.global.base system property.
[info] Set current project to tmp (in build file:/home/me/tmp/)


> gen-idea
[error] Not a valid command: gen-idea
[error] Not a valid project ID: gen-idea
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: gen-idea
[error] gen-idea
[error]         ^

如何纠正“不是有效密钥:gen-idea”的问题?

解决方法

你正在使用更新版本的sbt,而且很明显(你在输出中得到了这个):

[warn] The global sbt directory is now versioned and is located at /home/me/.sbt/0.13.
[warn]   You are seeing this warning because there is global configuration in /home/me/.sbt but not in /home/me/.sbt/0.13.
[warn]   The global sbt directory may be changed via the sbt.global.base system property.
[info] Set current project to tmp (in build file:/home/me/tmp/)

解决方案是将sbt插件信息放在另一个地方(或设置sbt.global.base属性,如上所述):

cat ~/.sbt/0.13/plugins/build.sbt 
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读