Setting up a Scala Lift project in Eclipse

I am trying to set up my first scala elevator project in Eclipse and it is not easy (TM).

What I did was set up the project through Maven with

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 

Then I created an eclipse project from this using mvn eclipse:eclipse (because it is hellish to figure out all the dependencies and add them all to the build path manually)

Then the project conflicts with the installed version of scala. So I removed the three existing scalalang references from the build path and added my own scala to the build path. I am 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 know the answer to the Scala -Lift project in Eclipse scala IDE errors , asking me to ask the question http://groups.google.com/group/scala-ide-user , but I was hoping someone here could point me to answer so that someone else with the same problem can find the answer too

+4
source share
4 answers

I advise you to use the elevator with sbt. Here you can find the project template https://github.com/viktortnk/lift-quickstart using sbt 0.11.2 and raise 2.4
It also includes an eclipse sbt plugin for working in scala -ide.
Hope this helps you.

+5
source

I find if you use sbt 0.11 and the sbteclipse plugin, it does the magic for you.

https://github.com/harrah/xsbt

https://github.com/typesafehub/sbteclipse

+3
source

I know this question is old, but it is quite high in the search results, so I wanted to add an updated answer.

The latest Scala IDE (2.1 M3) is getting pretty good, as is maven's integration. I have an open source demo project:

https://github.com/awkay/lift_squeryl_demo

which gives instructions for setting up eclipse with the following features:

  • Just import the elevator project based on this pom (which uses Scala 2.9 / Lift 2.5) as "Existing Maven Project". Done. Do not run anything else. There are no sbt files to generate. There are no eclipse project files to generate ... it just works.
  • Great support for Scala, including implicit highlights, excellent debugging of the initial level.
  • Web Tool Server Support (launch / debug your webapp in the eclipse servers tab)
  • JRebel support for reloading the class on the fly (there is a free license for this!)
  • Typical maven support for building and packaging the command line.
  • The possibility of any number of Java web applications on one instance of tomcat, in cases where you have to deal with integration between applications.

The result is an experience that requires no command line interaction at all, and includes ultra-fast web development edit-save-reload. It really gives you the experience of dynamic language development.

+2
source

I don’t know if you have such a problem, but sometimes you need to make sure that the Scala library appears in front of the JRE library in the path of the project class (or runs the configuration used to execute it).

http://www.assembla.com/spaces/scala-ide/tickets/1000119-classnotfoundexception-trying-to-run-scala-app-in-helios

+1
source

Source: https://habr.com/ru/post/1381008/


All Articles