Of course I'm a lazy developer -- who not -- ? So I started searching for a sbt plugin to generate the IntelliJ IDEA project files. I found two which seem to work pretty well.
So I decided to go with the mpeltonen plugin. You have two choices. You can configure the plugin for sbt globally or on a per project basis. I will now configure the plugin for the demo project only.
If you start sbt again now for the demo project you will see it will fetch the dependencies.
Now we can use the gen-idea command to generate our project files
So I decided to go with the mpeltonen plugin. You have two choices. You can configure the plugin for sbt globally or on a per project basis. I will now configure the plugin for the demo project only.
nxp10009@NXL01366 /c/workspaces/pelssers/demo/project $ vi plugins.sbt resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/" addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT")
If you start sbt again now for the demo project you will see it will fetch the dependencies.
nxp10009@NXL01366 /c/workspaces/pelssers/demo $ sbt [info] Loading project definition from C:\workspaces\pelssers\demo\project [info] Updating {file:/C:/workspaces/pelssers/demo/project/}default-a9f0a5... [info] Resolving com.github.mpeltonen#sbt-idea;1.2.0-SNAPSHOT ... [info] Resolving commons-io#commons-io;2.0.1 ... [info] Resolving org.scala-sbt#sbt;0.12.0 ...
Now we can use the gen-idea command to generate our project files
> gen-idea [info] Trying to create an Idea module demo [info] Resolving org.scala-lang#scala-library;2.9.2 ... [info] downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.9.2/scala-library-2.9.2-sources.jar ... [info] [SUCCESSFUL ] org.scala-lang#scala-library;2.9.2!scala-library.jar(src) (887ms) [info] downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.9.2/scala-library-2.9.2-javadoc.jar ... [info] [SUCCESSFUL ] org.scala-lang#scala-library;2.9.2!scala-library.jar(doc) (5127ms) [info] Excluding folder target [info] Created C:\workspaces\pelssers\demo/.idea/IdeaProject.iml [info] Created C:\workspaces\pelssers\demo\.idea [info] Excluding folder C:\workspaces\pelssers\demo\target [info] Created C:\workspaces\pelssers\demo\.idea_modules/demo.iml [info] Created C:\workspaces\pelssers\demo\.idea_modules/demo-build.iml >And my colleague Ivan pointed me to this link from the guardian which covers the topic into more detail.
Reinventing the wheel here: http://www.guardian.co.uk/info/developer-blog/2012/sep/21/funtional-programming-principles-scala-setting-up-intellij
ReplyDelete