2013-10-05 28 views
6

我試圖讓gen-idea工作。這是我如何安裝sbtidea插件:我得到「不是一個有效的關鍵:gen-idea」,乾淨安裝sbt 0.13+如何解決它?

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 "[email protected]" 

然後,保存後:

$ 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'?

回答

14

您使用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") 
+0

謝謝,btw如果我可能會問,如果我按照安裝說明安裝,爲什麼我實際上得到一個警告?是0.13的一個固有部分有一個自定義默認文件夾0.13而不是默認的文件夾?所以總是會發生在sbt 0.13? – Jas

+0

@Tomer安裝注意事項有些過時,此外,[默認分支爲0.12](http://take.ms/p45kg)。是的,這個有點突破0.13的變化。 –

相關問題