Monday, June 21, 2010

SBT

SBT is a great tool, it is great like maven did to java and now SBT over maven
  • Making own repository for maven using SBT is at link (GOOD)
  • checkout and read more/build from
  • SBT commands ref
  • install scala from scala-lang.org download lzPak and use java -jar to install and setup bin in PATH install sbt
    java -Dhttp.proxyUser=username -Dhttp.proxyPassword=mypassword -Xmx512M -jar `dirname $0`/sbt-launch.jar "$@"
    $ chmod u+x ~/bin/sbt

creating Project and Plugin file to generate IDEA
SBT IDEA plugin
and Eclipse project files:
  • mkdir project/build
  • mkdir project/plugins
  • nano project/build/MyProject.scala
    import sbt._
    class MyProject(info: ProjectInfo) extends DefaultProject(info)
    //with de.element34.sbteclipsify.Eclipsify
    //with IdeaProject
    {
    lazy val hi = task { println("hi Task"); None }
    }
    view raw MyProject.scala hosted with ❤ by GitHub

  • nano project/plugins/MyPlugins.scala
    import sbt._
    class MyPlugins(info: ProjectInfo) extends PluginDefinition(info)
    {
    val a = "org.markdownj" % "markdownj" % "0.3.0-1.0.2b4"
    lazy val eclipsify = "de.element34" % "sbt-eclipsify" % "0.5.1"
    val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/"
    val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
    }
    view raw MyPlugins.scala hosted with ❤ by GitHub

  • uncomment 2 lines in "MyProject.scala" for "Eclipse/Idea" plugin to get effective
  • sbt] reload
  • sbt] update
  • sbt] eclipse (this will generate .classpath and .project file for eclipse)
  • sbt] idea (this will generate .ipr and .iml file for IntelliJ Idea IDE)
  • rerun the eclipse/idea when there is change in dependencies in Project.scala this will regenerate the project files , then refresh project in IDE, all will be fine !

No comments: