How to debug a lift application under eclipse or idea

79 views
Skip to first unread message

smartmobili

unread,
Dec 31, 2011, 6:59:17 AM12/31/11
to Lift
Hi,

Sorry to ask here but I am a total newbie in scala, lift and I am
trying to debug an existing application (webmail).
So I am working on macos with the following setup:

Scala-2.9.1+sbt-0.7.7+lift+cappuccino.

So generally when I want to start my application I just start sbt then
I enter jetty-run and I can access my app at localhost:8080.So far so
good.
But what if I want to use an IDE like eclipse or idea and put some
breakpoints to understand what exactly is going on, how am I supposed
to do that ?
I have found some explanation about idea on stackoverflow but doesn't
seem to be updated because I couldn't even find the options they were
talking about.
If someone could point me to an url talking about that or explain to
me it would help a lot.


Thanks

Everson Alves da Silva

unread,
Dec 31, 2011, 7:35:15 AM12/31/11
to lif...@googlegroups.com
Hello,

Here's what I have, it might help you:

In sbt (0.11.2) run script, I added the following jvm args: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

Then every time you start sbt, it will be waiting for a debug connection on port 5005.

In Idea, you create a remote debug configuration, with option to attach on port 5005 and select the appropriate 'Search sources' . Everything else you can leave the default. Then whenever you want to start a debug session, just run this configuration. When you stop debugging from IDEA, sbt will start to listen again until it ends.

When you want to 'sbt' multiple projects with debug enabled you will need to configure a different port on each. That's why I have sbt and sbt_debug scripts. I only use sbt_debug when I need to debug. 

Hope that helps.

Happy New Year to all the Lift community!

Damian Helme

unread,
Dec 31, 2011, 7:53:10 AM12/31/11
to lif...@googlegroups.com
Hi,

I can recommend Eclipse - it's working very nicely for me. Off the top of my head the steps are ...

Assuming you have Eclipse installed, and assuming your project has been created from the lift-basic template (this comes with a built-in jetty run'able class):

1) Install the Scala IDE plugin for Eclipse: http://scala-ide.org/docs/user/gettingstarted.html
3) Open your project in Eclipse, in the Package Explorer, navigate down to src/test/scala/default package
4) Right click on RunWebApp, select 'Debug As -> Scala Application'

And, hey-presto! you should be able to set break-points and step through the code in the Eclipse debugger.

I can't remember the details of sbt 0.7 (I use 0.11.x), but you may also have to compile the tests in sbt in order to generate the RunWebApp.class file for Eclipse.

Give that a try and let me know if you have any problems. 

Cheers

Damian.

smartmobili

unread,
Dec 31, 2011, 8:14:29 AM12/31/11
to Lift
Ok thanks everyone! I will try your suggestions with eclipse and idea
and I will choose the best option for me.
Another question is : should I upgrade my sbt version to 0.11.x ?

NOTE:
I am also looking for a freelancer able to work for a few weeks on a
webmail backend so if you are interested please let me know (tell me
how much you charge).

Damian Helme

unread,
Dec 31, 2011, 8:29:44 AM12/31/11
to lif...@googlegroups.com
>> should I upgrade my sbt version to 0.11.x ? 
The upgrade for me worked well. In particular sbteclipse seemed to work better (works with 0.10.x upwards) than eclipsify (works with 0.7.x only, I think).

Good luck!

Damian Helme

unread,
Dec 31, 2011, 8:33:00 AM12/31/11
to lif...@googlegroups.com
Also, how to use sbt 0.10.x upwards with lift is described here ..

http://www.assembla.com/spaces/liftweb/wiki/Using_SBT

smartmobili

unread,
Dec 31, 2011, 10:11:11 AM12/31/11
to Lift
Ok I had a look at the documentation but it will take ages to read all
this stuff and to learn all those scala specific stuff (ScalaCheck,
dependency based on val, ...).
So if someone wants to help the project is located here :
https://github.com/smartmobili/kairos
And old buggy demo is here : http://kairos.smartmobili.com/capp.

Thanks

smartmobili

unread,
Dec 31, 2011, 12:08:22 PM12/31/11
to Lift
Hum finally I think I managed to do it ...
Now I need to configure the sbt- eclipse plugin.

Reply all
Reply to author
Forward
0 new messages