Theres the itch again. I thought of something cool to code, fired up my IntelliJ.
Splash screen shows up…
…
Loading Plugins..
…
Waiting..
…
Then I thought of looking at my blog feeds… then twitter. An interesting article from InfoQ caught my attention. About the recent Visual Studio 11 Beta. Sigh… I have not touched Visual Studio for so many years now… I wish Java IDEs are like it too. Fast, not resource hogging. Wait, I forgot, about a while ago I opened my IntelliJ IDE to code something in Scala. Is it opened yet? Oh it is! But what was my world changing idea again? Uhh.. ummm..
I am easily distracted. This happens to me many times. Sometimes, just opening a simple text editor would keep me from distractions.
So I decided to do something about it. I will do my quick hacks in Sublime Text 2.
First I setup my sbt np plugin. NP will help me generate my SBT project easily which I will show later.
Setup my NP settings
vim ~/.sbt/plugins/build.sbt
Then add the following to that file
addSbtPlugin("me.lessis" % "np" % "0.2.0") resolvers += "lessis" at "http://repo.lessis.me"
Dont remove the extra line. SBT uses it as delimiter.
Then add the following to ~/.sbt/np.sbt
touch ~/.sbt/np.sbt
echo "seq(npSettings:_*)" >> ~/.sbt/np.sbt
Now that I have my np sbt plugin setup. I can start quickly generating my sbt project with the following steps.
mkdir sbtproject
cd sbtproject
sbt
[info] Loading global plugins from /Users/hugeaim/.sbt/plugins
[info] Set current project to default-2a75f7 (in build file:/Users/hugeaim/apps/projects/sandbox/sbtproject/)
> np name:myproject
[info] Generated build file
[info] Generated source directories
[success] Total time: 0 s, completed Feb 25, 2012 11:53:48 AM
I can then open this folder with Sublime Text 2.
Next I need to setup my Sublime to use a custom build system
Restart the editor. Then select SBT as the build system for this project.
Everytime you want to test if your code builds, just press Super+B. Navigate through the build errors using F4 and Shift+F4.
Alternatives
Instead of using NP, I could have used
$ touch build.sbt
$ mkdir -p src/{main,test}/scala
$ e build.sbt # fill in the basics (name, organization, version)
$ touch README.md && e README.md
$ sbt
# start coding
And instead of using sublime build system, I could just use
sbt ~compile
Which would automatically compile my project everytime a new file is saved.
Thats it. But of course, I love IntelliJ. It is one of my favorite IDE for Java.


[...] You will also need to install NP if you want by referring to my previous post. [...]