Packaging & Deployment
Prerequisites: Performance optimization & profiling
A build tool packages a finished application into a single executable JAR file:
mvn package
java -jar target/myapp-1.0.jar
A Spring Boot JAR bundles an embedded web server, so it runs standalone with no separately-installed application server needed. For deployment, that JAR is typically built into a Docker image:
FROM eclipse-temurin:21-jre
COPY target/myapp-1.0.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
A CI/CD pipeline (GitHub Actions, GitLab CI, Jenkins) typically runs
mvn test on every push, then builds and pushes this image on a
merge to the main branch.