mirror of
https://github.com/Rainyy21/framework_note.git
synced 2026-10-11 00:30:29 -04:00
vault backup: 2026-05-30 16:02:33
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
---
|
||||
tags:
|
||||
- devop
|
||||
- video
|
||||
- maven
|
||||
- java
|
||||
up: "[[00_devop_note]]"
|
||||
related: "[[Maven]]"
|
||||
source: https://www.youtube.com/watch?v=T00NKLQvwYE
|
||||
author: Cameron McKenzie (TheServerSide)
|
||||
published: 2023-08-27
|
||||
---
|
||||
# Learn Apache Maven Full Tutorial in Java for Beginners
|
||||
|
||||
> An hour-long beginner-friendly course that walks through Apache Maven from scratch — installation, configuration, core commands, dependencies, plugins, and integrations with Jenkins and Docker.
|
||||
|
||||
## Overview
|
||||
Apache Maven is the most widely used build automation tool in the Java ecosystem (used by ~70% of Java organizations). This tutorial progresses from foundational concepts (installing Java/JDK and Maven) through to advanced topics like building cloud-native microservices and CI/CD integration.
|
||||
|
||||
## Topics Covered
|
||||
|
||||
### 1. Getting Started
|
||||
- What Maven is and what it enables developers to do
|
||||
- Installing the JDK (prerequisite)
|
||||
- Downloading, installing, and configuring Maven
|
||||
- Verifying the install with `mvn -v`
|
||||
|
||||
### 2. Core Maven Commands
|
||||
- `mvn compile` — compile source code
|
||||
- `mvn test` — run unit tests
|
||||
- `mvn package` — bundle compiled code into a JAR/WAR
|
||||
- `mvn install` — install artifact into local repo
|
||||
- `mvn deploy` — push artifact to a remote repo
|
||||
- `mvn clean` — wipe the `target/` directory
|
||||
|
||||
### 3. The POM File (`pom.xml`)
|
||||
- The heart of every Maven project
|
||||
- POM types (parent, aggregator, effective POM)
|
||||
- Properties and how they control build behavior
|
||||
- Project coordinates: `groupId`, `artifactId`, `version`
|
||||
|
||||
### 4. Dependency Management
|
||||
- Declaring dependencies
|
||||
- **Scopes**: `compile`, `provided`, `runtime`, `test`, `system`
|
||||
- External dependencies
|
||||
- Exclusions and optional dependencies
|
||||
- How Maven resolves transitive dependencies
|
||||
|
||||
### 5. Plugins
|
||||
- Plugins extend Maven's core functionality
|
||||
- Commonly used:
|
||||
- **Compiler Plugin** — controls the Java source/target version
|
||||
- **Surefire Plugin** — runs unit tests
|
||||
- When to add a plugin vs. rely on defaults
|
||||
|
||||
### 6. Maven vs. Gradle
|
||||
- Comparison of the two dominant JVM build tools
|
||||
- Tradeoffs: XML configuration (Maven) vs. Groovy/Kotlin DSL (Gradle)
|
||||
- Why Maven still dominates enterprise Java
|
||||
|
||||
### 7. IDE Integration
|
||||
- Creating and managing Maven projects in **IntelliJ IDEA** and **Eclipse**
|
||||
- Building projects from the IDE
|
||||
- Creating executable JARs
|
||||
- Handling multi-module projects
|
||||
|
||||
### 8. DevOps Integration
|
||||
- **Maven + Jenkins** — running builds in CI pipelines
|
||||
- **Maven + Docker** — packaging artifacts into Docker images
|
||||
- Building cloud-native microservices
|
||||
|
||||
## Key Takeaways
|
||||
- Maven is *opinionated* — follow the standard directory layout (`src/main/java`, `src/test/java`) and most things just work
|
||||
- The `pom.xml` is declarative; you describe *what* the project is, not *how* to build it
|
||||
- Dependency scopes matter — using `test` scope keeps test libraries out of production artifacts
|
||||
- Plugins are how Maven gets extended; nearly every advanced behavior is plugin-driven
|
||||
|
||||
## Actionable Next Steps
|
||||
- [ ] Install JDK and Maven; verify with `mvn -v`
|
||||
- [ ] Generate a starter project: `mvn archetype:generate`
|
||||
- [ ] Try the full lifecycle: `mvn clean package`
|
||||
- [ ] Add a dependency from [Maven Central](https://search.maven.org)
|
||||
- [ ] Wire a simple project into Jenkins or Docker
|
||||
|
||||
## Source
|
||||
- Video: [Learn Apache Maven Full Tutorial in Java for Beginners](https://www.youtube.com/watch?v=T00NKLQvwYE)
|
||||
- Companion article: [TheServerSide — Learn Maven tutorial for beginners](https://www.theserverside.com/video/Learn-Maven-tutorial-for-beginners)
|
||||
Reference in New Issue
Block a user