【Scala】 Lift2.0の環境構築メモ

Lift2.0が2010年6月30日にやっとリリースされたらしいので環境構築メモを残しておいたり.

方法はsbtとmavenの2種類あるっぽいですが、sbt推奨っぽいのでsbtで環境構築。

始めにSimple build toolの設定をする.パスが通っているローカルbinフォルダ(~/bin, ~/local/bin)にsbt-launch.jarを置いて、実行ファイルを作成する

YUKI.N> wget http://simple-build-tool.googlecode.com/files/sbt-launch-0.7.4.jar
YUKI.N> vi sbt
YUKI.N> java -Xmx512M -jar `dirname $0`/sbt-launch-0.7.4.jar "$@"
YUKI.N> chmod u+x sbt

これで、ひとまずsbtの設定は終了

次にliftをdlして解凍. liftフォルダ移動という作業を行う
もしくはgit利用して同様な作業をする。(但し、安定はしてないので環境によっては動かない場合もあるので試すぐらいならtgzの方利用した方がいいかも)

ちなみにlift.tgzってありますが一応versionは2.0です(現状)(versionについては/lift/project/build/LiftProject.scalaファイルで確認できます)

YUKI.N> wget http://liftweb.net/lift.tgz
YUKI.N> tar zxf lift.tgz
YUKI.N> cd lift

or

YUKI.N> git clone http://github.com/dpp/lift_sbt_prototype.git
YUKI.N> cd lift_sbt_prototype 


次にsbtを実行してアップデート実行後サーバー起動(jetty-run)させる

YUKI.N> sbt
> update
> jetty-run

最後にlocalhost:8080にいって動作確認チェックしてとりあえず終了.

ちなみにliftでの作業は基本的にはsrcフォルダで行ないます。

srcのtree構成は以下のとおり.わりかし謎

   |-main
   |---resources
   |-----props
   |---scala
   |-----bootstrap
   |-------liftweb
   |-----code
   |-------comet
   |-------lib
   |-------model
   |-------snippet
   |-------view
   |---webapp
   |-----WEB-INF
   |-----images
   |-----static
   |-----templates-hidden
   |-test
   |---resources
   |---scala
   |-----code
   |-------snippet


あとは、liftのドキュメントなりソースを読んでWebサイトを作ればいいんじゃないでしょうかね。

備考: Lift 2.0の特徴

  • とりあえずMongoDBとCouchDBをサポートしたのがメインっぽいですかね
Lift 2.0's new features include:

-NoSQL support including built-in support for MongoDB and CouchDB
-High performance JSON support including an elegant JSON DSL and bidirectional JSON <-> Class conversion
-Powerful, concise REST support
-Support for enterprise infrastructure including JTA and LDAP
-Declarative systems for single Screen input and validation as well as multiple screen Wizards
-Radically improved development experience including much better error messages and support for dynamically changing system configuration
-Support for running Lift apps outside of a J/EE Servlet containers
-Improved Comet support including modern browser detection and better connection starvation detection
-Improved support for testing including super-concise dependency injection and run-mode detection
-Support for Simple Build Tool
Performance improvements

参考ページ