Skip to content

Commit

Permalink
Merge pull request #1166 from SethTisue/two-seeds
Browse files Browse the repository at this point in the history
document both Scala 3 and 2 seeds, putting 3 first
  • Loading branch information
eed3si9n authored Aug 14, 2024
2 parents b833b94 + abfbe9a commit 6fd5d87
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 32 deletions.
19 changes: 11 additions & 8 deletions docs/getting-started/02-sbt-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ $ touch build.sbt

```
$ sbt
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.9.3
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.10.1
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] Loading project definition from /tmp/foo-build/project
[info] loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/tmp/foo-build/)
Expand Down Expand Up @@ -189,7 +189,7 @@ Use the `reload` command to reload the build. The command causes the

```
sbt:foo-build> reload
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] loading project definition from /tmp/foo-build/project
[info] loading settings for project hello from build.sbt ...
[info] set current project to Hello (in build file:/tmp/foo-build/)
Expand Down Expand Up @@ -537,15 +537,18 @@ or a continuous test like `~testQuick`.
### sbt new command

You can use the sbt `new` command to quickly setup a simple "Hello world" build.
Various templates are available, including these two:

```
\$ sbt new scala/scala-seed.g8
....
A minimal Scala project.
\$ sbt new scala/toolkit.local
\$ sbt new scala/scala3.g8
```

name [My Something Project]: hello
These will create a Scala 3 project. If you want to use Scala 2,
use this command instead:

Template applied in ./hello
```
\$ sbt new scala/scala-seed.g8
```

When prompted for the project name, type `hello`.
Expand Down
17 changes: 12 additions & 5 deletions src/landing/_template/landing.st
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ You just need one line of <code>build.sbt</code> to get started with Scala. Lear
<h3>sbt new</h3>
Choose from community-maintained <a href="https://github.com/search?o=desc&p=1&q=g8&s=stars&type=Repositories">Giter8 templates</a> to jump start your project:

<pre><code class="prettyprint">\$ sbt new scala/scala-seed.g8
\$ sbt new playframework/play-scala-seed.g8
\$ sbt new akka/akka-http-quickstart-scala.g8
\$ sbt new http4s/http4s.g8
\$ sbt new holdenk/sparkProjectTemplate.g8
<pre><code class="prettyprint">\$ sbt new scala/toolkit.local # Scala Toolkit (beta) by Scala Center and VirtusLab
\$ sbt new typelevel/toolkit.local # Toolkit to start building Typelevel apps
\$ sbt new sbt/cross-platform.local # A cross-JVM/JS/Native project
\$ sbt new scala/scala3.g8 # Scala 3 seed template
\$ sbt new scala/scala-seed.g8 # Scala 2 seed template
\$ sbt new playframework/play-scala-seed.g8 # A Play project in Scala
\$ sbt new playframework/play-java-seed.g8 # A Play project in Java
\$ sbt new softwaremill/tapir.g8 # A tapir project using Netty
\$ sbt new scala-js/vite.g8 # A Scala.JS + Vite project
\$ sbt new holdenk/sparkProjectTemplate.g8 # A Scala Spark project
\$ sbt new spotify/scio.g8 # A Scio project
\$ sbt new disneystreaming/smithy4s.g8 # A Smithy4s project
</code></pre>
</div>
</div> <!-- row -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,38 @@ out: sbt-new-and-Templates.html
sbt new and Templates
---------------------

sbt 0.13.13 adds a new command called new, to create new build definitions from a template.
sbt has a command called new, to create new build definitions from a template.
The `new` command is extensible via a mechanism called the [template resolver](#Template+Resolver).

### Trying new command

First, you need sbt's launcher version 0.13.13 or above.
Normally the exact version for the `sbt` launcher does not matter
because it will use the version specified by `sbt.version` in `project/build.properties`;
however for new sbt's launcher 0.13.13 or above is required as the command functions without a `project/build.properties` present.
First, you need a recent sbt launcher.

Next, run:
Next run `sbt new scala/scala3.g8` (for Scala 3) or
`sbt new scala/scala-seed.g8` (for Scala 2).

When asked for a project name, you can put `hello` or anything else
you want:

```
\$ sbt new scala/scala-seed.g8
....
name [hello]:
Template applied in ./hello
```

This ran the template [scala/scala-seed.g8](https://github.com/scala/scala-seed.g8) using [Giter8][giter8], prompted for values for "name" (which has a default value of "hello", which we accepted hitting `[Enter]`), and created a build under `./hello`.
This ran the template using [Giter8][giter8], prompted for a value for "name" (which has a default value of "hello", which we accepted hitting `[Enter]`), and created a build under `./hello`.

`scala-seed` is the official template for a "minimal" Scala project, but it's definitely not the only one out there.
These are the standard templates for a "minimal" Scala project, but there are many other templates out there.

### Giter8 support

[Giter8][giter8] is a templating project originally started by Nathan Hamblen in 2010, and now maintained by the [foundweekends][foundweekends] project.
The unique aspect of Giter8 is that it uses GitHub (or any other git repository) to host the templates, so it allows anyone to participate in template creation. Here are some of the templates provided by official sources:

- [foundweekends/giter8.g8](https://github.com/foundweekends/giter8.g8) (A template for Giter8 templates)
- [scala/scala-seed.g8](https://github.com/scala/scala-seed.g8) (Seed template for Scala)
- [scala/scala3.g8](https://github.com/scala/scala3.g8) (A template for Scala 3 projects)
- [scala/scala-seed.g8](https://github.com/scala/scala-seed.g8) (Seed template for Scala)
- [foundweekends/giter8.g8](https://github.com/foundweekends/giter8.g8) (A template for Giter8 templates)
- [scala/hello-world.g8](https://github.com/scala/hello-world.g8) (A template to demonstrate a minimal Scala application)
- [scala/scalatest-example.g8](https://github.com/scala/scalatest-example.g8) (A template for trying out ScalaTest)
- [akka-quickstart-scala.g8](https://github.com/akka/akka-quickstart-scala.g8) (A minimal seed template for an Akka with Scala build
Expand All @@ -64,7 +64,7 @@ For more, see [Giter8 templates](https://github.com/foundweekends/giter8/wiki/gi
You can append Giter8 parameters to the end of the command, so for example to specify a particular branch you can use:

```
\$ sbt new scala/scala-seed.g8 --branch myBranch
\$ sbt new scala/scala3.g8 --branch myBranch
```

#### How to create a Giter8 template
Expand Down
6 changes: 3 additions & 3 deletions src/reference/es/00-Getting-Started/02-sbt-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ o por qué sbt funciona.

```
\$ sbt
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.9.3
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.10.1
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] Loading project definition from /tmp/foo-build/project
[info] loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/tmp/foo-build/)
Expand Down Expand Up @@ -197,7 +197,7 @@ aplicada.

```
sbt:foo-build> reload
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] loading project definition from /tmp/foo-build/project
[info] loading settings for project hello from build.sbt ...
[info] set current project to Hello (in build file:/tmp/foo-build/)
Expand Down
6 changes: 3 additions & 3 deletions src/reference/ja/00-Getting-Started/02-sbt-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ sbt の内部がどうなっているかや理由みたいなことを解説す

```
\$ sbt
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.9.3
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] Updated file /tmp/foo-build/project/build.properties: set sbt.version to 1.10.1
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] Loading project definition from /tmp/foo-build/project
[info] loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/tmp/foo-build/)
Expand Down Expand Up @@ -186,7 +186,7 @@ ThisBuild / scalaVersion := "$example_scala213$"

```
sbt:foo-build> reload
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] loading project definition from /tmp/foo-build/project
[info] loading settings for project hello from build.sbt ...
[info] set current project to Hello (in build file:/tmp/foo-build/)
Expand Down
2 changes: 1 addition & 1 deletion src/reference/sbt-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Use the `reload` command to reload the build. The command causes the

```
sbt:foo-build> reload
[info] welcome to sbt 1.9.3 (Eclipse Adoptium Java 17.0.8)
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 17.0.8)
[info] loading project definition from /tmp/foo-build/project
[info] loading settings for project hello from build.sbt ...
[info] set current project to Hello (in build file:/tmp/foo-build/)
Expand Down

0 comments on commit 6fd5d87

Please sign in to comment.