The Environment
But, to accomplish this...I first need a working development environment! I'm not going to use an IDE: this will force me to do things the "hard" way which means I'll probably learn more. Plus...there was no IDE in the early days of JDK 1.0.2, so we'll keep it old school.
Well, almost old school. First things first, I'll need a version control system. I've recently picked up on git, having been a user of various tools like Subversion, VCSS, RCS, and PVCS. I like git a lot: branching for individual features is virtually "free" and it's easy to isolate commits to a subset of team members.
Next, a build tool...well...where even to begin. I've used make, ant, maven, and gradle. Were I honest with you, I'd say that I've been woefully unimpressed with the state of the art of build tools. Maybe this is just because the underlying software in Java has become so fragmented as to make dependency mapping an impossible task, I don't know. What I do know is that the Lift/Scala community seem to be using maven...so since I have no strong opinion either way, maven it will be.
So:
$ uname -a
Darwin mieslep-personal-mbp15.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386
$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
$ mvn --version
Apache Maven 3.0.2 (r1056850; 2011-01-09 00:58:10+0000)
Java version: 1.6.0_24, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"
$ git --version
git version 1.7.5.4
$ scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
There you go: I'm currently on OS X 10.6 "Snow Leopard" and have what I assume to be a recent-ish set of utilities.
"Hello, World" ala Scala
Using the example at scala-lang.org:
$ cat <<EOF > HelloWorld.scala
> object HelloWorld {
> def main(args: Array[String]) {
> println("Hello, world!")
> }
> }
> EOF
$ scalac HelloWorld.scala
$ scala HelloWorld
Hello, world!
Things are working Scala-wise anyhow.
"Hello, World" ala Lift
Using the example at liftweb.net:
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-SNAPSHOT
(taking the defaults when prompted)
cd helloworld
mvn jetty:run
And then, http://localhost:8080 returns the nice and basic example as given. It's just that easy! Wow, I'll be done in no time! Though...one might suspect that there's a lot going on under the covers that I'll soon be pulling back :)
No comments:
Post a Comment