Java
Building a Java App
daedalus supports Java apps via Maven and Gradle. It detects a Java project by the
presence of pom.xml (Maven) or build.gradle / build.gradle.kts (Gradle).
Detection
| File | Build system | Entrypoint strategy |
|---|---|---|
pom.xml |
Maven | -jar target/*.jar or -cp with mainClass |
build.gradle |
Gradle | -jar build/libs/*.jar or -cp with mainClass |
The builder parses <mainClass> from:
maven-jar-pluginconfigurationexec-maven-pluginconfigurationspring-boot-maven-pluginconfigurationMANIFEST.MFinside the built JAR (fallback)application { mainClass.set(...) }in Gradle DSL
Prerequisites
- A JDK installed (
javaon PATH) - The app must be built before packaging:
- Maven:
mvn package - Gradle:
gradle build
- Maven:
Build
# Maven project
daedalus build ./my-java-app -o my-java-app.de
# Gradle project
daedalus build ./my-gradle-app -o my-gradle-app.de
The builder:
- detects the
javaruntime and locates the JAR intarget/orbuild/libs/; - parses the
mainClassfrom build config or JAR manifest; - embeds the
javainterpreter and its shared libraries; - packages the JAR into the app layer;
- compresses and assembles the
.de.
Entrypoint
The launcher runs:
/opt/java/bin/java -jar /app/my-app.jar
or if mainClass is known but no fat JAR exists:
/opt/java/bin/java -cp /app/classes com.example.Main
Spring Boot
Spring Boot apps are detected via spring-boot-maven-plugin or
spring-boot-gradle-plugin. The builder reads the mainClass from the plugin
configuration.
cd my-spring-app
mvn package
daedalus build . -o my-spring-app.de
./my-spring-app.de
Environment variables
JAVA_OPTS="-Xmx512m" ./my-java-app.de
PORT=9000 ./my-java-app.de
Known limitations
- The JDK is embedded as a runtime layer (not a JRE). Final binary is ~100-200MB depending on the JDK version. A JRE-only mode is planned.
- GraalVM native-image support is not yet implemented.
- Multi-module Gradle builds: only the main module's JAR is packaged.