- Documentation
- Technologies
- Java
Java
Guara Cloud fully supports Java applications, including frameworks like Spring Boot, Quarkus, Micronaut, and any Maven or Gradle-based project.
Supported versions
The following Java versions are auto-detected:
- Java 17 (LTS)
- Java 21 (LTS)
The version is auto-detected from your pom.xml (Maven) or build.gradle (Gradle) configuration.
<!-- pom.xml -->
<properties>
<java.version>21</java.version>
</properties>
Deploy with Dockerfile
A multi-stage build is the recommended approach for Java applications. It compiles your application with the full JDK, then runs it using only the JRE.
Deploy with Buildpack
If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Java project by the presence of a pom.xml or gradlew file.
The auto-detection will:
- Detect the JDK version from your project configuration (
pom.xmlorbuild.gradle) - Build your project with Maven or Gradle
- Auto-detect and run the Spring Boot JAR if present
- Start the application
Port configuration
Your application must listen on the port configured in your service settings. The default is 3000, but you can change it at any time to match your application.
For Spring Boot, configure it in application.properties:
server.port=${PORT:3000}
For Quarkus, use application.properties:
quarkus.http.port=${PORT:3000}
Example project structure
my-java-app/
pom.xml
Procfile
src/
main/
java/
com/example/
Application.java
resources/
application.properties
Dockerfile # optional — omit to use Buildpack
Environment variables
These environment variables are commonly used with Java deployments:
| Variable | Recommended value | Description |
|---|---|---|
PORT | Set by platform | The port your application must listen on |
JAVA_OPTS | -Xmx512m | JVM memory and performance flags |
SPRING_PROFILES_ACTIVE | production | Activates the production Spring profile |