Tuesday 15 June 2010

Change directory to SBT project in IntelliJ with SBT console -


I have just installed the IntelIs and have successfully imported my project, SBT console appears in IntelliJ as expected , Although I can not use it due to the layout of my project. The whole problem is that my SBT play! The project is not a top-level directory, instead I have Maven parent palm with many child modules, among which my SBT application has been kept. How does it look like this:

  Mypocyte (parent pom) - & gt; Submodule1 (JAR) - & gt; Subduol 2 (JAR) - & gt; WebAP (SBT Play! WebApp Module)   

There is no problem running the play! Applications from Linux CLI, are already being changed from the directory MyProject \ webapp and from there SBT is executed, however, I do not see any option to set the root directory for SBT console in IntelliJ. In the import project, the default project is the root directory MyProject which is clearly not treaded as the SBT project.

Is there any way to change the "work directory" to the IntelliJ SBT plugin?

I had only one issue, here's how I am running it:

  1. Start by adding your root as a new module. In your case it would be my project, I used to focus on adding an empty module, but if you already have a pom file (this reason Is that something you like to use as SBT begs the question), you give it intelliase You can recover this import for you.
  2. Next, add a scala file to your root project directory to map sub-projects. A great explanation on how to install one of these up

    import sbt._ import key ._

      found on object HelloBuild Can be ext. Build {lazy wave root = project (id = "MyProject", base = file (".") Total (submodule1, submodule2, webapp) sluggish value submodule1 = project (id = "submodule1", base = (Submodule1)) Lazy Val submodule2 = Project (id = "submodule2", base = file "(submodule2") Lazy Val webapp = project (id = "webapp", base = file "(webapp"))    
    1. Change your SBT Rs and you should now be able to switch between projects. If you move it up and down, make sure that you use the reload command to apply the changes.

      You can list SBT projects which switch projects using the Projects command project [projectName] . Then to switch to submodule2, simply project submodule2.

No comments:

Post a Comment