Vidulividuli

Java

Comprehensive information about Java app configuration.

Common Settings

This section outlines common settings and behaviours for Java projects.

Java Version

The Java version is automatically detected from .java-version file in the root directory of your project and the appropriate image is selected according to it.

To use a different version of Java other than the default, create a .java-version file and add the version to it. Example,

21

Ensure you use a version supported by the eclipse-temurin image.

Build Tool

The build system automatically detects your build tool:

  • If pom.xml exists - Maven is used
  • If build.gradle or build.gradle.kts exists - Gradle is used

Both Maven and Gradle wrappers are expected.

Build Process

Java builds on Viduli use separate build and run images.

  • Build stage: Uses JDK image for compilation
  • Runtime stage: Uses JRE image (smaller footprint)

Spring Boot

Spring Boot builds on Viduli use separate build and run images.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -B -DskipTests
  • Gradle: ./gradlew build -x test --no-daemon

You can customize it by setting the build command value in the resource build configuration.

Run command

The default is java -XX:+UseContainerSupport -jar ./app.jar. The build system automatically finds and moves the main JAR file to into the container as app.jar.

The run command can be overridden by providing the run command in the build section of the resource configuration.

Environment

JAVA_TOOL_OPTIONS is not set by default. You can set it via secrets if needed.

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Quarkus

Quarkus builds on Viduli use separate build and run images.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -DskipTests -Dquarkus.package.type=fast-jar -B
  • Gradle: ./gradlew build -x test --no-daemon

The build creates a Quarkus fast-jar in the target/quarkus-app/ directory.

You can customize it by setting the build command value in the resource build configuration.

Run command

The default uses an entrypoint script that automatically detects and runs quarkus-run.jar. The entrypoint script:

  • Automatically finds quarkus-run.jar in the current directory
  • Falls back to APP_JAR environment variable if set
  • Handles multiple JAR files gracefully

It can be overridden by providing the run command in the resource build configuration.

Environment

JAVA_TOOL_OPTIONS is not set by default. You can set it via secrets if needed.

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Micronaut

Micronaut builds on Viduli use separate build and run images.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -B -DskipTests -Dmicronaut.environments=prod
  • Gradle: ./gradlew build -x test --no-daemon

You can customize it by setting the build command value in the resource build configuration.

Run command

The default is java -XX:+UseContainerSupport -jar ./app.jar. The build system automatically finds and moves the main JAR file as app.jar into the runtime container. It can be overridden by providing the run command in the resource build configuration.

Environment

JAVA_TOOL_OPTIONS is not set by default. You can set it via secrets if needed.

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Vert.x

Vert.x builds on Viduli use separate build and run images.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8888

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -B -DskipTests
  • Gradle: ./gradlew build -x test --no-daemon

The build creates a fat JAR with all dependencies included.

You can customize it by setting the build command value in the resource build configuration.

Run command

The default uses an entrypoint script that automatically detects and runs the Vert.x application. The entrypoint script handles JAR file detection and execution.

It can be overridden by providing the run command in the resource build configuration.

Environment

JAVA_TOOL_OPTIONS is set to -XX:+UseContainerSupport to optimize JVM memory settings for containers.

By default, PORT is set to 8888. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Ktor (Kotlin)

Ktor builds on Viduli use separate build and run images.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -B -DskipTests
  • Gradle: ./gradlew build -x test --no-daemon

The build creates an all-in-one JAR with all dependencies included.

You can customize it by setting the build command value in the resource build configuration.

Run command

The default uses an entrypoint script that automatically detects and runs the Ktor application. The entrypoint script handles JAR file detection and execution.

It can be overridden by providing the run command in the resource build configuration.

Environment

JAVA_TOOL_OPTIONS is set to -XX:+UseContainerSupport to optimize JVM memory settings for containers.

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Java (Generic)

The generic Java build option is suitable for deploying projects that are not built using a supported Java framework. If your project uses a supported framework such as Spring Boot or Quarkus, please select that option when deploying your project. By selecting the appropriate framework build, you get optimal settings that are not available when selecting the generic java option.

  • Base distribution: Debian Noble (JDK for build, JRE for runtime)
  • Default Java version: 21
  • Default image:
    • Build: eclipse-temurin:21-jdk-noble
    • Runtime: eclipse-temurin:21-jre-noble
  • Included packages:
    • Build: build-essential ca-certificates tzdata
    • Runtime: ca-certificates tzdata procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are cached before building to optimize build times:

  • Maven: ./mvnw dependency:go-offline -B
  • Gradle: ./gradlew dependencies --no-daemon

Build command

By default, the build command is:

  • Maven: ./mvnw clean package -B -DskipTests
  • Gradle: ./gradlew build -x test --no-daemon

You can customize it by setting the build command value in the resource build configuration.

Run command

The default is java -XX:+UseContainerSupport -jar ./app.jar. The build system automatically finds and moves the main JAR file as app.jar into the runtime container. It can be overridden by providing the run command in the resource build configuration.

Environment

JAVA_TOOL_OPTIONS is not set by default. You can set it via secrets if needed.

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.