A complete Java example is available on the Basics page.
# EarthfileFROM openjdk:8-jdk-alpineRUN apk add --update --no-cache gradleWORKDIR /java-exampledeps:COPY build.gradle ./RUN gradle buildbuild:FROM +depsCOPY src srcRUN gradle buildRUN gradle installSAVE ARTIFACT build/install/java-example/bin AS LOCAL build/binSAVE ARTIFACT build/install/java-example/lib AS LOCAL build/libdocker:COPY +build/bin binCOPY +build/lib libENTRYPOINT ["/java-example/bin/java-example"]SAVE IMAGE java-example:latest
For the complete code see the examples/java GitHub directory.