sbt

sbtプロジェクトの作成

sbtプロジェクトのディレクトリ構造

sbt_directory.png

build.properties

plugins.sbt

build.sbt

https://github.com/kagyuu/ScalaSbtExam/blob/master/project/build.sbt

import scalariform.formatter.preferences._

lazy val root = (project in file(".")).
  settings(commonSettings: _*).
  settings(
    name := "SampleProject",
    libraryDependencies ++= Seq()
  )

lazy val commonSettings = Seq(
  organization := "your.organization",
  version := "0.1.0",
  // build.sbt supports 2.10.x only due to scalariform version. Use Build.scala for 2.11.x
  scalaVersion := "2.10.4",
  scalacOptions ++= Seq("-unchecked", "-deprecation"),
  javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
  resolvers ++= Seq(
    "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
    "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
    "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
  )
)


// scalariform code format settings
scalariformSettings // enable scalariformSettings

ScalariformKeys.preferences := ScalariformKeys.preferences.value
  .setPreference(RewriteArrowSymbols, false)
  .setPreference(AlignParameters, true)
  .setPreference(AlignSingleLineCaseStatements, true)
  .setPreference(DoubleIndentClassDeclaration, true)
  .setPreference(IndentSpaces, 2)

マルチプロジェクト

lazy val commonSettings = Seq(
  organization := "com.example",
  version := "0.1.0",
  scalaVersion := "2.11.7"
  )

lazy val root = (project in file(".")).
  aggregate(util, core)

lazy val core = (project in file("core")).
  settings(commonSettings: _*).
  settings(
  // other settings
  name := "SampleCore",
  )

lazy val util = (project in file("util")).
  settings(commonSettings: _*).
  settings(
  // other settings
  name := "SampleUtil",
  ).
  dependsOn(core)

sbt コマンド

2016-07 時点での留意点


Scala


添付ファイル: filesbt_directory.png 1957件 [詳細] filecreate_new_project.png 2231件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2016-07-17 (日) 13:15:10 (3062d)
Short-URL:
ISBN10
ISBN13
9784061426061