Scalingo supports Gradle, a famous build automation system for Java. The details of the Scalingo’s Java support are described in this article.

This buildpack will detect your app as using Gradle if it has a build.gradle file, settings.gradle file, or gradlew file. If you are using gradlew, do not forget to add the gradle/wrapper directory to your git repository:

git commit gradlew gradle/wrapper -m "Gradle Wrapper"

Then deploy again with git push scalingo master.

Note: These files must not be in your .gitignore. If you forgot to add these files, you will receive the following error:

-----> executing ./gradlew stage
       Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Verify that your build file is set up correctly

The Gradle buildpack will run different build tasks depending on the framework it detects. If your framework is Spring Boot, it will run ./gradlew build -x test. For Ratpack, it will run ./gradlew installDist -x test. If no known web frameworks are detected, it will run ./gradlew stage.

To create a custom task, you can create a stage task in your build.gradle file like:

task stage(dependsOn: ['build', 'clean'])
build.mustRunAfter clean

You can also override the default task by setting the GRADLE_TASK environment variable either on the dashboard or using the CLI tool:

scalingo env-set GRADLE_TASK="build"

Default web process type

Depending on the detected framework, this buildpack will automatically create a web procees. For Spring Boot, the web process will be:

java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/*.jar

For Ratpack, the web process will be:


with ${} the configured value in your Gradle build (probably in your settings.gradle`).

If you need to customize the default web process, you must create a Procfile.

Using Grails 3

Grails 3 requires both to have webapp-runner and to setup a custom stage task in your build.gradle. First, add the following line in the dependencies section:

compile "com.github.jsimone:webapp-runner:"

Then add this at the end of your build.gradle:

task stage() {
    dependsOn clean, war
tasks.stage.doLast() {
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/assetCompile")
    delete fileTree(dir: "build/distributions")
    delete fileTree(dir: "build/libs", exclude: "*.war")
war.mustRunAfter clean

task copyToLib(type: Copy) {
    into "$buildDir/server"
    from(configurations.compile) {
        include "webapp-runner*"


Eventually, create a Procfile at the root of your project with this web process:

web: cd build ; java -Dgrails.env=prod -jar ../build/server/webapp-runner-*.jar --expand-war --port $PORT ./libs/*.war

Moving into the build directory is mandatory for Grails.


A live example is available here with the source code on GitHub.

schedule 26 Oct 2016