Your SlideShare is downloading. ×
0
sbt 0.10 for beginners ? 2011-07-06 20:00:00 JST #rpscala 41 Kazuo KASHIMA
Who am I? <ul><li>Software engineer / technical consultant </li></ul><ul><li>10 months with Scala and #rpscala </li></ul><...
Goal <ul><li>Migrate my sbt 0.7.x project to sbt 0.10. </li></ul><ul><ul><li>Composed of sub projects </li></ul></ul><ul><...
What’s new in sbt 0.10.x? <ul><li>Dunno…should be better than 0.7.x </li></ul><ul><li>Two ways of configuration </li></ul>...
Basic Configuration (example) <ul><li>//  https://github.com/harrah/xsbt/wiki/Basic-Configuration </li></ul><ul><li>name :...
Basic Configuration <ul><li>Less features </li></ul><ul><li>Easier? </li></ul><ul><li>Similar to Scala </li></ul><ul><li>I...
Full Configuration <ul><li>Write in Scala -> more comfortable </li></ul><ul><li>More control </li></ul><ul><li>https://git...
Let’s get started <ul><li>https://github.com/harrah/xsbt/wiki/Migrating-from-SBT-0.7.x-to-0.10.x </li></ul><ul><li>This is...
Dependency management <ul><li>Uses Ivy </li></ul><ul><li>Examples </li></ul><ul><ul><li>&quot; commons-io &quot; % &quot; ...
Resolvers <ul><li>Pair of Name and URL </li></ul><ul><li>Example </li></ul><ul><li>val   jGitRepo  = &quot; JGit &quot; at...
Sub projects (0.7.x) <ul><li>class LifthubProject(info: ProjectInfo) extends ParentProject(info) { </li></ul><ul><li>lazy ...
Sub projects (0.10.x) <ul><li>//  not working properly yet… </li></ul><ul><li>object MyLifthubBuild extends Build { </li><...
Plugins <ul><li>https://github.com/harrah/xsbt/wiki/Plugins </li></ul><ul><li>Plugins are “object”s in sbt 0.10.x while th...
Lift with sbt 0.10.0 (not finished) <ul><li>http://moreindirection.blogspot.com/2011/06/migrating-to-sbt-010-lift.html </l...
Conclusion <ul><li>0.10 is very different from 0.7.x. </li></ul><ul><li>Looks powerful </li></ul><ul><li>“ Basic Configura...
Resources <ul><li>https://github.com/harrah/xsbt/wiki/Settings </li></ul><ul><li>https://github.com/harrah/xsbt/wiki/Full-...
Upcoming SlideShare
Loading in...5
×

sbt 0.10 for beginners?

1,912

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,912
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "sbt 0.10 for beginners?"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×