Scala

Scala is officially supported on Scalingo.

It uses sbt 0.11.0+.

Usage

Example usage:

$ ls
Procfile build.sbt project src

$ scalingo create my-app

$ git push scalingo master
...
-----> Scala app detected
-----> Building app with sbt
-----> Running: sbt compile stage

The buildpack will detect your app as Scala if it has the project/build.properties and either *.sbt in the root directory or project/*.scala or .sbt/*.scala. It vendors a version of sbt and your populated .ivy/cache into your container. The .ivy2 directory will be cached between builds to allow for faster build times.

JDK Compatibility

Be careful when you update the Java runtime of your application. If the Scala version does not support the version of Java you specified the build can most likely fail.

Please use a Scala version compatible with the Java version you want to use to fix the build. Refer to this official Scala documentation page to know which versions are compatible.

Clean builds

In some cases, builds need to clean artifacts before compiling. If a clean build is necessary, configure builds to perform clean by setting SBT_CLEAN=true:

$ scalingo env-set SBT_CLEAN=true
SBT_CLEAN has been set to true.

All subsequent deploys will use the clean task. To remove the clean task, unset SBT_CLEAN:

$ scalingo env-unset SBT_CLEAN
SBT_CLEAN has been unset.

Common Issues

Not a Valid Command: stage

Deployment logs:

[error] Not a valid command: stage
[error] Not a valid project ID: stage
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: stage
[error] stage
[error]      ^

In this situation, your project lacks the package sbt-native-packager. This plugin aims at packaging Scala applications into various kind of destination packages.

You need to add the depdencendy in your project/plugins.sbt file:

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.18")

Then once done, enable the packaging into a Java app for your project (in your build.sbt):

enablePlugins(JavaAppPackaging)

That’s it, the stage command will now be found by our deployment system.

Buildpack

More information at https://github.com/Scalingo/scala-buildpack.


Suggest edits

Scala

©2024 Scalingo