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
- 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
Copy file name to clipboardExpand all lines: _overviews/scala3-book/scala-tools.md
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -269,6 +269,42 @@ There, that’s much faster.
269
269
If you type `help` at the sbt command prompt you’ll see a list of other commands you can run.
270
270
But for now, just type `exit` (or press `CTRL-D`) to leave the sbt shell.
271
271
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).
0 commit comments