Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a Scala Lift project in Eclipse

I'm trying to set up my first scala lift project in Eclipse and it is Not Simple (TM).

What I have done is set up the project trough Maven with the following

mvn archetype:generate -U \
-DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-basic_2.9.1 \
-DarchetypeVersion=2.4-SNAPSHOT \
-DarchetypeRepository=http://scala-tools.org/repo-releases \
-DgroupId=demo.helloworld -DartifactId=helloworld -Dversion=1.0-SNAPSHOT

I then created an eclipse project from this with mvn eclipse:eclipse (because it's hellish to figure out all the dependencies, and add them all to the build path manually)

The project then conflicts with the installed Scala version. So I removed the three existing references to scalalang from the buildpath, and added my own scala to the buildpath. I'm using scala 2.9.0.

Now the project can be built, but when I try to run RunWebApp, an exception is thrown:

Exception in thread "main" java.lang.NoClassDefFoundError: RunWebApp
Caused by: java.lang.ClassNotFoundException: RunWebApp
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: RunWebApp. Program will exit.

I'm aware of the answer on Scala-Lift project in Eclipse Scala IDE errors suggesting to ask the question on http://groups.google.com/group/scala-ide-user yet I hoped someone here could point me to the answer in a way someone else with the same problem might find the answer too

like image 933
Martijn Avatar asked Dec 22 '22 06:12

Martijn


1 Answers

I advice you to use lift with sbt. You can find template project here https://github.com/viktortnk/lift-quickstart with sbt 0.11.2 and lift 2.4
It also includes sbt eclipse plugin to work in scala-ide.
I hope it will help you.

like image 188
viktortnk Avatar answered Dec 31 '22 15:12

viktortnk