Qoddi’s Gradle buildpack uses Gradle to build your application and OpenJDK to run it.
Usage
- Install the Gradle Wrapper into your project.
- This allows control over the Gradle version and exact distribution to be used.
- Specify the Java version to be used as per these instructions (see specify a Java version).
- Make sure you have a
gradle.build
or agradlew
file in your repository.
If you are using gradlew
, then you must also add your gradle/wrapper/gradle-wrapper.jar
and gradle/wrapper/gradle-wrapper.properties
files to your Git repository. Also, they must not be ignored in your .gitignore
file. If you do not add these files, you will receive an error.
The Gradle buildpack will run different build tasks depending on the frameworks it detects in your app. For 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
If the framework you’re using does not automatically vendor dependencies for you, then your build.gradle
file should include a Copy
task that tells Gradle to copy the jar files that your app depends on to the build/libs
directory. This way, they are put into the slug, and the .m2
directory can be removed from the slug.
Specify a Java version
Optionally you can specify a Java version by following the steps detailed here (see Specify a Java Version).
Default web process type
The Gradle buildpack will automatically detect the use of the Spring Boot and Ratpack web frameworks. For Spring Boot, it will create a web process type with the following command:
java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/*.jar
For Ratpack, the buildpack will use a command in the following form:
build/install/${rootProject.name}/bin/${rootProject.name}
Where ${rootProject.name}
is the value configured in your Gradle build (often in your settings.gradle
).
If you need to customize or override the default web
command, you must create a Procfile
See the Java documentation about the Procfile
Was this helpful?
8 / 5