Skip to content

Commit 9ffe4b9

Browse files
committed
- The part about scastie was already mentioned in our scala3/getting-started.md page - Copied the part about the giter8 templates into the Scala 3 book, - IDE support was covered in our getting-started page - Skipped “Standalone installation”, since the recommended way to install Scala 3 is to use `cs` - “Scala 3 for scripting” was already covered by scala3/book/taste-hello-world.md
1 parent 99a53de commit 9ffe4b9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

_overviews/scala3-book/scala-tools.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,42 @@ There, that’s much faster.
269269
If you type `help` at the sbt command prompt you’ll see a list of other commands you can run.
270270
But for now, just type `exit` (or press `CTRL-D`) to leave the sbt shell.
271271

272+
### Using project templates
273+
274+
Manually creating the project structure can be tedious. Thankfully, sbt can create it for you,
275+
based on a template.
276+
277+
To create a Scala 3 project from a template, run the following command in a shell:
278+
279+
~~~
280+
$ sbt new scala/scala3.g8
281+
~~~
282+
283+
Sbt will load the template, ask some questions, and create the project files in a subdirectory:
284+
285+
~~~
286+
$ tree scala-3-project-template
287+
scala-3-project-template
288+
├── build.sbt
289+
├── project
290+
│ └── build.properties
291+
├── README.md
292+
└── src
293+
├── main
294+
│ └── scala
295+
│ └── Main.scala
296+
└── test
297+
└── scala
298+
└── Test1.scala
299+
~~~
300+
301+
> If you want to create a Scala 3 project that cross-compiles with Scala 2, use the template `scala/scala3-cross.g8`:
302+
>
303+
> ~~~
304+
> $ sbt new scala/scala3-cross.g8
305+
> ~~~
306+
307+
Learn more about `sbt new` and project templates in the [documentation of sbt](https://www.scala-sbt.org/1.x/docs/sbt-new-and-Templates.html#sbt+new+and+Templates).
272308
273309
### Other build tools for Scala
274310

0 commit comments

Comments
 (0)