DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Liftweb setup in 10 minutes - IDE and project configuration

Liftweb setup in 10 minutes - IDE and project configuration

Andrew Salvadore user avatar by
Andrew Salvadore
·
Aug. 27, 11 · Interview
Like (0)
Save
Tweet
Share
10.53K Views

Join the DZone community and get the full member experience.

Join For Free

Scala is one of the coolest programming languages out there and Lift is a revolutionary web framework that really leverages many scala features.

But it can be daunting at the beginning, even just getting your workspace setup. In this article I will go through the basic setup of your IDE, it really takes a few minutes!

Even though I've always been an Eclipse person I'm using IDEA IntelliJ with Scala cause I think is way superior. Ok let's begin. You will need IntelliJ 10.5.1, Maven or SBT.

Create the project with maven

First step is to create the project and for that we will use lift maven archetype. For the persistence layer we will use the default lift mapper. Run this command

mvn archetype:generate   -DarchetypeGroupId=net.liftweb   
-DarchetypeArtifactId=lift-archetype-basic_2.8.1
-DarchetypeVersion=2.3
-DarchetypeRepository=http:/scala-tools.org/repo-snapshots
-DremoteRepositories=http://scala-tools.org/repo-snapshots
-DgroupId=com.playamatch -DartifactId=web

You can also create a JPA based project running the same command with

archetypeArtifactId=lift-archetype-jpa-basic_2.8.1

You already have a full liftweb project! You can even run it with maven itself using the command

mvn jetty-run

Download and configure IntelliJ

Next open IntelliJ and install the scala plugin. You need to go to File -> Setting. This is where you can access all the configuration options. The equivalent of Window -> Preferences in eclipse.

Now go to the plugins, pick scala right click "Download and Install" and once done restart the IDE.

You should be able to see your code with syntax highlights and navigate through the classes already. If you want you can also download the SBT plugin for IDEA. In this tutorial I will use the command line.

Another configuration change you might want to do if you are coming from eclipse if the shortcuts. IDEA comes with an eclipse profile that will allow you to keep using all the handy shortcuts you've learned so far.



Configure SBT

I would recommend using SBT for your projects with the scala compiler is very fast ( well as fast as it gets really ;) ) Here I am using SBT 0.10.1

You need to create a build.sbt in the project root folder. This is what mine looks like, it is pretty much the standard dependencies.

/build.sbt

name := "liftplay"

scalaVersion := "2.8.1"

seq(webSettings: _*)



// If using JRebel uncomment next line
//jettyScanDirs := Nil


resolvers += "Java.net Maven2 Repository" at "http://download.java.net/maven/2/"


libraryDependencies ++= {

val liftVersion = "2.3" // Put the current/latest lift version here

Seq(

"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",

"net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",

"net.liftweb" %% "lift-wizard" % liftVersion % "compile->default")

}



// Customize any further dependencies as desired

libraryDependencies ++= Seq(

"org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "jetty", // For Jetty 7

//"org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty,test", // For Jetty 6, add scope test to make jetty avl. for tests

"org.scala-tools.testing" % "specs_2.9.0" % "1.6.8" % "test", // For specs.org tests

"junit" % "junit" % "4.8" % "test->default", // For JUnit 4 testing

"javax.servlet" % "servlet-api" % "2.5" % "provided->default",

"com.h2database" % "h2" % "1.2.138", // In-process database, useful for development systems

"ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default" // Logging

)


 

Then create another file under project/plugins (create these folders in your root project directory if you don't have them) called again build.sbt


/project/plugins/build.sbt
resolvers ++= Seq(

"Web plugin repo" at "http://siasia.github.com/maven2",

Resolver.url("Typesafe repository", new java.net.URL("http://typesafe.artifactoryonline.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns)

)



//Following means libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.1.0-""

libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-"+v))

last file is the build.properties under the project folder

/project/build.properties
project.organization=com.playamatch
project.name=liftplay
project.version=1.0-SNAPSHOT
sbt.version=0.10.1
def.scala.version=2.8.1
build.scala.versions=2.8.1
project.initialize=false

That's it. All you need to do now is an update to download all the dependencies

Get dependencies and run application

sbt update

and then you can run your new application

sbt ~jetty-run

Enable Debug for your application

If you want to debug your application just add the following to your sbt script

Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

and then create a remote application debug configuration from Run -> Edit configurations. First check your defaults are like this then click on the plus sign


and name your run configuration!

Happy coding!!!

From http://www.devinprogress.info/2011/08/liftweb-setup-in-10-minutes-ide-and.html

Integrated development environment

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 10 Things to Know When Using SHACL With GraphDB
  • Microservices Testing
  • Beyond Coding: The 5 Must-Have Skills to Have If You Want to Become a Senior Programmer
  • Using Swagger for Creating a PingFederate Admin API Java Wrapper

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: