0% found this document useful (0 votes)
47 views

Intro To Maven

Maven is a build automation tool used primarily for Java projects. It handles building, dependencies, documentation, and reporting through a project object model (POM) file and predefined build lifecycles and goals. Maven uses a standardized directory structure and dependency management system to facilitate project building in a uniform, configurable way.

Uploaded by

Daniel Reckerth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Intro To Maven

Maven is a build automation tool used primarily for Java projects. It handles building, dependencies, documentation, and reporting through a project object model (POM) file and predefined build lifecycles and goals. Maven uses a standardized directory structure and dependency management system to facilitate project building in a uniform, configurable way.

Uploaded by

Daniel Reckerth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Daniel Reckerth

Content

1. What is Maven?
2. Key Features
3. How does it work?
4. Maven Directory Structure
5. POM file
6. Settings file
7. Life Cycle
8. Bibliography
1. What is Maven?

• software project management tool


• builds and manages any Java-based project
• hosted by the Apache package Foundation
2. Key Features

easier build
process
best practices
development
quality project
guidelines information
MAVE
N
model-based
builds uniform build
system
dependencies
manager
3. How does it work?
• build controlled via POM (Project Object Model) files
Build Life Cycles
• Phases
• Goals
read pom.xml
Maven Maven Local
Dependencies
(JAR) Repository

Build Plugins

Build Profiles

POM File
4. Maven Directory Structure
• predefined standard
• no need to specify any directory on the project level
5. POM File

• an XML file describing the resources of the project


• includes:
• directories of the source code
• test source
• external dependencies
• plugins
• other configurations and more

• describes what to build, not how to build it


• minimal POM file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.rdaniel</groupId>
<artifactId>unit-test-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
• project
• modelVersion
• Maven Coordinates – 3 tags
• groupId – the group from which the project is a part of
• artifactId – the name of the project
• version – project's version
• they would result in a JAR file built in and placed in the local Maven
repository
Dependencies
• most projects depend on other projects in order to build successfully
• 2 types:
• direct dependencies
• transitive dependencies

• example
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Properties
• avoid hardcoding values (like dependencies versions)
• provide flexibility to the build tool – passed at runtime
• examples:
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<junit.version>4.13.2</junit.version>
<pom.property1>env.MAVEN_HOME</pom.property1>
</properties>
Repositories
• holds build artifacts and dependencies
• two types:
• local – on the machine where Maven runs
• remote – external repositories providing artifacts for downloading
• configuring tags:
• releases, snapshots
• enabled
• updatePolicy
• checksumPolicy
• layout
Builds
• configure: plugins, directory to store the package, resource filtering
• two types:
• project build – base configurations per POM
• profile build – build configurations inside a profile
Builds - Resources
• used for: code generation, properties files, images, other files
• configured in the build part
• configuration tags:
• resources
• targetPath
• filtering
• directory
• includes
• excludes
• testResources
Builds - Plugins

• software component adding features of another software component


• configuration tags:
• maven coordinates
• extensions
• inherited
• configuration
• dependencies
• executions
6. Settings file
• an XML file
• used for global settings of Maven execution
• applied to all Maven project
• important elements:
• localRepository
• interactiveMode
• offline
• pluginsGroup
• server
• mirror
• proxy
• profile
7. Life Cycle

validate compile test

install verify package

deploy
8. Bibliography

• https://en.wikipedia.org/wiki/Apache_Maven
• https://maven.apache.org/
• Maven presentation – Marian Ungureanu, NTT Data Romania
• Maven Tutorial (jenkov.com)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy