`
sillycat
  • 浏览: 2552842 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Lift(1)Setup a Simple Project

 
阅读更多
Lift(1)Setup a Simple Project


1.1 Install the lift app
Download the latest file https://nodeload.github.com/lift/lift_25_sbt/legacy.tar.gz/master

Expand the project with command.

>tar zxvf lift-lift_25_sbt-c62bc97.tar.gz

>mv lift-lift_25_sbt-c62bc97 life_25

>cd /Users/carl/tool/lift_25/scala_29/lift_basic

>./sbt



sbt is short for simple build tool. It is the maven to java, sbt to scala.



>container:start



It will start the web container. I can visit http://localhost:8080/.

>container:stop



1.2 Begin from the book
>git clone https://github.com/dpp/simply_lift.git



2. The ubiquitous Chat app
>cd /Users/carl/work/lift/simply_lift/chat



Make eclipse available for the project first

>./sbt

using LiftProject with sbt 0.7.5 and Scala 2.7.7



I will first check that I have scala plugin already.



Find and install this plugin https://github.com/frank06/sbt-eclipse-plugin



2.1 Import the project into Eclipse
Go to the working directory

>cd /Users/carl/tool/lift_25/scala_29/lift_basic

Delete all the files and folders, only leave the src folder.



Create a new build configuration file named build.sbt. The content of this file will be as follow:

name := "lift-basic"


organization := "com.sillycat"



version := "1.0"



scalaVersion := "2.9.1"



libraryDependencies ++= {

       val liftVersion = "2.4"

       Seq(

               "net.liftweb" %% "lift-webkit" % liftVersion % "compile",

               "net.liftweb" %% "lift-mapper" % liftVersion % "compile",

               "org.mortbay.jetty" % "jetty" % "6.1.26" % "test",

               "junit" % "junit" % "4.7" % "test",

               "ch.qos.logback" % "logback-classic" % "0.9.26",

               "org.scala-tools.testing" %% "specs" % "1.6.9" % "test",

               "com.h2database" % "h2" % "1.2.147"

       )

}




Run the command to enter sbt environment

>sbt

Command update will download all needed dependencies.

>update



We will need sbteclipse plugin to generate the Eclipse project files(.project, .classpath, etc.).

Create a file in this directory

>cd ~

>cd .sbt

>mkdir plugins

>cd plugins

>vi build.sbt

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")



This plugin will be enabled for all the projects I have.



Then I will go back to lift_basic/build.sbt

…snip…

scalaVersion := "2.9.1"


EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource

…snip…



>sbt

sbt>eclipse with-source=true



The we can import the project as usual. But still there are some red error messages on STS.



Install the plugin on normal eclipse:http://download.scala-ide.org/releases-29/stable/site/. And I will try to import the project and see. But the problem is the same.



Error Message:
object liftmodules is not a member of package net

object eclipse is not a member of package org



Solution:
Add these lines to my build.sbt

"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.RC5" %   "compile",

"org.eclipse.jetty" % "jetty-webapp" % "8.1.0.RC5" %   "test",
"net.liftmodules" % "lift-jquery-module_2.9.2" % "2.5-M1-1.0" % "compile",
"org.specs2" % "specs2_2.9.2" % "1.12.1" % "test",




>sbt update


sbt>ecipse with-source=true



We can then run the lift project in Scala IDE like this>

Right click RunWebApp.scala and select Run As --> Scala Application (or Debug As --> Scala Application). And then we can visit http://localhost:8080



Error Message:
23:29:34.331 [main] ERROR n.liftweb.http.provider.HTTPProvider - Failed to Boot! Your application may not run properly

java.lang.NoSuchMethodError: net.liftweb.util.Safe$.next()J



Solution:
There is no right now.



2.2 Try to think about other IDE
>./sbt

sbt>gen-idea



Then we can use IntelliJ IDEA to import this project.

Download the tool from here.

http://www.jetbrains.com/idea/download/index.html



But this method is only working for https://github.com/lift/lift_25_sbt.git projects and samples.



Then I import the 4 projects under this directory /Users/carl/tool/lift_25/scala_29

lift_basic

lift_blank

lift_json

lift_mvc



In every project, we can use these commands.

>cd lift_basic

>./sbt

sbt>container:start

sbt>container:stop



I can run these projects via command line. And change the codes in IDEA.



I will go and study them after play framework.



References:
http://liftweb.net/

http://simply.liftweb.net/index-Part-I.html

http://simply.liftweb.net/index-Chapter-2.html#toc-Chapter-2



http://www.spenceruresk.com/2010/10/developing-with-lift-in-eclipse/

https://github.com/frank06/sbt-eclipse-plugin

http://scala-ide.org/docs/tutorials/lift24scalaide20/index.html

分享到:
评论

相关推荐

    富士lift变频器软件Lift3.1.0Setup.rar

    Lift3.1.0Setup.exe是该软件的安装程序,用户可以通过运行这个文件来安装软件,确保与富士变频器进行顺畅的通信和配置。 首先,富士LIFT软件允许用户进行详细的参数设置。变频器有许多可调参数,如启动频率、停止...

    scaleliftmultiple Lift project templates

    1. **项目结构**:Lift项目通常遵循特定的目录结构,如`src/main/scala`存放源代码,`src/main/resources`存储资源配置,`project`目录下有SBT构建配置文件。 2. **SBT配置**:`lift-lift_22_sbt-22a67aa`可能是一...

    The lift on a small sphere in a slow shear flow,saffman

    \[ F = -\frac{8}{3}\pi \mu a^2 K V \left(1 - \frac{8}{3} \frac{\nu}{aK} \right) + \text{更小的项} \] 其中: - \(F\) 表示作用于小球上的升力; - \(\mu\) 是液体的动力粘度; - \(a\) 是小球的半径; - \(K\...

    Simply_Lift

    I have been writing Lift and Scala for 4 years, and even I learn new things about the language and the framework on a weekly basis. Please consider Lift an path and an exploration, rather than an end...

    lift-actor_2.9.1-2.6-M1.zip

    1. **Lift 框架**:Lift 是一个用 Scala 语言构建的全栈 Web 开发框架,它的设计目标是提供安全、高性能和良好的用户体验。Lift 提供了强大的模板引擎、内置的安全防护机制以及丰富的库支持。 2. **版本管理**:在...

    scala_lift

    Scala Lift 是一个基于 Scala 语言的全功能Web框架,它为开发者提供了构建高效、可扩展且反应迅速的Web应用程序的工具。在这个压缩包中,包含了三本书籍,旨在帮助学习者深入理解 Scala Lift 框架,提升开发能力。...

    lift提升算法

    **提升算法(Lift Algorithm)详解** 提升算法是一种在数据挖掘和机器学习领域广泛应用的统计方法,主要用于构建分类模型。它的全称为“迭代增益提升”(Iterative Gain Boosting)。提升算法的核心思想是通过一...

    Exploring LIFT (LIFT探索)

    LIFT的模板系统是其一大亮点,它采用了XML格式的模板,提供了丰富的标签库,如`<a>`、`<bind>`、`<bind-at>`等,这些标签让开发者能够轻松地在模板中插入动态数据或执行特定操作。此外,LIFT还支持视图和标签的概念...

    Lift in Action中文版

    【Lift in Action中文版】这本书探讨了使用Scala语言构建Web应用程序的框架——Lift。在本书中,作者深入介绍了如何利用Lift框架的特性,特别是对于有状态和无状态snippet的管理和Ajax交互。 首先,StatefulSnippet...

    Lift(LM1)_操作说明书_INR-SI47-1037e-C.pdf

    富士电机机器制御株式会社所生产的FRENIC-Lift系列变频器是一款用于控制异步电动机及同步电动机的变频装置,特别适用于上下传送装置。它能够使3相异步电动机和同步电动机实现可变速运转,提高运输效率并节约能源。 ...

    提升lift函数

    根据评分卡的评分结果分组计算lift,可以调用后绘制lift曲线

    Lift, Splat, Shoot源码及权重

    Lift, Splat, Shoot: Encoding Images From Arbitrary Camera Rigs by Implicitly Unprojecting to 3D源码及权重,给不会上网的人下载

    Python-Lift编程语言高性能可移植的函数式GPU编程语言

    **Python-Lift编程语言** Lift编程语言是一种专注于GPU(图形处理器单元)编程的高性能、可移植的函数式语言。它的设计目标是提供一个简洁、高效且易于理解的语法,以便开发者可以充分利用GPU的并行计算能力。由于...

    [Lift] Lift 应用开发技巧 (英文版)

    Lift made easy with step-by-steps recipes written by a developer for developers Practical examples covering topics from basic to advanced levels Learn to use Schemifier to automatically create tables ...

Global site tag (gtag.js) - Google Analytics