Use when working with Maven build phases, goals, profiles, or customizing the build process for Java projects.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/plugins/tools/maven/skills/maven-build-lifecycle/SKILL.md -a claude-code --skill maven-build-lifecycleInstallation paths:
.claude/skills/maven-build-lifecycle/# Maven Build Lifecycle Master Maven's build lifecycle including phases, goals, profiles, and build customization for efficient Java project builds. ## Overview Maven's build lifecycle is a well-defined sequence of phases that execute in order. Understanding the lifecycle is essential for effective build configuration and optimization. ## Default Lifecycle Phases ### Complete Phase Order ``` 1. validate - Validate project structure 2. initialize - Initialize build state 3. generate-sources 4. process-sources 5. generate-resources 6. process-resources - Copy resources to output 7. compile - Compile source code 8. process-classes 9. generate-test-sources 10. process-test-sources 11. generate-test-resources 12. process-test-resources 13. test-compile - Compile test sources 14. process-test-classes 15. test - Run unit tests 16. prepare-package 17. package - Create JAR/WAR 18. pre-integration-test 19. integration-test - Run integration tests 20. post-integration-test 21. verify - Run verification checks 22. install - Install to local repo 23. deploy - Deploy to remote repo ``` ### Common Phase Commands ```bash # Compile only mvn compile # Compile and run tests mvn test # Create package mvn package # Install to local repository mvn install # Deploy to remote repository mvn deploy # Clean and build mvn clean install # Skip tests mvn install -DskipTests # Skip test compilation and execution mvn install -Dmaven.test.skip=true ``` ## Clean Lifecycle ``` 1. pre-clean 2. clean - Delete target directory 3. post-clean ``` ```bash # Clean build artifacts mvn clean # Clean specific directory mvn clean -DbuildDirectory=out ``` ## Site Lifecycle ``` 1. pre-site 2. site - Generate documentation 3. post-site 4. site-deploy - Deploy documentation ``` ```bash # Generate site mvn site # Generate and deploy site mvn site-deploy ``` ## Goals vs Phases ### Executing Phases ```bash # Execut