Scala, Lift and Pom

Spin

Top Contributor
Hallo liebe Community,

ich benutze Scala und Lift und wollte alles in Eclipse einrichten. Nun habe ich mich endlich durch viele Errors gehangelt und ich komme an einer Stelle nicht weiter:

Java:
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld Project 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-jetty-plugin:6.1.22:run (default-cli) @ helloworld >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.4.2:resources (default-resources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-resources-plugin:2.4.2:copy-resources (default-copy-resources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- yuicompressor-maven-plugin:0.7.1:compress (default) @ helloworld ---
[INFO] nb warnings: 0, nb errors: 0
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-scala-plugin:2.13.1:compile (default) @ helloworld ---
[INFO] Checking for multiple versions of scala
[WARNING] Multiple versions of scala libraries detected!
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.4.2:testResources (default-testResources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-scala-plugin:2.13.1:testCompile (default) @ helloworld ---
[INFO] Checking for multiple versions of scala
[WARNING] Multiple versions of scala libraries detected!
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< maven-jetty-plugin:6.1.22:run (default-cli) @ helloworld <<<
[INFO] 
[INFO] --- maven-jetty-plugin:6.1.22:run (default-cli) @ helloworld ---
[INFO] Configuring Jetty for project: helloworld Project
[INFO] Webapp source directory = C:\projects\vserver\xampp\htdocs\scala\helloworld\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = C:\projects\vserver\xampp\htdocs\scala\helloworld\target\classes
2012-03-27 00:08:08.621:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /
[INFO] Tmp directory =  determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = C:\projects\vserver\xampp\htdocs\scala\helloworld\src\main\webapp\WEB-INF\web.xml
[INFO] Webapp directory = C:\projects\vserver\xampp\htdocs\scala\helloworld\src\main\webapp
[INFO] Starting jetty 6.1.22 ...
2012-03-27 00:08:08.710:INFO::jetty-6.1.22
2012-03-27 00:08:08.831:INFO::No Transaction manager found - if your webapp requires one, please configure one.
00:08:09.819 [main] ERROR net.liftweb.util.Props - Failed to find a properties file (but properties were accessed).  Searched: /props/smalek.SRV017185.props, /props/smalek.props, /props/SRV017185.props, /props/default.props, /smalek.SRV017185.props, /smalek.props, /SRV017185.props, /default.props
[INFO] Started Jetty Server
2012-03-27 00:08:09.900:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Starting scanner at interval of 5 seconds.


Sobald ich jetzt den Browser aktualisiere:

Java:
HTTP ERROR 500

Problem accessing /. Reason:

    net/liftweb/http/LiftSession$$anonfun$1

Caused by:

java.lang.NoClassDefFoundError: net/liftweb/http/LiftSession$$anonfun$1
	at net.liftweb.http.LiftSession.<init>(LiftSession.scala:551)
	at net.liftweb.http.LiftRules$$anon$8$$anonfun$$init$$10$$anon$9.<init>(LiftRules.scala:378)
	at net.liftweb.http.LiftRules$$anon$8$$anonfun$$init$$10.apply(LiftRules.scala:378)
	at net.liftweb.http.LiftRules$$anon$8$$anonfun$$init$$10.apply(LiftRules.scala:378)
	at net.liftweb.http.S$class.statelessInit(S.scala:1205)
	at net.liftweb.http.LiftServlet.doService(LiftServlet.scala:258)
	at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:132)
	at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply(LiftServlet.scala:131)
	at net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:344)
	at net.liftweb.util.Helpers$.calcTime(Helpers.scala:34)
	at net.liftweb.util.TimeHelpers$class.logTime(TimeHelpers.scala:363)


Meine POM:

[XML]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


<modelVersion>4.0.0</modelVersion>
<groupId>helloworld</groupId>
<artifactId>helloworld</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>helloworld Project</name>
<inceptionYear>2010</inceptionYear>
<properties>
<scala.version>2.9.1-1</scala.version>
<!-- Common plugin settings -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
<!-- vscaladoc settings -->
<maven.scaladoc.vscaladocVersion>1.2-SNAPSHOT</maven.scaladoc.vscaladocVersion>
<vscaladoc.links.liftweb.pathsufix>scaladocs/</vscaladoc.links.liftweb.pathsufix>
<vscaladoc.links.liftweb.baseurl>http://scala-tools.org/mvnsites/liftweb</vscaladoc.links.liftweb.baseurl>
</properties>

<repositories>
<repository>
<id>scala-tools.releases</id>
<name>Scala-Tools Dependencies Repository for Releases</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>scala-tools.releases</id>
<name>Scala-Tools Plugins Repository for Releases</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-webkit_2.8.0</artifactId>
<version>2.4</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.9.1-1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>[6.1.6,7.0)</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.13.1</version>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<jvmArgs>
<jvmArg>-Xmx1024m</jvmArg>
<jvmArg>-DpackageLinkDefs=file://${project.build.directory}/packageLinkDefs.properties</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<id>default-copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src</directory>
<includes>
<include>packageLinkDefs.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
</plugin>
<plugin>
<groupId>net.sf.alchim</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2</version>
<configuration>
<downloadSources>true</downloadSources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<downloadSources>true</downloadSources>
<additionalProjectnatures>
<projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
</additionalBuildcommands>
<classpathContainers>
<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.13.1</version>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<jvmArgs>
<jvmArg>-Xmx1024m</jvmArg>
<jvmArg>-DpackageLinkDefs=file://${project.build.directory}/packageLinkDefs.properties</jvmArg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
</reporting>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
[/XML]


Vielen Dank für tipps.!!
grüße spin
 

Spin

Top Contributor
Moin, danke für dein Feedback.

Dieser schlechte Support von Scala in den IDE's macht keine Lust mehr auf Scala :/ . Ständig biegt man Eclipse dazu zu funktionieren und verliert Nerven ;(
 

Landei

Top Contributor
IntelliJ mit Scala habe ich noch nicht viel gemacht, aber Maven macht da jedenfalls mehr Spaß als in Eclipse (ja ja, ich höre es schon: "Mit Plugin XY läuft's auch in Eclipse...").

Andererseits ist Maven selbst nicht der Weisheit letzter Schluss, vielleicht solltest du in Scala-Land auch einheimische Tools nehmen. Am bekanntesten ist natürlich SBT, aber da kann ich auch keine Erfahrungswerte beisteuern.
 

Spin

Top Contributor
Hallo,

ich benutze jetzt SBT und es ist genial. Die Fehlerbeschreibungen in der Konsole sind eindeutig und man schafft es sich über eine eigene build.sbt alles aufzubauen. Sobald ich eine funktionierende LIFT Anwendung damit aufgesetzt bekommen habe, werde ich es gerne posten. Zwar ist die neuste Version von SBT auch bischen buggy - (kein erstellen von projekten möglich). Das muss man dann halt händisch machen.

Zudem hat sich ein wenig der Context von jetty geändert :/ Da muss man auch einiges anpassen. Naja ich berichte - brauche das doch alles für meine Bachelor-Arbeit, menno;(
 

Spin

Top Contributor
Ich habs, sry für Doppel-post.

(Aber sowas müsste mal in den Scala Bereich und angepinnt ),

Plattform: Windows
Tool: Sbt

build.sbt:
Java:
name := "Calendar"

version := "1.0"

scalaVersion := "2.9.0-1"

seq(webSettings :_*)

libraryDependencies ++= {
val liftVersion = "2.4-M1"
	Seq(
	    "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default" ,
	    "net.liftweb" %% "lift-testkit" % liftVersion % "compile->default" ,
	    "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default" ,
	    "org.mortbay.jetty" % "jetty" % "6.1.22" % "container",
	    "net.liftweb" %% "lift-widgets" % liftVersion,
	    "ch.qos.logback" % "logback-classic" % "0.9.26",
	    "org.slf4j" % "slf4j-log4j12" % "1.6.1",
	    "junit" % "junit" % "4.5" % "test->default",
	    "net.liftweb" %% "lift-jpa" % "2.4-M1",
	    "org.hibernate" % "hibernate-entitymanager" % "3.6.0.Final",
	    "org.hibernate" % "hibernate-validator-annotation-processor" % "4.1.0.Final",
	    "org.scala-tools.testing" %% "scalacheck" % "1.9" ,
	    "org.scalatest" % "scalatest_2.9.0" % "1.6.1",
	    "joda-time" % "joda-time" % "1.6.2"
	    )
}

Das sind meine Dependencies die man auch gerne in einer POM erstellen kann, nach Maven. Aber ich habe mich für eine .sbt entschieden nach IVY Format.

project/plugins.sbt:

Java:
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

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

FERTIG.

Natürlich noch einmal compilieren und er zieht sich alle Abhängigkeiten - Fehlerfrei. Meistens sind die Pakete nicht erreichbar oder die CHECKSUM stimmt nicht. Da hilft nur paar mal probieren, dann gehts.


Viel Spaß.
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
Spin Maven Anfang : Scala Integration Tools - Maven, Gradle, Ant & mehr 4

Ähnliche Java Themen

Neue Themen


Oben