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 are free to create; compute is metered by the minute once you deploy, from around $5/mo for the smallest app.
- A git provider connected to your account with access to at least one repo.
- 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 cleanly on Primcloud with no changes: a pom.xml, a Maven wrapper, and a Procfile. Fork it into an account your connected provider can see, so Primcloud can pull from it.
1. Create the application#
From the Primcloud dashboard, hit Import Git Repository on the applications list. The import wizard walks you through three quick steps:
- Pick a repository: select your fork of
java-getting-started. - Configure the deployment:
- Branch:
main(the fork's default). - Region: US East (NYC).
- Branch:
- Review and create: Primcloud provisions the app's primary
*.primcloud.appsubdomain on the production environment.
2. Deploy#
The first deployment starts automatically when the app is created. Watch it stream in the Deployments tab:
-
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. The local.m2repository fills up and is cached for the next build. -
Release. 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 status flips to Release Succeeded, 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.