Miget Buildpacks automatically detect and build your Java applications when you select Auto detection (Miget Buildpacks) as the build method. Maven and Gradle projects are supported with automatic build tool detection. For the full reference, visit the migetpacks Java documentation.

Detection

Your application is detected as Java when one of these files is present in the root directory:
  • pom.xml (Maven)
  • build.gradle or build.gradle.kts (Gradle)

Version Detection

The Java version is determined from the following sources, in order of priority:
  1. .java-version
  2. system.properties (e.g., java.runtime.version=17)
  3. pom.xml properties (e.g., <java.version>17</java.version> or <maven.compiler.release>17</maven.compiler.release>)
If no version is specified, a recent LTS version is used.

Build Process

During the build, the following steps are performed:
  1. Build tool detection - The build tool is auto-detected:
    • pom.xml → Maven
    • build.gradle or build.gradle.kts → Gradle
  2. Gradle wrapper - If a Gradle wrapper (gradlew) is present, it is used instead of a system-installed Gradle.
  3. Compilation - Your application is compiled and packaged (e.g., into a JAR or WAR).
  4. JVM provisioning - The Eclipse Temurin JDK is used for building, and the appropriate JRE is included in the runtime image.

Run Command

The run command is auto-detected from the JAR manifest (e.g., the Main-Class attribute). You can override it with a Procfile. You can also override the run command directly in the Miget dashboard when creating your app or changing the deployment source.
Builder settings showing Run Command override

Configuration

You can customize the build and runtime behavior through the Miget dashboard and repository configuration files:
  • Environment variables - Set under Settings -> Variables in the Miget dashboard
  • JAVA_OPTS - Pass JVM flags such as memory settings (e.g., -Xmx512m)
  • Procfile - Define the start command at the root of your repository
  • app.json - Application manifest for additional configuration
  • Project Path - For monorepo setups, specify the subdirectory containing your application code in the Advanced tab
  • Pre-Deploy Command - Run a command before deployment (e.g., database migrations) in the Advanced tab
  • Post-Deploy Command - Run a command after successful deployment (e.g., seeding data, cache warming) in the Advanced tab

Docker Hardened Images

You can enable Docker Hardened Images (DHI) in the Advanced tab when creating your app or changing the deployment source. When enabled, your application is built using distroless runtime images with a minimal attack surface, no shell, and no package manager.
Advanced builder settings with Docker Hardened Images toggle
The DHI runtime uses Eclipse Temurin.
For the complete reference, see the migetpacks Java documentation.