sbt: a simple build tool for scala and java

  • https://github.com/harrah/xsbt/wiki
  • install: sbt-launch.jar und sbt auf ~/bin kopieren
  • im ~/.sbt Directory können globale Konfigurationen definiert werden,
    • z.b um lifty zu installieren:
      • in ~/.sbt/plugins/build.sbt
        resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
        
        addSbtPlugin("org.lifty" % "lifty" % "1.7.5-SNAPSHOT")
        (entgegen Anleitung funktioniert zurzeit nur snapshot)
      • in ~/.sbt/build.sbt seq( Lifty.liftySettings : _*)
      • falls Fehler: remove ~/.ivy2/cache and all folders named target in ~/.sbt (recursivly)
      • lifty learn lift https://raw.github.com/Lifty/lifty/master/lifty-recipe/lifty.json
  • start: cd baseDirectory wkData/inf/scala/sbt/helloWorld, sbt und dadrin run
  • ein Projekt sitzt in einem baseDirectory und per Default, benutzt Maven Directory Struktur
    • baseDir/
      • src/
        • main/
          • resources/ →<files to include in main jar here>
          • scala/ → <main Scala sources>
          • java/ →<main Java sources>
        • test/
          • resources/ →<files to include in test jar here>
          • scala/ → <test Scala sources>
          • java/ →<test Java sources>
      • project →<project Definitionen (rekursiv)>
      • target →<generiertes>
  • häufigste sbt commands
    • clean Deletes all generated files (in the target directory).
    • compile Compiles the main sources (in src/main/scala and src/main/java directories).
    • test Compiles and runs all tests.
    • console Starts the Scala interpreter with a classpath including the compiled sources and all dependencies. To return to sbt, type :quit, Ctrl+D (Unix), or Ctrl+Z (Windows).
    • run <argument>* Runs the main class for the project in the same virtual machine as sbt.
    • package Creates a jar file containing the files in src/main/resources and the classes compiled from src/main/scala and src/main/java.
    • help <command> Displays detailed help for the specified command. If no command is provided, displays brief descriptions of all commands.
    • reload Reloads the build definition (build.sbt, project/*.scala, project/*.sbt files). Needed if you change the build definition.
    • triggered execution: z.B. ~compile compiliert etwas, sobald ein source File geändert (saved) wird
    • command history: mit up/down, oder !, z.B. !ru letzter command der mit ru anfing, !?oa der oa enthält
    • tab: command completion (List mit Vorschlägen) einfach oder mehrfach
  • keys (Konfigurationswerte) sind geScop't in drei Dimensionen: {<build-uri>}<project-id>/config:key(for task-key)
    • {<build-uri>}<project-id> → Projekt Achse, default aktuelles Projekt
    • /config → Config Achse, z.B. test
    • (for task-key) &arr; task axis, Default Global