06- Maven Goals Explained | Compile, Test, Package, Install, Site | DevOps Mastering Batch
Welcome to DevOps Mastering Batch – Lecture 06
In this lecture, we deeply understand Maven Goals and Lifecycle Phases with hands-on practical examples.
We cover:
✔ mvn compile
✔ mvn clean
✔ mvn test
✔ mvn package
✔ mvn install
✔ mvn site
✔ Skipping tests
✔ Debug mode (-X)
✔ Running JAR files
✔ Direct plugin goals (compiler, surefire, jar)
This session is very important for:
DevOps Engineers
Java Developers
CI/CD Pipeline Engineers
Interview preparation
🔹 Commands Practiced in This Lecture
mvn compile
mvn clean
mvn clean compile
mvn test
mvn clean test
mvn package
mvn clean package
java -cp .\target\basic_mvnproj-1.0-SNAPSHOT.jar com.kmitcourses.App
mvn clean install
mvn site
Direct plugin goals
mvn compiler:compile
mvn surefire:test
mvn jar:jar
Skip tests
mvn clean package -DskipTests
Debug mode
mvn clean package -X
🔥 Topics Covered in Detail
✅ Maven Lifecycle Phases
validate
compile
test
package
install
deploy (concept explanation)
✅ Clean Lifecycle
clean phase
Removing target directory
✅ Site Lifecycle
mvn site
Project documentation generation
✅ Plugin Goals
compiler plugin
surefire plugin
jar plugin
✅ Running JAR Manually
Using:
java -cp target\jarfile.jar fully.qualified.MainClass
✅ Skipping Tests
Using:
-DskipTests
✅ Debug Mode
Using:
-X
🎯 Real DevOps Usage
✔ Used in Jenkins pipelines
✔ Used in CI/CD builds
✔ Packaging microservices
✔ Installing artifacts to local repository
✔ Debugging build failures
By the end of this lecture, you will clearly understand:
Maven lifecycle
How goals execute
How plugins work
How Maven integrates in DevOps pipelines
maven tutorial, maven goals explained, mvn compile test package, maven lifecycle phases, mvn clean install, maven devops tutorial, devops mastering batch, maven full tutorial, maven plugin goals, mvn site command, mvn skip tests, mvn debug mode, maven interview questions, maven hands on tutorial, maven ci cd pipeline, maven build lifecycle, java maven tutorial, mvn package example, devops maven training, maven practical session