Skip to content

Commit 177d229

Browse files
committed
updated site
1 parent d025d62 commit 177d229

18 files changed

Lines changed: 396 additions & 44 deletions

1.x/sitemap.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12428,7 +12428,7 @@
1242812428
</url>
1242912429
<url>
1243012430
<loc>https://www.scala-sbt.org/1.x/docs/Combined+Pages.html</loc>
12431-
<lastmod>2025-10-04</lastmod>
12431+
<lastmod>2025-10-05</lastmod>
1243212432
<changefreq>daily</changefreq>
1243312433
<priority>0.9</priority>
1243412434
</url>
@@ -12584,7 +12584,7 @@
1258412584
</url>
1258512585
<url>
1258612586
<loc>https://www.scala-sbt.org/1.x/docs/offline/Combined+Pages.html</loc>
12587-
<lastmod>2025-10-04</lastmod>
12587+
<lastmod>2025-10-05</lastmod>
1258812588
<changefreq>daily</changefreq>
1258912589
<priority>0.9</priority>
1259012590
</url>
@@ -12692,7 +12692,7 @@
1269212692
</url>
1269312693
<url>
1269412694
<loc>https://www.scala-sbt.org/1.x/docs/offline/Community-Plugins.html</loc>
12695-
<lastmod>2025-10-04</lastmod>
12695+
<lastmod>2025-10-05</lastmod>
1269612696
<changefreq>daily</changefreq>
1269712697
<priority>0.9</priority>
1269812698
</url>
@@ -13424,7 +13424,7 @@
1342413424
</url>
1342513425
<url>
1342613426
<loc>https://www.scala-sbt.org/1.x/docs/Community-Plugins.html</loc>
13427-
<lastmod>2025-10-04</lastmod>
13427+
<lastmod>2025-10-05</lastmod>
1342813428
<changefreq>daily</changefreq>
1342913429
<priority>0.9</priority>
1343013430
</url>

1.x/sitemap.xml.gz

0 Bytes
Binary file not shown.

2.x/docs/en/guide/multi-project-basics.html

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ <h1 id="multi-project-basics"><a class="header" href="#multi-project-basics">Mul
214214
<p>Each subproject in a build has its own source directories, generates
215215
its own JAR file when you run <code>packageBin</code>, and in general works like any
216216
other project.</p>
217-
<p>A project is defined by declaring a lazy val of type
217+
<p>A <strong>subproject</strong> is defined by declaring a <code>lazy val</code> of type
218218
<a href="../../api/sbt/Project.html">Project</a>. For example, :</p>
219219
<pre><code class="language-scala">scalaVersion := "3.7.3"
220+
LocalRootProject / publish / skip := true
220221

221222
lazy val core = (project in file("core"))
222223
.settings(
@@ -229,8 +230,69 @@ <h1 id="multi-project-basics"><a class="header" href="#multi-project-basics">Mul
229230
name := "util",
230231
)
231232
</code></pre>
232-
<p>The name of the val is used as the subproject's ID, which
233-
is used to refer to the subproject at the sbt shell.</p>
233+
<p>The name of the <code>val</code> is used as the subproject's ID, which
234+
is used to refer to the subproject in the sbt shell.</p>
235+
<p>sbt will always define a root project, so in the above build definition,
236+
we will have total of three subprojects.</p>
237+
<h2 id="subproject-dependency"><a class="header" href="#subproject-dependency">Subproject dependency</a></h2>
238+
<p>A subproject may depend on the code from another subproject.
239+
This is done by declaring <code>dependsOn(...)</code>. For example, if <code>util</code> needed <code>util</code> on its classpath, you would define <code>util</code> as:</p>
240+
<pre><code class="language-scala">lazy val util = (project in file("util"))
241+
.dependsOn(core)
242+
</code></pre>
243+
<h2 id="task-aggregation"><a class="header" href="#task-aggregation">Task aggregation</a></h2>
244+
<p>Task aggregation means that running a task on the aggregate subproject will also run on the aggregated subprojects.</p>
245+
<pre><code class="language-scala">scalaVersion := "3.7.3"
246+
247+
lazy val root = (project in file("."))
248+
.autoAggregate
249+
.settings(
250+
publish / skip := true
251+
)
252+
253+
lazy val util = (project in file("util"))
254+
255+
lazy val core = (project in file("core"))
256+
</code></pre>
257+
<p>In the above example, the root subproject aggregates <code>util</code> and <code>core</code>. When you type <code>compile</code> in the sbt shell, all tree subprojects are compiled in parallel.</p>
258+
<h2 id="root-project"><a class="header" href="#root-project">Root project</a></h2>
259+
<p>The subproject at the root of the build is called a <strong>root project</strong>,
260+
and often plays a special role in the build.
261+
If a subproject is not defined at the root directory of the build,
262+
sbt automatically creates a default one that aggregates all other subprojects in the build.</p>
263+
<h2 id="common-settings"><a class="header" href="#common-settings">Common settings</a></h2>
264+
<p>In sbt 2.x, bare settings that are written directly in <code>build.sbt</code> without <code>settings(...)</code> are <strong>common settings</strong> that are injected to all subprojects.</p>
265+
<pre><code class="language-scala">scalaVersion := "3.7.3"
266+
267+
lazy val core = (project in file("core"))
268+
269+
lazy val app = (project in file("app"))
270+
.dependsOn(core)
271+
</code></pre>
272+
<p>In the above, the <code>scalaVersion</code> setting is applied to the default root subproject, <code>core</code>, and <code>util</code>.</p>
273+
<p>One exception to this rule is settings that are already scoped to a subproject.</p>
274+
<pre><code class="language-scala">scalaVersion := "3.7.3"
275+
276+
lazy val core = (project in file("core"))
277+
278+
lazy val app = (project in file("app"))
279+
.dependsOn(core)
280+
281+
// This is applied only to app
282+
app / name := "app1"
283+
</code></pre>
284+
<p>We can take advantage of this exception to add some settings that only apply to the default root project as follows:</p>
285+
<pre><code class="language-scala">scalaVersion := "3.7.3"
286+
287+
lazy val core = (project in file("core"))
288+
289+
lazy val app = (project in file("app"))
290+
.dependsOn(core)
291+
292+
// These are applied only to root
293+
LocalRootProject / name := "root"
294+
LocalRootProject / publish / skip := true
295+
</code></pre>
234296

235297
</main>
236298

2.x/docs/en/print.html

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,9 +1285,10 @@ <h2 id="viewing-library-dependencies"><a class="header" href="#viewing-library-d
12851285
<p>Each subproject in a build has its own source directories, generates
12861286
its own JAR file when you run <code>packageBin</code>, and in general works like any
12871287
other project.</p>
1288-
<p>A project is defined by declaring a lazy val of type
1288+
<p>A <strong>subproject</strong> is defined by declaring a <code>lazy val</code> of type
12891289
<a href="guide/../../api/sbt/Project.html">Project</a>. For example, :</p>
12901290
<pre><code class="language-scala">scalaVersion := "3.7.3"
1291+
LocalRootProject / publish / skip := true
12911292

12921293
lazy val core = (project in file("core"))
12931294
.settings(
@@ -1300,8 +1301,69 @@ <h2 id="viewing-library-dependencies"><a class="header" href="#viewing-library-d
13001301
name := "util",
13011302
)
13021303
</code></pre>
1303-
<p>The name of the val is used as the subproject's ID, which
1304-
is used to refer to the subproject at the sbt shell.</p>
1304+
<p>The name of the <code>val</code> is used as the subproject's ID, which
1305+
is used to refer to the subproject in the sbt shell.</p>
1306+
<p>sbt will always define a root project, so in the above build definition,
1307+
we will have total of three subprojects.</p>
1308+
<h2 id="subproject-dependency"><a class="header" href="#subproject-dependency">Subproject dependency</a></h2>
1309+
<p>A subproject may depend on the code from another subproject.
1310+
This is done by declaring <code>dependsOn(...)</code>. For example, if <code>util</code> needed <code>util</code> on its classpath, you would define <code>util</code> as:</p>
1311+
<pre><code class="language-scala">lazy val util = (project in file("util"))
1312+
.dependsOn(core)
1313+
</code></pre>
1314+
<h2 id="task-aggregation"><a class="header" href="#task-aggregation">Task aggregation</a></h2>
1315+
<p>Task aggregation means that running a task on the aggregate subproject will also run on the aggregated subprojects.</p>
1316+
<pre><code class="language-scala">scalaVersion := "3.7.3"
1317+
1318+
lazy val root = (project in file("."))
1319+
.autoAggregate
1320+
.settings(
1321+
publish / skip := true
1322+
)
1323+
1324+
lazy val util = (project in file("util"))
1325+
1326+
lazy val core = (project in file("core"))
1327+
</code></pre>
1328+
<p>In the above example, the root subproject aggregates <code>util</code> and <code>core</code>. When you type <code>compile</code> in the sbt shell, all tree subprojects are compiled in parallel.</p>
1329+
<h2 id="root-project"><a class="header" href="#root-project">Root project</a></h2>
1330+
<p>The subproject at the root of the build is called a <strong>root project</strong>,
1331+
and often plays a special role in the build.
1332+
If a subproject is not defined at the root directory of the build,
1333+
sbt automatically creates a default one that aggregates all other subprojects in the build.</p>
1334+
<h2 id="common-settings"><a class="header" href="#common-settings">Common settings</a></h2>
1335+
<p>In sbt 2.x, bare settings that are written directly in <code>build.sbt</code> without <code>settings(...)</code> are <strong>common settings</strong> that are injected to all subprojects.</p>
1336+
<pre><code class="language-scala">scalaVersion := "3.7.3"
1337+
1338+
lazy val core = (project in file("core"))
1339+
1340+
lazy val app = (project in file("app"))
1341+
.dependsOn(core)
1342+
</code></pre>
1343+
<p>In the above, the <code>scalaVersion</code> setting is applied to the default root subproject, <code>core</code>, and <code>util</code>.</p>
1344+
<p>One exception to this rule is settings that are already scoped to a subproject.</p>
1345+
<pre><code class="language-scala">scalaVersion := "3.7.3"
1346+
1347+
lazy val core = (project in file("core"))
1348+
1349+
lazy val app = (project in file("app"))
1350+
.dependsOn(core)
1351+
1352+
// This is applied only to app
1353+
app / name := "app1"
1354+
</code></pre>
1355+
<p>We can take advantage of this exception to add some settings that only apply to the default root project as follows:</p>
1356+
<pre><code class="language-scala">scalaVersion := "3.7.3"
1357+
1358+
lazy val core = (project in file("core"))
1359+
1360+
lazy val app = (project in file("app"))
1361+
.dependsOn(core)
1362+
1363+
// These are applied only to root
1364+
LocalRootProject / name := "root"
1365+
LocalRootProject / publish / skip := true
1366+
</code></pre>
13051367
<div style="break-before: page; page-break-before: always;"></div><h1 id="plugin-basics"><a class="header" href="#plugin-basics">Plugin basics</a></h1>
13061368
<!--
13071369
Please read the earlier pages in the Getting Started Guide first, in
@@ -1553,7 +1615,7 @@ <h2 id="features"><a class="header" href="#features">Features</a></h2>
15531615
<li><strong>Local/remote cache system</strong>. Details below</li>
15541616
<li><strong>Client-side run</strong>. Details below.</li>
15551617
</ul>
1556-
<h3 id="common-settings"><a class="header" href="#common-settings">Common settings</a></h3>
1618+
<h3 id="common-settings-1"><a class="header" href="#common-settings-1">Common settings</a></h3>
15571619
<p>In sbt 2.x, the bare settings in <code>build.sbt</code> are interpreted to be common settings, and are injected to all subprojects. This means we can now set <code>scalaVersion</code> without using <code>ThisBuild</code> scoping:</p>
15581620
<pre><code class="language-scala">scalaVersion := "3.7.3"
15591621
</code></pre>

2.x/docs/en/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2.x/docs/ja/changes/sbt-2.0-change-summary.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ <h2 id="features"><a class="header" href="#features">Features</a></h2>
240240
<li><strong>Local/remote cache system</strong>. Details below</li>
241241
<li><strong>Client-side run</strong>. Details below.</li>
242242
</ul>
243-
<h3 id="common-settings"><a class="header" href="#common-settings">Common settings</a></h3>
243+
<h3 id="コモンセッティング"><a class="header" href="#コモンセッティング">コモン・セッティング</a></h3>
244244
<p>In sbt 2.x, the bare settings in <code>build.sbt</code> are interpreted to be common settings, and are injected to all subprojects. This means we can now set <code>scalaVersion</code> without using <code>ThisBuild</code> scoping:</p>
245245
<pre><code class="language-scala">scalaVersion := "3.7.3"
246246
</code></pre>

2.x/docs/ja/guide/multi-project-basics.html

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<!-- Book generated using mdBook -->
55
<meta charset="UTF-8">
6-
<title>Multi project basics - The Book of sbt</title>
6+
<title>マルチプロジェクトの基本 - The Book of sbt</title>
77

88

99
<!-- Custom HTML head -->
@@ -208,11 +208,12 @@ <h1 class="menu-title">The Book of sbt</h1>
208208

209209
<div id="content" class="content">
210210
<main>
211-
<h1 id="multi-project-basics"><a class="header" href="#multi-project-basics">Multi project basics</a></h1>
212-
<p>While a simple program can start out as a single-project build, it's more common for a build to split into smaller, multiple subprojects.</p>
213-
<p>Each subproject in a build has its own source directories, generates its own JAR file when you run <code>packageBin</code>, and in general works like any other project.</p>
214-
<p>A project is defined by declaring a lazy val of type <a href="../../api/sbt/Project.html">Project</a>. For example, :</p>
211+
<h1 id="マルチプロジェクトの基本"><a class="header" href="#マルチプロジェクトの基本">マルチプロジェクトの基本</a></h1>
212+
<p>簡単なプログラムならば単一プロジェクトから作り始めてもいいが、ビルドが複数の小さいのサブプロジェクトに分かれていくのが普通だ。</p>
213+
<p>ビルド内のサブプロジェクトは、それぞれ独自のソースディレクトリを持ち、<code>packageBin</code> を実行すると独自の JAR ファイルを生成するなど、概ね通常のプロジェクトと同様に動作する。</p>
214+
<p><strong>サブプロジェクト</strong>は、<code>lazy val</code> を用いて <a href="../../api/sbt/Project.html">Project</a> 型の値を宣言することで定義される。例えば:</p>
215215
<pre><code class="language-scala">scalaVersion := "3.7.3"
216+
LocalRootProject / publish / skip := true
216217

217218
lazy val core = (project in file("core"))
218219
.settings(
@@ -225,7 +226,63 @@ <h1 id="multi-project-basics"><a class="header" href="#multi-project-basics">Mul
225226
name := "util",
226227
)
227228
</code></pre>
228-
<p>The name of the val is used as the subproject's ID, which is used to refer to the subproject at the sbt shell.</p>
229+
<p><code>val</code> 定義された変数名はプロジェクトの ID 及びベースディレクトリの名前になる。ID は sbt シェルからプロジェクトを指定する時に用いられる。</p>
230+
<p>sbt は必ずルートプロジェクトを定義するので、上の例のビルド定義は合計 3つのサブプロジェクトを持つ。</p>
231+
<h2 id="サブプロジェクト間依存性"><a class="header" href="#サブプロジェクト間依存性">サブプロジェクト間依存性</a></h2>
232+
<p>あるサブプロジェクトを、他のサブプロジェクトにあるコードに依存させたい場合、<code>dependsOn(...)</code> を使ってこれを宣言する。例えば、<code>util</code><code>core</code> のクラスパスが必要な場合は <code>util</code> の定義を次のように書く:</p>
233+
<pre><code class="language-scala">lazy val util = (project in file("util"))
234+
.dependsOn(core)
235+
</code></pre>
236+
<h2 id="タスク集約"><a class="header" href="#タスク集約">タスク集約</a></h2>
237+
<p>タスク集約は、集約する側のサブプロジェクトで任意のタスクを実行するとき、集約される側の複数のサブプロジェクトでも同じタスクが実行されるという関係を意味する。</p>
238+
<pre><code class="language-scala">scalaVersion := "3.7.3"
239+
240+
lazy val root = (project in file("."))
241+
.autoAggregate
242+
.settings(
243+
publish / skip := true
244+
)
245+
246+
lazy val util = (project in file("util"))
247+
248+
lazy val core = (project in file("core"))
249+
</code></pre>
250+
<p>上の例では、ルートプロジェクトが <code>util</code><code>core</code> を集約する。そのため、sbt シェルに <code>compile</code> と打ち込むと、3つのサブプロジェクトが並列にコンパイルされる。</p>
251+
<h2 id="ルートプロジェクト"><a class="header" href="#ルートプロジェクト">ルートプロジェクト</a></h2>
252+
<p>ビルドのルートにあるサブプロジェクトは、<strong>ルートプロジェクト</strong>と呼ばれ、ビルドの中で特別な役割を果たすことがある。もしルートディレクトリにサブプロジェクトが定義されてない場合、sbt は自動的に他のプロジェクトを集約するデフォルトのルートプロジェクトを生成する。</p>
253+
<h2 id="コモンセッティング"><a class="header" href="#コモンセッティング">コモン・セッティング</a></h2>
254+
<p>sbt 2.x系では、<code>settings(...)</code> を使わずに <code>build.sbt</code> にセッティングを直書きした場合、<strong>コモン・セッティング</strong>として全サブプロジェクトに注入される。</p>
255+
<pre><code class="language-scala">scalaVersion := "3.7.3"
256+
257+
lazy val core = (project in file("core"))
258+
259+
lazy val app = (project in file("app"))
260+
.dependsOn(core)
261+
</code></pre>
262+
<p>上の例では、<code>scalaVersion</code> セッティングはデフォルトのルートプロジェクト、<code>core</code><code>util</code> に適用される。</p>
263+
<p>既にサブプロジェクトにスコープ付けされたセッティングはこのルールの例外となる。</p>
264+
<pre><code class="language-scala">scalaVersion := "3.7.3"
265+
266+
lazy val core = (project in file("core"))
267+
268+
lazy val app = (project in file("app"))
269+
.dependsOn(core)
270+
271+
// これは app のみに適用される
272+
app / name := "app1"
273+
</code></pre>
274+
<p>この例外を利用して、以下のように、ルートプロジェクトにのみ適用されるセッティングを書くことができる:</p>
275+
<pre><code class="language-scala">scalaVersion := "3.7.3"
276+
277+
lazy val core = (project in file("core"))
278+
279+
lazy val app = (project in file("app"))
280+
.dependsOn(core)
281+
282+
// これらは root にのみ適用される
283+
LocalRootProject / name := "root"
284+
LocalRootProject / publish / skip := true
285+
</code></pre>
229286

230287
</main>
231288

0 commit comments

Comments
 (0)