Hello Lift community,I'm a JEE developer and I'm looking for a cool and powerful web-framework, which can use my JEE business/backend components (should be simply possible with an JNDI lookup of my EnterpriseJavaBeans). So I found the liftweb.net page and I'm really interested in using the Lift framework (because it is flexible as rails, grails, etc. - I need no persistence-layer from a web-framework, while this already exist's in my JEE environment ).My aim:- create a base-lift project using maven instead of the sbt ( it should be integrated as a module into an existing maven-project later on )- I would like to use the lift 2.5-M2 version- I would like to use the scala version 2.9.2- with that base I want to learn the power of lift (by reading the exploring.lift /simply.lift books)- in addition I also have to learn scala ( that should not be a big problem )- create a REST interface, that should be used from lift itself, but also give the chance, that another client (like an android-app/ iOs app) can use the interface. Business objects should interpreted/mapped/converted as JSON objects for client's- I'm using a JBoss AS 7.1 app-server. I think it should not be a problem to deploy the lift-war file to the jboss instead of a jetty server. If not, then a jetty will be used for the web-client.My problem:At the moment it is hard to create a simple base web-app structure. Beside the simply-lift book I've started to read the exploring-lift book.But following does not work ( Exploring Lift ) :Next, we use Maven’s archetype:generate command to create the skeleton of our project:mvn archetype:generate -U \-DarchetypeGroupId=net.liftweb \-DarchetypeArtifactId=lift-archetype-blank \-DarchetypeVersion=2.0 \-DarchetypeRepository=http://scala-tools.org/repo-releases \-DgroupId=demo.helloworld \-DartifactId=helloworld \-Dversion=1.0-SNAPSHOTit will be created, but the following partMaven should output several pages of text. It may stop and ask you to confirm the properties configuration, in which case you can just hit <enter>. At the end you should get a message that says BUILD SUCCESSFUL. You’ve now successfully created your first project! Don’t believe us? Let’s run it to confirm:
cd helloworld
mvn jetty:rundoes not work.mvn jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld Project 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.22:run (default-cli) @ helloworld >>>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.818s
[INFO] Finished at: Fri Nov 02 10:58:22 CET 2012
[INFO] Final Memory: 5M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project helloworld: Could not resolve dependencies for project demo.helloworld:helloworld:war:1.0-SNAPSHOT: Failed to collect dependencies for [net.liftweb:lift-mapper:jar:2.0 (compile), javax.servlet:servlet-api:jar:2.5 (provided), junit:junit:jar:4.7 (test), org.mortbay.jetty:jetty:jar:[6.1.6,7.0) (test), org.scala-lang:scala-compiler:jar:2.7.7 (test)]: No versions available for javax.mail:mail:jar:[1.4,1.4.3) within specified range -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExceptionMy next try is to call a mvn install (I think it should be executed, before I can start the jetty), but that doesn't work, too. It will return the same error above.It's a pity. ( In addition this is not a solution to use newer releases of lift / scala )Then I have downloaded the lift tar, which includes the different base projects of lift. They are all configured for the sbt.Should I use the blank project, remove all sbt artefacts and create a own pom.xml? But then the big question is, what are the required dependencies, what do I have to configure? ...I hope, some of you can help me, what I have to do, to create a lift-2.5/scala 2.9.2 blank web project with maven. Or can give me a base pom.xml, which can be used for an own project.Thank's a lot! : )Kind regards!Christian
<properties>
<version.lift>2.5-M1</version.lift> <version.scala-maven-plugin>3.1.0</version.scala-maven-plugin> <version.scala>2.9.1</version.scala></properties>
...
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-webkit_${version.scala}</artifactId>
<version>${version.lift}</version>
</dependency>
<dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${version.scala}</version></dependency>
....
<plugins>
<plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>${version.scala-maven-plugin}</version> <configuration> <jvmArgs> <jvmArg>-Xss1m</jvmArg> <jvmArg>-Xmx512m</jvmArg> </jvmArgs> <scalaVersion>${version.scala}</scalaVersion> <recompileMode>modified-only</recompileMode> </configuration> </plugin></plugins>
Okay, next try:If I want to start with a new maven-lift project, is it enough to use the scala / lift-webkit dependencies?
Is following possible:- Using the base project ( scala_29/lift_blank ) from the lift - download archive- Create an own pom file to use it as a maven project- Add the dependencies appropriate to your pom filesMany thanks for your help!!
Those templates for 2.5 are very well maintain, I make sure they all work as we release new versions of lift, so, if you decide to go the sbt route you can trust them.
Thanks
Diego
Diego
Sent from my android cell
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
<?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>de.lift</groupId>
<artifactId>lift-mvn-base</artifactId>
<name>lift maven base project</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<properties>
<version.scala>2.9.1</version.scala>
<version.lift>2.5-M1</version.lift>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${version.scala}</version>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-mapper_${version.scala}</artifactId>
<version>${version.lift}</version>
</dependency>
<dependency>
<groupId>net.liftmodules</groupId>
<artifactId>lift-jquery-module_${version.scala}</artifactId>
<version>2.5-M1-1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-mapper_${version.scala}</artifactId>
</dependency>
<dependency>
<groupId>net.liftmodules</groupId>
<artifactId>lift-jquery-module_${version.scala}</artifactId>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<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>ll
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<scalaVersion>${version.scala}</scalaVersion>
<recompileMode>modified-only</recompileMode>
</configuration>
</plugin>
</plugins>
</build>
</project><div>Error locating template:<b>/templates-hidden/default.html</b><br/>Message:<b>expected closing tag of div</b><br/>
<pre>scala.xml.parsing.FatalError: expected closing tag of divscala.xml.parsing.MarkupParser$class.errorNoEnd(MarkupParser.scala:41) net.liftweb.util.PCDataXmlParser.errorNoEnd(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParserCommon$class.xEndTag(MarkupParserCommon.scala:93) net.liftweb.util.PCDataXmlParser.xEndTag(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:543) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:396) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:417) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:542) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:396) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:98)
....
So,I've started to create my base maven pom file. Following steps I have done:
[snip]
6. mvn install works, but the jetty (started inside from eclipse) throws an error:<div>Error locating template:<b>/templates-hidden/default.html</b><br/>Message:<b>expected closing tag of div</b><br/><pre>scala.xml.parsing.FatalError: expected closing tag of divscala.xml.parsing.MarkupParser$class.errorNoEnd(MarkupParser.scala:41) net.liftweb.util.PCDataXmlParser.errorNoEnd(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParserCommon$class.xEndTag(MarkupParserCommon.scala:93) net.liftweb.util.PCDataXmlParser.xEndTag(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:543) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:396) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:417) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:542) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:98) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:396) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:98)
....
The first time some closing tags of h1 and img were expected, but that one I don't find (see the attachment). I think I can remove the whole html files, if I will start to implement the app of the exploring lift book.Okay, to this time I think it looks good.But what do you experts think? Would you optimize something of the pom, or would you do something completly different?Please give me some feedback (Remember: This should the base to learn lift by reading the free books with the examples. Later on this base will be used for the proper project).Thank you very much : )If someone has enough time or is interested in, I have add the base- project as an attachment.
Okay,I have add the jetty plugin for maven and it works! Why ever the run-jetty-run eclipse plugin has some issues?! I would like to use the run-jetty-run for hot-deployment (any changes -> automatically deployment).If I would use the maven-jetty-plugin, I have also to configure the jrebel plugin? (this requires a licence, right?) Or are there another ways for hot-deployment techniques?What do you think about the pom configuration (especially the scala / lift config). Is it okay, or do you prefer some other settings when writing lift apps?Also here is the new attachment.
På fredag 02. november 2012 kl. 20:42:45, skrev Christian Thomas <chri...@googlemail.com>:Okay,I have add the jetty plugin for maven and it works! Why ever the run-jetty-run eclipse plugin has some issues?! I would like to use the run-jetty-run for hot-deployment (any changes -> automatically deployment).If I would use the maven-jetty-plugin, I have also to configure the jrebel plugin? (this requires a licence, right?) Or are there another ways for hot-deployment techniques?What do you think about the pom configuration (especially the scala / lift config). Is it okay, or do you prefer some other settings when writing lift apps?Also here is the new attachment.Thanks, I've got it up and running now.Why the run-jetty-run Eclipse-plugin doesn't work is beyond me, I simply don't know.
I see the following "strangeness" in you app;You've chosen to use (configured in Boot.scala) Html5Properties, yet default.html isn't valid HTML5, or xhtml for that matter. IDEA highlights the errors so I spot them easily, look at line 69 for example. And - in HTML5, the HR-tag doesn't have an end-tag. default.html declares a doc-type of xhtml so either you should convert it to HTML5, to match your configured LiftRules.htmlProperties, or change LiftRules.htmlProperties.
I find it way easier to work with xhtml, so I easily can se markup-errors, as input and use HTML5 as output. Luckily, Lift supports this by configuring XHtmlInHtml5OutProperties like this:LiftRules.htmlProperties.default.set((r: Req) => new XHtmlInHtml5OutProperties(r.userAgent))While using xhtml as input-format, using data-lift and other data-* tags work.
Your maven-config looks fine, although I don't think you need http://scala-tools.org/repo-releases as a repo anymore.
When it comes to "compile-reload" JReble has a free license for use with Scala-code, that's my best option.
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>javarebel-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
...
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>