Search code examples
javaeclipsescalasbtsbteclipse

Creating Scala Project with Eclipse, sbteclipse -- directory layout


I am trying to use Eclipse as my IDE, and I have installed sbt as build tool and sbteclipse as build tool plugin for Eclipse. I followed a sbteclipse tutorial http://www.atsnippets.com/development/starting-with-simple-build-tool-sbt-for-scala.html to make my directory structure look like the following:

HelloWorld
     \- src
          \-main
              \-scala
              \-java
          \-test 
              \scala
              \java
     \target
          \-scala-2.9.1
          \-streams

Now, I want to use Eclipse as my editor (I like its checking, auto-completion and etc.). However, I do not know how to make Eclipse understand the above directory layout (I can't import the above directory as my project, or I did not find the right way to do so). Can someone share the experience?

I tried another way to start my toy project then: I used Eclipse to create a scala project. However, the directory structure is not what I wanted either. Here is my directory result by "New Scala Project", "New Package (com.foo.hello)" operation

HelloWorld
   \-src
       \-com
           \-foo
               \-hello

This is not what I wanted either, because I want to separate main from test. Any recommended way?


Solution

  • Create the directory structure you want under the HelloWorld project through Right-click -> New... -> Folder. Then on the main and test folders Right-click -> Build Path -> Use as Source Folder