I have recently started working with scala. SBT is the tool of choice for Scala based projects. Let us see how to get it working on windows.
Installing SBT for Windows
Create a batch file sbt.bat which contains following script
Now, put the sbt-launch.jar file in same directory where you put sbt.bat file.Put sbt.bat on your path so that you can launch sbt in any directory by typing sbt at the command prompt.
After installing SBT if we type in sbt in the command prompt in an empty directory, this is what we are likely to see
In order to create project execute the following commands in the sbt session.
SBT creates files and directories when we executed the commands. It creates build.sbt and it contains the same values we typed in sbt session. Other directories like target and project are of little consequence to us.
My project directory contains following sub directories
This is how my my build.sbt files looks like after executing the commands in sbt session
One thing that has also changed from the past is that the src directories are not created by default. I used the sbteclipse plugin to do it for me.
Create file plugins.sbt inside project and add the following contents :
Execute the following command.
It creates common source directories like src/main/scala, src/main/test, etc and also eclipse project files.
The project is ready to imported in Eclipse IDE.That is all we need for creating Scala project using the latest SBT. We now know how to create an Scala project using SBT.