Docs menu
Getting started with Java
Deploy a minimal Spring Boot app to Primcloud end-to-end using a sample repo, in about five minutes.
On this page
This guide walks through deploying a small Spring Boot app to Primcloud. You'll fork a sample repo, import it, watch the build, and reach the running app at a *.primcloud.app URL. It takes about five minutes.
Before you start#
You'll need:
- A Primcloud account. Standard accounts have no monthly fee; compute is metered by the minute once you deploy, from around $5/mo for the smallest app.
- A git provider connected to your Primcloud account; see Source Control.
- Optional: OpenJDK 17 or newer and Maven (or the bundled Maven wrapper) installed locally, if you want to run the sample or change it before deploying.
The sample app#
Use Heroku's heroku/java-getting-started repo. It's a minimal Spring Boot app that builds on Primcloud with no changes: a pom.xml, a Maven wrapper, and a Procfile. Fork it into an account you've connected to Primcloud.
1. Create the application#
Hit Import Git Repository on the applications list, then:
- Select your fork of
java-getting-started. - Configure the branch (
main) and a region. - Verify the commit and hit Import.
2. Deploy#
The first deployment starts as soon as the app is created, and its build log streams live:
-
Detection. Primcloud sees the
pom.xmlat the repo root and picks the Java toolchain. -
Build. Primcloud installs OpenJDK (the latest LTS by default), then runs the Maven wrapper:
./mvnw clean install -DskipTests. Dependencies are kept for the next build. -
Start. Primcloud reads the
Procfileand starts thewebprocess. The sample'sProcfileis one line:Procfileweb: java -jar target/java-getting-started-1.0.0-SNAPSHOT.jar
When the deployment's Rollout phase shows Complete, the app is live.
3. Reach the app#
The application dashboard shows the assigned *.primcloud.app URL in the header. Click it, and the Spring Boot sample loads.
If it doesn't come up:
- Deployments: the build log has the raw output from Maven.
- Logs: runtime output from your app streams there, including any startup errors.
- Confirm the app binds to the port in
$PORT. Primcloud setsPORTto5000on thewebprocess, and the Spring Boot sample reads it throughserver.port=${PORT:5000}inapplication.properties. Your own apps need to do the same, or pass-Dserver.port=$PORTin theProcfilelaunch command.
Where to go next#
- Deploying a Gradle app or a different framework: Java on Primcloud for detection, build behavior, and how your process launches.
- Pinning a specific JDK version: Runtime versions.
- Using a private Maven or Gradle repository: Package managers.
- Changing the build command or trusting a private CA: Customizing the build.
- Something breaking: Troubleshooting Java.