Skip to content

A simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files

License

Notifications You must be signed in to change notification settings

thoraage/sbt-idea-plugin

 
 

Repository files navigation

A simple-build-tool plugin/processor to create IntelliJ IDEA project files for sbt project

Requirements

- Sbt version 0.7.x (not compatible with 0.5.x series).
- IntelliJ Idea version 9.0.3 (Scala plugin 0.3.2039). Not fully compatible with Scala plugin versions prior to
0.3.2039 because of changes in config xml format.

Usage

Tool can be used either as SBT plugin or SBT processor (thanks to teigen for the processor integration!).

Usage as plugin requires modification of your project descriptor, whereas usage as processor is non-intrusive and requires only few commands on the sbt console. Instructions for both usage scenarios below.

Usage as plugin

1. In your project/plugins/Plugins.scala:

import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val sbtIdeaRepo = "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
  val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
}

2. In your project definition file:

import sbt._
class MyProject(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
   // ...
}

If you have multi-module project, plugin trait must be mixed into subprojects too, for example:

import sbt._
class MyProject(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
  lazy val mySubProject = project("my-subproject", "my-subproject", new DefaultProject(_) with IdeaProject)
   // ...
}

3. Run

 sbt update
 sbt idea

4. Import created .ipr file into Idea

Check out sbt’s plugin documentation for further details.

Usage as processor

1. Start sbt console on the root of your project

2. Enter the following sbt console commands (* is part of sbt processor command syntax):

 > *sbtIdeaRepo at http://mpeltonen.github.com/maven/
 > *idea is com.github.mpeltonen sbt-idea-processor 0.1-SNAPSHOT 
 ...
 > update
 ...
 > idea
 ...

3. Import created .ipr file into Idea

Check out sbt’s processor documentation for further details.

Configuration

You can customize some aspects of generated Idea project descriptors by creating a property file project/idea.properties
with desired properties. Currently supported properties are:

Property Description Default value
project.jdk.name Value of the ‘project-jdk-name’ attribute of ProjectRootManager component 1.6
java.language.level Value of the ‘languageLevel’ attribute of ProjectRootManager component JDK_1_6
include.sbt.project.definition.module Generate Idea Module also for SBT project definition code true

Contributors

See contributors

License

Licensed under the New BSD License. See the LICENSE file for details.

About

A simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%