18 January 2013

Getting Intellij Set up with Lift and Scala

I didn't find getting Scala set up too hard with Intellij... it was just the plugin. But getting Lift or other frameworks like Play set up with Intellij was a real beast.

I found a variety of information online and put it together as my steps to getting this working on Windows, with Intellij.  Without doing this, Intellij will not understand your imports like import net.liftweb._  and will complain about "Unknown symbol" or something like that.

What you will need installed is:
When you have all of this installed and on your windows env path, open a new console (note if your console was open while you were installing you'll need to restart it to pick up the path changes) and do the following:

1. Generating the Maven Archetype:
go into a folder of your choice and do:
mvn archetype:generate \
  -DarchetypeGroupId=net.liftweb \
  -DarchetypeArtifactId=lift-archetype-basic_2.9.1 \
  -DarchetypeVersion=2.4-M5 \
  -DarchetypeRepository=http://scala-tools.org/repo-snapshots \
  -DremoteRepositories=http://scala-tools.org/repo-snapshots \
  -DgroupId=com.company \
  -DartifactId=lift_test \
  -Dversion=1.0

On Windows, replace "\" with "^" for multi-line commands

2. Once done, run SBT in this folder with simply typing sbt and hitting ENTER.

3. In Intellij create a project and do an import project from external model (Maven) and pull this project in.


You can now write your code and save etc.  I didn't have to do anything special to get Scala to run... it was all set up from my previous work getting the scala plugin installed.

When you decide it's time to try the lift app out, you simply go to the lift project on the command line and type:
sbt update ~jetty-run


No comments:

Post a Comment