All Projects → scala → Scala3 Example Project

scala / Scala3 Example Project

Licence: other
An example sbt project that compiles using Dotty

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Scala3 Example Project

sbt-elm
Scala Build Tool (SBT) plugin for the Elm programming language
Stars: ✭ 44 (-82.61%)
Mutual labels:  sbt
sbt-jni
SBT Plugin to ease working with JNI
Stars: ✭ 110 (-56.52%)
Mutual labels:  sbt
sbt-assembly
Deploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
Stars: ✭ 1,801 (+611.86%)
Mutual labels:  sbt
play-angular-typescript.g8
A giter8 template for a Play Angular 4 Typescript application
Stars: ✭ 91 (-64.03%)
Mutual labels:  sbt
sbt-ecr
An SBT plugin for managing Docker images within Amazon ECR.
Stars: ✭ 52 (-79.45%)
Mutual labels:  sbt
sbt-hepek
Sbt plugin for rendering Scala objects to files. And more!
Stars: ✭ 17 (-93.28%)
Mutual labels:  sbt
ecommerce
A project for exploring Akka with Scala
Stars: ✭ 24 (-90.51%)
Mutual labels:  sbt
literator
📝 Generate literate-style markdown docs from your sources
Stars: ✭ 55 (-78.26%)
Mutual labels:  sbt
headless-chrome
Implementation of the new headless chrome with chromedriver and selenium.
Stars: ✭ 34 (-86.56%)
Mutual labels:  sbt
broom
A disk cleaning utility for developers.
Stars: ✭ 38 (-84.98%)
Mutual labels:  sbt
spark-hello-world
A simple hello world using Apache Spark
Stars: ✭ 22 (-91.3%)
Mutual labels:  sbt
sbt-ammonite-classpath
Export the classpath for Ammonite and Almond
Stars: ✭ 29 (-88.54%)
Mutual labels:  sbt
java-play-angular-seed
🍁 Java Play 2.7.x + Angular 8 with Angular CLI seed project with full-fledged build process
Stars: ✭ 53 (-79.05%)
Mutual labels:  sbt
scala-basic-skeleton
Starting point if you want to bootstrap a project in Scala
Stars: ✭ 16 (-93.68%)
Mutual labels:  sbt
kafka-streams-scala-examples
No description or website provided.
Stars: ✭ 16 (-93.68%)
Mutual labels:  sbt
lagom-java-sbt-chirper-example
No description or website provided.
Stars: ✭ 16 (-93.68%)
Mutual labels:  sbt
scalajs-all-in-one-template
The All-in-One Scala.js static web project template
Stars: ✭ 47 (-81.42%)
Mutual labels:  sbt
Soteria
Plugin to block compilation when unapproved dependencies are used or code styling does not comply.
Stars: ✭ 36 (-85.77%)
Mutual labels:  sbt
dodo
The Twitter OSS Project Builder
Stars: ✭ 25 (-90.12%)
Mutual labels:  sbt
sbt-publish-more
📤 Publish artifacts to more than one repository
Stars: ✭ 21 (-91.7%)
Mutual labels:  sbt

Example sbt project that compiles using Scala 3

Build Status

Usage

This is a normal sbt project, you can compile code with sbt compile and run it with sbt run, sbt console will start a Scala 3 REPL.

If compiling this example project fails, you probably have a global sbt plugin that does not work with Scala 3, try to disable all plugins in ~/.sbt/1.0/plugins and ~/.sbt/1.0.

IDE support

Scala 3 comes built-in with IDE support, to try it out see IDE support for Scala 3

Making a new Scala 3 project

The fastest way to start a new Scala 3 project is to use one of the following templates:

Using Scala 3 in an existing project

You will need to make the following adjustments to your build:

project/plugins.sbt

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3")

Here, dotty is the project name for technologies that are considered for inclusion in Scala 3. Since the development of Scala 3 is not done, the word dotty and Dotty still can be seen in some names of Scala 3 related tools, sbt plugins, etc.

project/build.properties

sbt.version=1.4.7

You must use sbt 1.4 or newer; older versions of sbt are not supported.

build.sbt

Set up the Scala 3 version:

scalaVersion := "3.0.0-RC1"

Nightly builds

If the latest release of Scala 3 is missing a bugfix or feature you need, you may wish to use a nightly build. Look at the bottom of the list of releases to find the version number for the latest nightly build. Alternatively, you can set scalaVersion := dottyLatestNightlyBuild.get to always use the latest nightly build of Scala 3.

Getting your project to compile with Scala 3

When porting an existing project, it's a good idea to start out with the Scala 2 compatibility mode (note that this mode affects typechecking and thus may prevent some valid Scala 3 code from compiling) by adding to your build.sbt:

scalacOptions ++= { if (isDotty.value) Seq("-source:3.0-migration") else Nil }

Using the isDotty setting ensures that this option will only be set when compiling with Scala 3. For more information on the -source flag, see language versions; for more information on migrating to Scala 3, see the migration guide.

If your build contains dependencies that have only been published for Scala 2.x, you may be able to get them to work on Scala 3 by replacing:

    libraryDependencies += "a" %% "b" % "c"

by:

    libraryDependencies += ("a" %% "b" % "c").withDottyCompat(scalaVersion.value)

This will have no effect when compiling with Scala 2.x, but when compiling with Scala 3 this will change the cross-version to a Scala 2.x one. This works because Scala 3 is currently retro-compatible with Scala 2.x.

Alternatively, to set this setting on all your dependencies, you can use:

    libraryDependencies := libraryDependencies.value.map(_.withDottyCompat(scalaVersion.value))

Discuss

Feel free to come chat with us on the Scala 3 gitter!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].