Skip to content

Commit d025d62

Browse files
committed
updated site
1 parent b9c037b commit d025d62

11 files changed

Lines changed: 112 additions & 46 deletions

2.x/docs/en/guide/library-dependency-basics.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ <h1 id="library-dependency-basics"><a class="header" href="#library-dependency-b
213213
<p>sbt uses <a href="https://get-coursier.io/">Coursier</a> to implement managed
214214
dependencies, so if you're familiar with package managers like Coursier,
215215
npm, PIP, etc you won't have much trouble.</p>
216+
<div id="admonition-whats-a-managed-dependency" class="admonition admonish-note" role="note" aria-labelledby="admonition-whats-a-managed-dependency-title">
217+
<div class="admonition-title">
218+
<div id="admonition-whats-a-managed-dependency-title">
219+
<p>What's a managed dependency?</p>
220+
</div>
221+
<a class="admonition-anchor-link" href="#admonition-whats-a-managed-dependency"></a>
222+
</div>
223+
<div>
224+
<p>As opposed to downloading required JAR files by hand (<em>unmanaged</em> dependencies), a <em>managed</em> dependency system automates fetching external libraries for a subproject. Tools like Coursier interpret the declared <code>ModuleID</code>, perform dependency resolution (expand all the transitive dependencies, and resolve any version conflicts to determine the exact versions), and download and cache the resulting artifacts, ensuring consistent JAR management.</p>
225+
</div>
226+
</div>
216227
<h2 id="the-librarydependencies-key"><a class="header" href="#the-librarydependencies-key">The <code>libraryDependencies</code> key</a></h2>
217228
<p>Declaring a dependency looks like this, where <code>groupId</code>, <code>artifactId</code>, and
218229
<code>revision</code> are strings:</p>
@@ -233,7 +244,7 @@ <h3 id="getting-the-right-scala-version-with-"><a class="header" href="#getting-
233244
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" % "toolkit_3" % "0.2.0"
234245
</code></pre>
235246
<p>Assuming the <code>scalaVersion</code> for your build is 3.x, the following is
236-
identical (note the double <code>%%</code> after <code>"toolkit"</code>):</p>
247+
identical (note the double <code>%%</code> after <code>"org.scala-lang"</code>):</p>
237248
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" %% "toolkit" % "0.2.0"
238249
</code></pre>
239250
<p>The idea is that many dependencies are compiled for multiple Scala

2.x/docs/en/print.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,17 @@ <h3 id="vals-and-lazy-vals"><a class="header" href="#vals-and-lazy-vals"><code>v
12011201
<p>sbt uses <a href="https://get-coursier.io/">Coursier</a> to implement managed
12021202
dependencies, so if you're familiar with package managers like Coursier,
12031203
npm, PIP, etc you won't have much trouble.</p>
1204+
<div id="admonition-whats-a-managed-dependency" class="admonition admonish-note" role="note" aria-labelledby="admonition-whats-a-managed-dependency-title">
1205+
<div class="admonition-title">
1206+
<div id="admonition-whats-a-managed-dependency-title">
1207+
<p>What's a managed dependency?</p>
1208+
</div>
1209+
<a class="admonition-anchor-link" href="guide/library-dependency-basics.html#admonition-whats-a-managed-dependency"></a>
1210+
</div>
1211+
<div>
1212+
<p>As opposed to downloading required JAR files by hand (<em>unmanaged</em> dependencies), a <em>managed</em> dependency system automates fetching external libraries for a subproject. Tools like Coursier interpret the declared <code>ModuleID</code>, perform dependency resolution (expand all the transitive dependencies, and resolve any version conflicts to determine the exact versions), and download and cache the resulting artifacts, ensuring consistent JAR management.</p>
1213+
</div>
1214+
</div>
12041215
<h2 id="the-librarydependencies-key"><a class="header" href="#the-librarydependencies-key">The <code>libraryDependencies</code> key</a></h2>
12051216
<p>Declaring a dependency looks like this, where <code>groupId</code>, <code>artifactId</code>, and
12061217
<code>revision</code> are strings:</p>
@@ -1221,7 +1232,7 @@ <h3 id="getting-the-right-scala-version-with-"><a class="header" href="#getting-
12211232
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" % "toolkit_3" % "0.2.0"
12221233
</code></pre>
12231234
<p>Assuming the <code>scalaVersion</code> for your build is 3.x, the following is
1224-
identical (note the double <code>%%</code> after <code>"toolkit"</code>):</p>
1235+
identical (note the double <code>%%</code> after <code>"org.scala-lang"</code>):</p>
12251236
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" %% "toolkit" % "0.2.0"
12261237
</code></pre>
12271238
<p>The idea is that many dependencies are compiled for multiple Scala

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/guide/library-dependency-basics.html

Lines changed: 30 additions & 19 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>Library dependency basics - The Book of sbt</title>
6+
<title>ライブラリ依存性の基本 - The Book of sbt</title>
77

88

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

209209
<div id="content" class="content">
210210
<main>
211-
<h1 id="library-dependency-basics"><a class="header" href="#library-dependency-basics">Library dependency basics</a></h1>
212-
<p>This page explains the basics of library dependency management using sbt.</p>
213-
<p>sbt uses <a href="https://get-coursier.io/">Coursier</a> to implement managed dependencies, so if you're familiar with package managers like Coursier, npm, PIP, etc you won't have much trouble.</p>
214-
<h2 id="the-librarydependencies-key"><a class="header" href="#the-librarydependencies-key">The <code>libraryDependencies</code> key</a></h2>
215-
<p>Declaring a dependency looks like this, where <code>groupId</code>, <code>artifactId</code>, and <code>revision</code> are strings:</p>
211+
<h1 id="ライブラリ依存性の基本"><a class="header" href="#ライブラリ依存性の基本">ライブラリ依存性の基本</a></h1>
212+
<p>このページは、sbt を使ったライブラリ依存性管理の基本を説明する。</p>
213+
<p>sbt はマネージ依存性 (managed dependency) を実装するのに内部で <a href="https://get-coursier.io/">Coursier</a> を採用していて、Coursier、npm、PIP などのパッケージ管理を使った事がある人は違和感無く入り込めるだろう。</p>
214+
<div id="admonition-マネージ依存性とは何か" class="admonition admonish-note" role="note" aria-labelledby="admonition-マネージ依存性とは何か-title">
215+
<div class="admonition-title">
216+
<div id="admonition-マネージ依存性とは何か-title">
217+
<p>マネージ依存性とは何か</p>
218+
</div>
219+
<a class="admonition-anchor-link" href="#admonition-マネージ依存性とは何か"></a>
220+
</div>
221+
<div>
222+
<p>JAR ファイルを 1つ 1つ手でダウンロードする (アンマネージ依存性) 代わりに、マネージ依存性システムはサブプロジェクトで使われる外部ライブラリの取得を自動化する。Coursier のようなツールは宣言された <code>ModuleID</code> 列を解釈して、依存性解決 (全ての間接的依存性を展開して、バージョン衝突を解決して、正確なバージョンを決定する) を行い、結果となったアーティファクトをダウンロードしキャッシュして、一貫性のある JAR 管理を保証する。</p>
223+
</div>
224+
</div>
225+
<h2 id="librarydependencies-キー"><a class="header" href="#librarydependencies-キー"><code>libraryDependencies</code> キー</a></h2>
226+
<p>依存性の宣言は、以下のようになる。ここで、<code>groupId</code><code>artifactId</code>、と <code>revision</code> は文字列だ:</p>
216227
<pre><code class="language-scala">libraryDependencies += groupID % artifactID % revision
217228
</code></pre>
218-
<p>or like this, where <code>configuration</code> can be a string or a <code>Configuration</code> value (such as <code>Test</code>):</p>
229+
<p>もしくは、以下のようになる。このときの <code>configuration</code> は文字列もしくは <code>Configuration</code> の値だ (<code>Test</code> など)。</p>
219230
<pre><code class="language-scala">libraryDependencies += groupID % artifactID % revision % configuration
220231
</code></pre>
221-
<p>When you run:</p>
232+
<p>コンパイルを実行すると:</p>
222233
<pre><code>&gt; compile
223234
</code></pre>
224-
<p>sbt will automatically resolve the dependencies and download the JAR files.</p>
225-
<h3 id="getting-the-right-scala-version-with-"><a class="header" href="#getting-the-right-scala-version-with-">Getting the right Scala version with <code>%%</code></a></h3>
226-
<p>If you use <code>organization %% moduleName % version</code> rather than <code>organization % moduleName % version</code> (the difference is the double <code>%%</code> after the <code>organization</code>), sbt will add your project's binary Scala version to the artifact name. This is just a shortcut. You could write this without the <code>%%</code>:</p>
235+
<p>sbt は自動的に依存性を解決して、JAR ファイルをダウンロードする。</p>
236+
<h3 id="-を使って正しい-scala-バージョンを入手する"><a class="header" href="#-を使って正しい-scala-バージョンを入手する"><code>%%</code> を使って正しい Scala バージョンを入手する</a></h3>
237+
<p><code>groupID % artifactID % revision</code> のかわりに、 <code>groupID %% artifactID % revision</code> を使うと(違いは <code>groupID</code> の後ろの二つ連なった <code>%%</code>)、 sbt はプロジェクトの Scala のバイナリバージョンをアーティファクト名に追加する。これはただの略記法なので <code>%%</code> 無しで書くこともできる:</p>
227238
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" % "toolkit_3" % "0.2.0"
228239
</code></pre>
229-
<p>Assuming the <code>scalaVersion</code> for your build is 3.x, the following is identical (note the double <code>%%</code> after <code>"toolkit"</code>):</p>
240+
<p>ビルドの Scala バージョンが 3.x だとすると、以下の設定は上記と等価だ(<code>"org.scala-lang"</code> の後ろの二つ連なった <code>%%</code> に注意):</p>
230241
<pre><code class="language-scala">libraryDependencies += "org.scala-lang" %% "toolkit" % "0.2.0"
231242
</code></pre>
232-
<p>The idea is that many dependencies are compiled for multiple Scala versions, and you'd like to get the one that matches your project to ensure binary compatibility.</p>
233-
<h2 id="tracking-dependencies-in-one-place"><a class="header" href="#tracking-dependencies-in-one-place">Tracking dependencies in one place</a></h2>
234-
<p><code>.scala</code> files under <code>project</code> becomes part of the build definition, which we can use to track dependencies in one place by creating a file named <code>project/Dependencies.scala</code>.</p>
235-
<pre><code class="language-scala">// place this file at project/Dependencies.scala
243+
<p>多くの依存ライブラリは複数の Scala バイナリバージョンに対してコンパイルされており、この機構はそのうちの中からプロジェクトとバイナリ互換性のある正しいものを選択する便利機能だ。</p>
244+
<h2 id="ライブラリ依存性を一箇所にまとめる"><a class="header" href="#ライブラリ依存性を一箇所にまとめる">ライブラリ依存性を一箇所にまとめる</a></h2>
245+
<p><code>project</code> 内の任意の <code>.scala</code> ファイルがビルド定義の一部となることを利用する一つの例として <code>project/Dependencies.scala</code> というファイルを作ってライブラリ依存性を一箇所にまとめるということができる。</p>
246+
<pre><code class="language-scala">// project/Dependencies.scala にこのファイルを置く
236247

237248
import sbt.*
238249

@@ -245,16 +256,16 @@ <h2 id="tracking-dependencies-in-one-place"><a class="header" href="#tracking-de
245256
val toolkitTest = "org.scala-lang" %% "toolkit-test" % toolkitV
246257
end Dependencies
247258
</code></pre>
248-
<p>The <code>Dependencies</code> object will be available in <code>build.sbt</code>. To make it easier to use the <code>val</code>s defined in it, import <code>Dependencies.*</code> in your build.sbt file.</p>
259+
<p>この <code>Dependencies</code> オブジェクトは <code>build.sbt</code> 内で利用可能となる。 定義されている <code>val</code> が使いやすいように <code>Dependencies.*</code> を import しておこう。</p>
249260
<pre><code class="language-scala">import Dependencies.*
250261

251262
scalaVersion := "3.7.3"
252263
name := "something"
253264
libraryDependencies += toolkit
254265
libraryDependencies += toolkitTest % Test
255266
</code></pre>
256-
<h2 id="viewing-library-dependencies"><a class="header" href="#viewing-library-dependencies">Viewing library dependencies</a></h2>
257-
<p>Type in <code>Compile/dependencyTree</code> in the sbt shell to show the library dependency tree, including the transitive dependencies:</p>
267+
<h2 id="ライブラリ依存性の可視化"><a class="header" href="#ライブラリ依存性の可視化">ライブラリ依存性の可視化</a></h2>
268+
<p>sbt シェルに <code>Compile/dependencyTree</code> と入力すると、ライブラリ依存性の間接的依存性を含むツリーが表示される:</p>
258269
<pre><code>&gt; Compile/dependencyTree
259270
</code></pre>
260271
<p>これは以下のように表示されるはずだ:</p>

0 commit comments

Comments
 (0)