You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _overviews/getting-started/install-scala.md
-83Lines changed: 0 additions & 83 deletions
Original file line number
Diff line number
Diff line change
@@ -285,88 +285,5 @@ sbt and an IDE using the tutorials below. If you want to familiarize yourself wi
285
285
*[Learning Resources](/learn.html), which includes online interactive tutorials and courses.
286
286
*[Our list of some popular Scala books](/books.html).
287
287
288
-
## Create a "Hello World" project with sbt
289
-
290
-
Once you have installed sbt, you are ready to create a Scala project, which
291
-
is explained in the following sections.
292
-
293
-
To create a project, you can either use the command line or an IDE.
294
-
If you are familiar with the command line, we recommend that approach.
295
-
296
-
### Using the command line
297
-
298
-
sbt is a build tool for Scala. sbt compiles, runs,
299
-
and tests your Scala code. (It can also publish libraries and do many other tasks.)
300
-
301
-
To create a new Scala project with sbt:
302
-
303
-
1.`cd` to an empty folder.
304
-
1. Run the command `sbt new scala/scala3.g8` to create a Scala 3 project, or `sbt new scala/hello-world.g8` to create a Scala 2 project.
305
-
This pulls a project template from GitHub.
306
-
It will also create a `target` folder, which you can ignore.
307
-
1. When prompted, name the application `hello-world`. This will
308
-
create a project called "hello-world".
309
-
1. Let's take a look at what just got generated:
310
-
311
-
```
312
-
- hello-world
313
-
- project (sbt uses this for its own files)
314
-
- build.properties
315
-
- build.sbt (sbt's build definition file)
316
-
- src
317
-
- main
318
-
- scala (all of your Scala code goes here)
319
-
- Main.scala (Entry point of program) <-- this is all we need for now
320
-
```
321
-
322
-
More documentation about sbt can be found in the [Scala Book](/scala3/book/tools-sbt.html) (see [here](/overviews/scala-book/scala-build-tool-sbt.html) for the Scala 2 version)
323
-
and in the official sbt [documentation](https://www.scala-sbt.org/1.x/docs/index.html)
324
-
325
-
### With an IDE
326
-
327
-
You can read a short summary of Scala IDEs on [a dedicated page](/getting-started/scala-ides.html)
328
-
329
-
## Open hello-world project
330
-
331
-
Let's use an IDE to open the project. The most popular ones are [IntelliJ](https://www.jetbrains.com/idea/) and
They both offer rich IDE features, but you can still use [many other editors](https://scalameta.org/metals/docs/editors/overview.html).
334
-
335
-
### Using IntelliJ
336
-
337
-
1. Download and install [IntelliJ Community Edition](https://www.jetbrains.com/help/idea/installation-guide.html)
338
-
1. Install the Scala plugin by following [the instructions on how to install IntelliJ plugins](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html)
339
-
1. Open the `build.sbt` file then choose *Open as a project*
1. Install the Metals extension from [the Marketplace](https://marketplace.visualstudio.com/items?itemName=scalameta.metals)
345
-
1. Next, open the directory containing a `build.sbt` file (this should be the directory `hello-world` if you followed the previous instructions). When prompted to do so, select *Import build*.
346
-
347
-
### Play with the source code
348
-
349
-
View these two files in your IDE:
350
-
351
-
-_build.sbt_
352
-
-_src/main/scala/Main.scala_
353
-
354
-
When you run your project in the next step, the configuration in _build.sbt_ will be used to run the code in _src/main/scala/Main.scala_.
355
-
356
-
## Run Hello World
357
-
358
-
If you’re comfortable using your IDE, you can run the code in _Main.scala_ from your IDE.
359
-
360
-
Otherwise, you can run the application from a terminal with these steps:
361
-
362
-
1.`cd` into `hello-world`.
363
-
1. Run `sbt`. This opens up the sbt console.
364
-
1. Type `~run`. The `~` is optional and causes sbt to re-run on every file save,
365
-
allowing for a fast edit/run/debug cycle. sbt will also generate a `target` directory
366
-
which you can ignore.
367
-
368
-
When you’re finished experimenting with this project, press `[Enter]` to interrupt the `run` command.
369
-
Then type `exit` or press `[Ctrl+D]` to exit sbt and return to your command line prompt.
370
-
371
288
## Getting Help
372
289
There are a multitude of mailing lists and real-time chat rooms in case you want to quickly connect with other Scala users. Check out our [community](https://scala-lang.org/community/) page for a list of these resources, and for where to reach out for help.
0 commit comments