sbt 0.10 for beginners?
Upcoming SlideShare
Loading in...5
×
 

sbt 0.10 for beginners?

on

  • 2,142 views

 

Statistics

Views

Total Views
2,142
Views on SlideShare
2,058
Embed Views
84

Actions

Likes
1
Downloads
11
Comments
0

6 Embeds 84

http://rpscala.github.com 65
http://rpscala.github.io 11
http://us-w1.rockmelt.com 4
http://paper.li 2
http://twitter.com 1
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

sbt 0.10 for beginners? sbt 0.10 for beginners? Presentation Transcript

  • sbt 0.10 for beginners ? 2011-07-06 20:00:00 JST #rpscala 41 Kazuo KASHIMA
  • Who am I?
    • Software engineer / technical consultant
    • 10 months with Scala and #rpscala
    • A big fan of Lift
    • Spend half of my time with PHP 
  • Goal
    • Migrate my sbt 0.7.x project to sbt 0.10.
      • Composed of sub projects
      • Lift app
  • What’s new in sbt 0.10.x?
    • Dunno…should be better than 0.7.x
    • Two ways of configuration
      • Basic Configuration (DSL)
      • Full Configuration (Scala)
    • and more…
  • Basic Configuration (example)
    • // https://github.com/harrah/xsbt/wiki/Basic-Configuration
    • name := "My Project"
    • version := "1.0"
    • libraryDependencies += "junit" % "junit" % "4.8" % "test"
    • libraryDependencies ++= Seq(
    • "net.databinder" %% "dispatch-google" % "0.7.8",
    • "net.databinder" %% "dispatch-meetup" % "0.7.8"
    • )
    • defaultExcludes ~= (filter => filter || "*~")
    • publishTo <<= version { (v: String) =>
    • if(v endsWith &quot;-SNAPSHOT&quot;)
    • Some(ScalaToolsSnapshots)
    • else
    • Some(ScalaToolsReleases)
    • }
  • Basic Configuration
    • Less features
    • Easier?
    • Similar to Scala
    • IMHO, almost as complex as Scala
    • I wouldn’t recommend…
  • Full Configuration
    • Write in Scala -> more comfortable
    • More control
    • https://github.com/harrah/xsbt/wiki/Full-Configuration-Example
    • Much less information…
    • “ Use the source, Luke”
  • Let’s get started
    • https://github.com/harrah/xsbt/wiki/Migrating-from-SBT-0.7.x-to-0.10.x
    • This is for “Basic Configuration”
    • Steps
      • Install sbt 0.10.0
      • Back up the old “project” directory
      • Write Build.scala not build.sbt
      • Run (and cross your fingers)
  • Dependency management
    • Uses Ivy
    • Examples
      • &quot; commons-io &quot; % &quot; commons-io &quot; % &quot; 2.0.1 &quot;
      • &quot; org.specs2 &quot; %% &quot; specs2 &quot; % &quot; 1.3 &quot; % &quot; test &quot;
    • Corresponding maven settings
      • http://mvnrepository.com/artifact/commons-io/commons-io/2.0.1
      • http://mavenhub.com/mvn/scala-tools-releases/org.specs2/specs2_2.9.0/1.3
    • % and %%
  • Resolvers
    • Pair of Name and URL
    • Example
    • val jGitRepo = &quot; JGit &quot; at ” http://download.eclipse.org/jgit/maven &quot;
  • Sub projects (0.7.x)
    • class LifthubProject(info: ProjectInfo) extends ParentProject(info) {
    • lazy val core = project(&quot;core&quot;, &quot;Lifthub core&quot;, new CoreProject(_))
    • lazy val web = project(&quot;web&quot;, &quot;Lifthub web&quot;, new LiftProject(_), core )
    • lazy val bgtasks = project(&quot;bgtasks&quot;, &quot;Lifthub bg tasks&quot;, new BgProject(_), core )
    • }
    • protected class CoreProject(info: ProjectInfo)
    • extends DefaultProject(info)
    • with AkkaProject { // plugins are traits in sbt 0.7.x.
    • // snip
    • }
    • protected class LiftProject(info: ProjectInfo)
    • extends DefaultWebProject (info) { // web support is part of sbt 0.7.x.
    • // snip
    • }
  • Sub projects (0.10.x)
    • // not working properly yet…
    • object MyLifthubBuild extends Build {
    • import Dependencies._
    • import com.github.siasia.WebPlugin._
    • lazy val root = Project(&quot;root&quot;, file (&quot;.&quot;),
    • settings = buildSettings) aggregate (core, web, bgtasks)
    • lazy val core = Project(&quot;core&quot;, file (&quot;core&quot;),
    • settings = buildSettings ++
    • Seq (libraryDependencies := allDeps) ++
    • webSettings )
    • lazy val web = Project(&quot;web&quot;, file (&quot;web&quot;),
    • settings = buildSettings ++
    • Seq (libraryDependencies := allDeps)) dependsOn (core)
    • lazy val bgtasks = Project(&quot;bgtasks&quot;, file (&quot;bgtasks&quot;),
    • settings = buildSettings ++
    • Seq (libraryDependencies := allDeps)) dependsOn (core)
    • }
  • Plugins
    • https://github.com/harrah/xsbt/wiki/Plugins
    • Plugins are “object”s in sbt 0.10.x while they are traits in sbt 0.7.x.
    • xsbt-web-plugin https://github.com/siasia/xsbt-web-plugin
    • Akka ??
  • Lift with sbt 0.10.0 (not finished)
    • http://moreindirection.blogspot.com/2011/06/migrating-to-sbt-010-lift.html
    • ↑ Basic Configuration!
    • Steps
      • Create project/plugins/build .sbt
      • import com.github.siasia.WebPlugin._
      • Add webSettings to project’s settings
      • Add jetty to libraryDependencies
  • Conclusion
    • 0.10 is very different from 0.7.x.
    • Looks powerful
    • “ Basic Configuration” sucks.
    • Need to understand Scala and read the source, anyway.
  • Resources
    • https://github.com/harrah/xsbt/wiki/Settings
    • https://github.com/harrah/xsbt/wiki/Full-Configuration-Example
    • http://eed3si9n.com/ja/sbt-010-guide