@@ -23,67 +23,62 @@ sbt はあなたのプロジェクトに関連した様々なタスク、とり
23
23
* [ Linux] ( http://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html )
24
24
25
25
## プロジェクトを作成
26
- 1 . ` cd ` to an empty folder.
27
- 1 . Run the following command ` sbt new scala/hello-world.g8 ` .
28
- This pulls the 'hello-world' template from GitHub.
29
- It will also create a ` target ` folder, which you can ignore.
30
- 1 . When prompted, name the application ` hello-world ` . This will
31
- create a project called "hello-world".
32
- 1 . Let's take a look at what just got generated:
26
+ 1 . 空のフォルダーに ` cd ` 。
27
+ 1 . コマンド ` sbt new scala/hello-world.g8 ` を実行します。
28
+ これは GitHub から 'hello-world' というテンプレートを取ってきます。
29
+ ` target ` フォルダーも作成しますが、無視してください。
30
+ 1 . 入力をうながされたら、アプリを ` hello-world ` と名付けます。
31
+ これで "hello-world" というプロジェクトが作成されます。
32
+ 1 . 生成されたばかりのものを見てみましょう。
33
33
34
34
```
35
35
- hello-world
36
- - project ( sbt uses this to install manage plugins and dependencies)
36
+ - project ( sbt はこのディレクトリを管理プラグインや依存関係のインストールに使います)
37
37
- build.properties
38
38
- src
39
39
- main
40
- - scala (All of your scala code goes here )
41
- -Main.scala (Entry point of program) <-- this is all we need for now
42
- build.sbt ( sbt's build definition file)
40
+ - scala (Scala コードはここに来ます )
41
+ -Main.scala (プログラムの入口) <-- 今のところこれこそが欲しいものです
42
+ build.sbt ( sbt のビルド定義ファイル)
43
43
```
44
44
45
- After you build your project, sbt will create more ` target ` directories
46
- for generated files. You can ignore these.
45
+ プロジェクトをビルドしたら、 sbt は生成されるファイルのための ` target ` をもっと作るでしょう。
46
+ これらは無視してください。
47
47
48
- ## Running the project
49
- 1 . ` cd ` into ` hello-world ` .
50
- 1 . Run ` sbt ` . This will open up the sbt console.
51
- 1 . Type ` ~run ` . The ` ~ ` is optional and causes sbt to re-run on every file save,
52
- allowing for a fast edit/run/debug cycle. sbt will also generate a ` target ` directory
53
- which you can ignore.
48
+ ## プロジェクトを実行
49
+ 1 . ` hello-world ` に ` cd ` 。
50
+ 1 . ` sbt ` を実行します。sbt コンソールが開くでしょう。
51
+ 1 . ` ~run ` と入力します。` ~ ` はオプションで、ファイルが保存されるたびに sbt にコマンドを再実行させるので、すばやい編集/実行/デバッグサイクルを回せます。
52
+ sbt は ` target ` ディレクトリを作成しますが、無視してください。
54
53
55
- ## Modifying the code
56
- 1 . Open the file ` src/main/scala/Main.scala ` in your favorite text editor.
57
- 1 . Change "Hello, World!" to "Hello, New York!"
58
- 1 . If you haven't stopped the sbt command, you should see "Hello, New York!"
59
- printed to the console.
60
- 1 . You can continue to make changes and see the results in the console.
54
+ ## コードを修正
55
+ 1 . お好きなテキストディタでファイル ` src/main/scala/Main.scala ` を開きます。
56
+ 1 . "Hello, World!" を "Hello, New York!" に変更します。
57
+ 1 . sbt コマンドを停止していなければ、コンソールに "Hello, New York!" と印字されるのが見えるでしょう。
58
+ 1 . 繰り返し変更してみてコンソールが変化するのを見てみましょう。
61
59
62
- ## Adding a dependency
63
- Changing gears a bit, let's look at how to use published libraries to add
64
- extra functionality to our apps.
60
+ ## 依存関係を追加
61
+ 趣向を少し変えて、アプリに追加機能を加えるために公開ライブラリの使い方を見てみましょう。
65
62
66
- 1 . Open up ` build.sbt ` and add the following line:
63
+ ` build.sbt ` を開き、以下のファイルを追加します。
64
+
65
+ 1 . ` build.sbt ` を開き、以下の行を追加します。
67
66
68
67
```
69
68
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.0"
70
69
```
71
- Here, ` libraryDependencies ` is a set of dependencies, and by using ` += ` ,
72
- we're adding the [ scala-parser-combinators] ( https://github.com/scala/scala-parser-combinators ) dependency to the set of dependencies that sbt will go
73
- and fetch when it starts up. Now, in any Scala file, you can import classes,
74
- objects, etc, from scala-parser-combinators with a regular import.
75
70
76
- You can find more published libraries on
77
- [ Scaladex] ( https://index.scala-lang.org/ ) , the Scala library index, where you
78
- can also copy the above dependency information for pasting into your ` build.sbt `
79
- file.
71
+ ここで ` libraryDependencies ` は依存関係の集合であり、` += ` を使うことにより、[ scala-parser-combinators] ( https://github.com/scala/scala-parser-combinators ) への依存を、sbt が起動時に取得してくる依存関係の集合に加えています。
72
+ これで、どの Scala ファイルでも、` scala-parser-combinator ` にあるクラスやオブジェクトなどを通常のインポートでインポートできます。
73
+
74
+ さらなる公開ライブラリは、Scala ライブラリインデックス [ Scaladex] ( https://index.scala-lang.org/ ) で見つけられます。
75
+ そこでは上述のような依存関係情報をコピーでき、` build.sbt ` ファイルにペーストできます。
80
76
81
- ## Next steps
77
+ ## 次のステップ
82
78
83
- Continue to the next tutorial in the _ getting started with sbt _ series, and learn about [ testing Scala code with sbt in the command line ] ( testing-scala-with-sbt-on-the-command-line.html ) .
79
+ ** sbt で入門 ** シリーズの次のチュートリアルに進み、 [ コマンドライン で sbt を使って Scala をテストする ] ( testing-scala-with-sbt-on-the-command-line.html ) 方法を学びます。
84
80
85
- ** or **
81
+ ** あるいは **
86
82
87
- - Continue learning Scala interactively online on
88
- [ Scala Exercises] ( https://www.scala-exercises.org/scala_tutorial ) .
89
- - Learn about Scala's features in bite-sized pieces by stepping through our [ Tour of Scala] ({{ site.baseurl }}/tour/tour-of-scala.html).
83
+ - インタラクティブなオンラインコース [ Scala Exercises] ( https://www.scala-exercises.org/scala_tutorial ) で Scala を学習します。
84
+ - [ Scala ツアー] ( /ja//tour/tour-of-scala.html ) で Scala の特徴を一口大のサイズでステップバイステップに学びます。
0 commit comments