Deploying Java Projects
Zeabur supports deploying Java projects that use the Maven or Gradle build systems, with either native or Spring Boot frameworks.
JAR File Discovery
By default, Zeabur automatically finds your JAR (or WAR) file in the standard build output directory:
- Maven:
target/*.jar(ortarget/*.war) - Gradle:
build/libs/*.jar(orbuild/libs/*.war)
This works out of the box for standard single-module projects.
JAR in a Subdirectory
If your JAR file is not in the default location — for example, in a multi-module project where the runnable JAR is built under a submodule — you need to specify the path explicitly using javaArgs in zbpack.json:
{
"javaArgs": "-jar my-server/target/server.jar"
}For Spring Boot projects, remember to include the port binding so Zeabur can route traffic to your service:
{
"javaArgs": "-Dserver.port=$PORT -jar my-server/target/server.jar"
}When javaArgs is set, it completely replaces the default startup command. You must include -jar path/to/your.jar yourself.
Project in a Subdirectory
If your entire Java project (including pom.xml or build.gradle) lives in a subdirectory of the Git repository, use the Root Directory setting instead. This tells Zeabur to treat that subdirectory as the project root, and default JAR discovery will work as normal.
Environment Setup
The available JDK versions are:
- 19
- 17 (default)
- 11
- 8
- 7
Specifying JDK Version
You can specify the JDK version in pom.xml or build.gradle.
For example, if you’re using Maven, add the following to pom.xml:
<properties>
<java.version>11</java.version>
</properties>If you’re using Gradle, add the following to build.gradle:
sourceCompatibility = 11Specifying JVM Startup Parameters
You can override Zeabur’s default JVM startup parameters with the javaArgs field in zbpack.json.
When using javaArgs, you must include the full command arguments including -jar and the path to your JAR file.
{
"javaArgs": "-Xms128m -Xmx512m -jar target/your-app.jar"
}