6

I'm trying to get gen-idea to work. This is how I install sbt and the idea plugin:

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

I'm following the Manual Installation instructions:

$ 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

Inside the sbt file I put this content:

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

Then, after saving:

$ 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

Then I follow these instructions:

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

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

I enter this content:

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]         ^

How do I correct the problem of getting 'not a valid key: gen-idea'?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Jas
  • 14,493
  • 27
  • 97
  • 148

1 Answers1

14

You're using newer version of sbt and it is pretty clear about this (you got this in output):

[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/)

The solution is to put sbt plugin info in another place (or set sbt.global.base property, as stated above):

cat ~/.sbt/0.13/plugins/build.sbt 
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")
om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
  • thanks, btw if i may ask, if i installed according to installation notes why do i actually get a warning? is it an inherent part of 0.13 to have a custom default folder 0.13 instead of default one? so will always happen with sbt 0.13? – Jas Oct 05 '13 at 10:48
  • @Tomer installation notes are a little bit outdated, moreover, [default branch is for 0.12](http://take.ms/p45kg). Yes, this somewhat breaking change of 0.13. – om-nom-nom Oct 05 '13 at 11:08