Merge branch 'tweaks' of git://10.0.4.5/OpanBank/OpanBank-Scala-Lift into tweaks

This commit is contained in:
Everett Sochowski 2012-04-17 10:48:52 +02:00
commit 6db6df0b8b
7 changed files with 108 additions and 8 deletions

BIN
MavLift/.DS_Store vendored

Binary file not shown.

2
MavLift/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target
.DS_Store

View File

@ -1,12 +1,28 @@
This project contains some try outs so far.
The project is using Maven 2 as a build tool. See pom.xml for the dependancies.
The project is using sbt or Maven 2 as a build tool. See build.scala or pom.xml respectively for the dependencies.
I used IntelliJ IDEA as my IDE. It has nice autocompletion.
To run, cd into the root directory (where this file is) and run:
mvn jetty:run
----
To compile and run jetty, cd into the root directory (where this file is) and run:
$ sbt
...
> compile
> ~;container:start; container:reload /
(Note that you first have to start sbt and then on its console start jetty with the container:start task, otherwise it will exit immediately. More here: https://github.com/siasia/xsbt-web-plugin/wiki)
In OS X, sbt can be installed with $ sudo port install sbt
----
Alternatively, maven can also be used:
mvn jetty:run
Note: You may need to add the pluginGroup to the $HOME/.m2/settings.xml
@ -21,6 +37,9 @@ Note: You may need to add the pluginGroup to the $HOME/.m2/settings.xml
...
</settings>
----
To test one of the URL's use:
curl http://localhost:8080/mongodb
@ -30,6 +49,9 @@ Other important files:
SomeThing.scala - This file contains the URL routes (like urls.py) and my try outs- See serve case Req
----
I tried several approaches for scala talking to mongodb
Lift Record: works for inserts and simple (inc geo) queries. but i couldn't figure out how to sort.

View File

@ -34,11 +34,6 @@
<name>Scala-Tools Dependencies Repository for Snapshots</name>
<url>http://scala-tools.org/repo-snapshots</url>
</repository>
</repositories>
<pluginRepositories>

View File

@ -0,0 +1,2 @@
#Project properties
sbt.version=0.11.2

65
MavLift/project/build.scala Executable file
View File

@ -0,0 +1,65 @@
import sbt._
import Keys._
import com.github.siasia._
import PluginKeys._
import WebPlugin._
import WebappPlugin._
object LiftProjectBuild extends Build {
override lazy val settings = super.settings ++ buildSettings
lazy val buildSettings = Seq(
organization := "com.tesobe",
version := "0.1",
scalaVersion := "2.9.1")
def yourWebSettings = webSettings ++ Seq(
// If you are use jrebel
scanDirectories in Compile := Nil
)
lazy val opanBank = Project(
"OpanBank",
base = file("."),
settings = defaultSettings ++ yourWebSettings)
lazy val defaultSettings = Defaults.defaultSettings ++ Seq(
name := "Opan Bank",
resolvers ++= Seq(
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases",
"Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
"Scala-Tools Dependencies Repository for Releases" at "http://scala-tools.org/repo-releases",
"Scala-Tools Dependencies Repository for Snapshots" at "http://scala-tools.org/repo-snapshots"),
libraryDependencies ++= {
val liftVersion = "2.4"
Seq(
//%% means: add current scala version to artifact name
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"net.liftweb" %% "lift-mongodb" % liftVersion % "compile",
"net.liftweb" %% "lift-mongodb-record" % liftVersion % "compile",
"net.liftweb" %% "lift-widgets" % liftVersion % "compile",
// "org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container",
// "org.eclipse.jetty" % "jetty-webapp" % "8.0.4.v20111024" % "container",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "container",
"javax.servlet" % "servlet-api" % "2.5" % "provided->default",
"ch.qos.logback" % "logback-classic" % "1.0.0" % "compile",
"com.h2database" % "h2" % "1.2.138" % "runtime",
"com.mongodb.casbah" %% "casbah" % "2.1.5-1" % "compile",
"org.scalatest" %% "scalatest" % "1.6.1" % "test",
"org.scala-tools.testing" %% "specs" % "1.6.9" % "test",
"junit" % "junit" % "4.10" % "test")
},
// compile options
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
// show full stack traces
testOptions in Test += Tests.Argument("-oF")
)
}

14
MavLift/project/plugins.sbt Executable file
View File

@ -0,0 +1,14 @@
resolvers += Classpaths.typesafeResolver
// addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "1.5.0")
// resolvers += "sbt-deploy-repo" at "http://reaktor.github.com/sbt-deploy/maven"
// addSbtPlugin("fi.reaktor" %% "sbt-deploy" % "0.3.1-SNAPSHOT")
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
})