ランチャーは、以下のいずれかの方法で、優先順位の低い順に設定できます。
これらの試行がいずれも成功しない場合は、エラーが生成されます。
アプリケーションとしての sbt のデフォルト設定ファイルは次のようになります。
[scala]
version: ${sbt.scala.version-auto}
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.5]}
class: ${sbt.main.class-sbt.xMain}
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}
[repositories]
local
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
maven-central
sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots
[boot]
directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
[ivy]
ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}
checksums: ${sbt.checksums-sha1,md5}
override-build-repos: ${sbt.override.build.repos-false}
repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
ランチャー設定のすべてのセクションを詳しく見てみましょう。
`[scala]` セクションは、Scala のバージョンを設定するために使用されます。1つのプロパティがあります。
`[app]` セクションは、ランチャーが Ivy 依存関係マネージャーを使用してアプリケーションをどのように検索するかを設定します。次のプロパティで構成されます。
`class` - アプリケーションへの「エントリポイント」の名前。エントリポイントは、次のいずれかの条件を満たすクラスでなければなりません。
`[repositories]` セクションは、Ivy がアプリケーションをどこでどのように検索するかを設定します。各行は、Ivy が検索するリポジトリを示します。
一般的なリポジトリに使用できる組み込み文字列がいくつかあります。
組み込みリポジトリに加えて、他のリポジトリは次の構文を使用して設定できます。
name: url(, pattern)(,bootOnly)(,descriptorOptional)(,skipConsistencyCheck)(,allowInsecureProtocol)
`name` プロパティは、Ivy がこの場所から解決されたモジュールをキャッシュするために使用する識別子です。`name` はすべてのリポジトリで一意である必要があります。
`url` プロパティは、Ivy がモジュールを検索するベース `url` です。
`pattern` プロパティは、Ivy がモジュールを *どのように* 検索するかを指定するオプションです。デフォルトでは、ランチャーはリポジトリが Maven スタイルの形式であると想定します。
`bootOnly` 文字列は、Ivy に起動時にのみこのリポジトリを使用するように指示するために使用されます。つまり、sbt 自体の JAR とプラグインの JAR を見つけるためです。`bootOnly` 文字列を持つリポジトリは、ビルド時の依存関係の解決には使用されません。
`skipConsistencyCheck` 文字列は、Ivy に解決したファイルのチェックサムと署名を検証しないように指示するために使用されます。
`allowInsecureProtocol` 文字列は、このリポジトリが `http://` であることについての警告を出力しないように SBT に指示します。HTTP リポジトリは重大なセキュリティリスクをもたらす可能性があるため、使用する前に慎重に検討してください。
`[boot]` セクションは、sbt ランチャーがキャッシュと設定情報をどこに保存するかを設定するために使用されます。次のプロパティで構成されます。
`[ivy]` セクションは、アプリケーションを解決するための Ivy 依存関係マネージャーを設定するために使用されます。次のプロパティで構成されます。
ランチャーの `--locate` 機能を使用する場合、このセクションはサーバーの起動方法を設定します。次のプロパティで構成されます。
プロパティ値には、変数置換を含めることができます。変数置換は以下のいずれかの形式を取ります。
${variable.name}
${variable.name-default}
ここで、variable.name
はシステムプロパティの名前です。その名前のシステムプロパティが存在する場合、値が置換されます。存在せず、デフォルト値が指定されている場合は、デフォルト値内で変数を再帰的に置換した後に、デフォルト値が置換されます。システムプロパティが存在せず、デフォルト値が指定されていない場合は、元の文字列は置換されません。
特別な変数置換もあります。
read(property.name)[default]
これは、boot.properties
で設定されたファイルで値を探します。 boot.properties
ファイルが設定されていない場合、またはプロパティが存在しない場合は、デフォルト値が選択されます。
設定ファイルは行ベースで、UTF-8 エンコーディングで読み込まれ、以下の文法で定義されます。 'nl'
は改行またはファイルの終わりを示し、'text'
は括弧や角括弧などの周囲の区切り文字を含まない、改行のないプレーンテキストです。
configuration: scala app repositories boot log appProperties
scala: "[" "scala" "]" nl version nl classifiers nl
app: "[" "app" "]" nl org nl name nl version nl components nl class nl crossVersioned nl resources nl classifiers nl
repositories: "[" "repositories" "]" nl (repository nl)*
boot: "[" "boot" "]" nl directory nl bootProperties nl search nl promptCreate nl promptFill nl quickOption nl
log: "[" "log" "]" nl logLevel nl
appProperties: "[" "app-properties" "]" nl (property nl)*
ivy: "[" "ivy" "]" nl homeDirectory nl checksums nl overrideRepos nl repoConfig nl
directory: "directory" ":" path
bootProperties: "properties" ":" path
search: "search" ":" ("none" | "nearest" | "root-first" | "only" ) ("," path)*
logLevel: "level" ":" ("debug" | "info" | "warn" | "error")
promptCreate: "prompt-create" ":" label
promptFill: "prompt-fill" ":" boolean
quickOption: "quick-option" ":" boolean
version: "version" ":" versionSpecification
versionSpecification: readProperty | fixedVersion
readProperty: "read" "(" propertyName ")" "[" default "]"
fixedVersion: text
classifiers: "classifiers" ":" text ("," text)*
homeDirectory: "ivy-home" ":" path
checksums: "checksums" ":" checksum ("," checksum)*
overrideRepos: "override-build-repos" ":" boolean
repoConfig: "repository-config" ":" path
org: "org" ":" text
name: "name" ":" text
class: "class" ":" text
components: "components" ":" component ("," component)*
crossVersioned: "cross-versioned" ":" ("true" | "false" | "none" | "binary" | "full")
resources: "resources" ":" path ("," path)*
repository: ( predefinedRepository | customRepository ) nl
predefinedRepository: "local" | "maven-local" | "maven-central"
customRepository: label ":" url [ ["," ivyPattern] ["," artifactPattern] [", mavenCompatible"] [", bootOnly"]]
property: label ":" propertyDefinition ("," propertyDefinition)*
propertyDefinition: mode "=" (set | prompt)
mode: "quick" | "new" | "fill"
set: "set" "(" value ")"
prompt: "prompt" "(" label ")" ("[" default "]")?
boolean: "true" | "false"
nl: "\r\n" | "\n" | "\r"
path: text
propertyName: text
label: text
default: text
checksum: text
ivyPattern: text
artifactPattern: text
url: text
component: text