# Maven kursen uppdaterad

11 december 2023 | https://www.ribomation.se/blog/2023/maven-kursen-uppdaterad/

Maven har i grunden revolutionerat Java världen, med dess införande av standardisering av projekt via konfigurering-via-konventioner, automagisk beroendehantering, generering av en komplett webbplats för teknisk projekt dokumentation med mera.

Denna kurs vänder sig till dig som ska börja i ett Java projekt där man använder Maven som projekt-byggnads-ramverk och snabbt vill komma igång och vara produktiv. Kursen utgår från Maven version 3 och använder moderna versioner av Java och andra verktyg.

Här kan du se innehållsförteckningen

### Introduction

Course and topic introduction and overview

#### Background and Overview

Inventor and why Maven was created

#### How to build a Java application

Or, why do we need a build tool?

*   Compiling a single Java file
*   Compiling several Java classes
*   Separation of sources from build output
*   Understanding the _class-path_
*   Creating a JAR file
*   Brief about the JAR Manifest file
*   Using external libraries
*   What is an _Application JAR_?
*   Generate documentation
*   Writing unit tests
*   Running unit tests
*   Understand transitive dependencies

#### Brief about Java Build Tools

*   Ant
*   Maven
*   Ivy
*   Gradle

### Maven Fundamentals

The most essential things you need to know regarding Maven

#### Installation

*   Different ways of installing Maven
*   Installing SDKMan
*   Install `mvn` using `sdkman`
*   Creating a _Hello Maven_ project
*   Installing _Maven Wrapper_
*   Using `mvn` vs. `mvnw`
*   Configure proxy settings

#### Concepts

*   Standardized project layout
*   The POM and its structure
*   Important POM elements
*   Standardized build commands
*   Plugins
*   Plugin goals
*   The Maven build life-cycle
*   Local settings
*   Archetypes
*   Building our demo application using Maven

#### Building Java Programs

*   Overview of the steps
*   Setting Java options
*   Passing compiler options, not directly supported by the compiler plugin
*   Resources
*   Creating JAR files

#### Dependencies

*   What is a dependency
*   Understanding the concept artefact repository
*   What is transitive dependency
*   How to search for 3rd party libraries (JARs)
*   Maven coordinates
*   Configuring dependencies
*   Scopes

### Maven Usage

Typical use cases when working with Maven powered builds

#### Unit Tests

*   Setting up test source directories
*   Understand the Surefire plugin
*   Using JUnit 5 as the testing framework
*   Loading resource files from the class path
*   Running tests
*   Suppressing tests

#### Building Java Applications

*   Making a JAR executable
*   Dealing with dependencies
*   Unpacking using the Dependency plugin
*   Creating bundles with the Assembly plugin
*   Creating an executable Application JAR

#### Building Web Applications

*   Web app directory structure
*   Web POM
*   Building WAR artefacts
*   Running a WAR file

#### Reports

*   Generate Javadoc for the project
*   Using user-defined java-doc tags
*   Generate a report based on the results of unit tests
*   Generate code coverage reports
*   Generate a source cross-reference
*   Generate standard project reports
*   Generate a PMD report

#### Using the Site Plugin

*   Directory content
*   Site descriptor
*   Generating a site
*   Reports
*   Report plugins
*   Markup formats for user written pages
*   Providing assets, such as CSS and images

#### Integration Tests

*   Using the Failsafe plugin
*   Running integration tests
*   Using Spock as the testing framework

#### Toolchains

*   What is a Java toolchain
*   Using the Toolchain plugin
*   Using standard JDK toolchains
*   Creating a custom toolchain

### Multi-Module Projects

How to work with several Maven projects providing separate artefacts for a large application

#### Understanding a multi-module project

*   The single project artefact principle
*   How it differs from a single-module project
*   Parent POM
*   Child POM
*   Running recursive Maven build commands
*   Module dependencies

#### More about working with multi-module projects

*   The Flatten plugin
*   The Enforcer plugin
*   Understanding Maven BOM (Bill of Materials)

#### Java Monorepo

*   What is a monorepo
*   Structure of a multi-module monorepo project
*   Building an API module
*   Building a library module
*   Building a web module
*   Building an application module

#### Using Maven for Spring Boot

*   What are Spring Framework and Spring Boot
*   Using the Spring Initializr
*   Spring dependencies and starter dependencies
*   Spring Boot Fat JAR

### Maven Proxy and Repository Servers

How to work with internal repositories

#### Maven Repositories

*   What is a Maven repository, really?
*   Configuration and settings
*   Common public repositories
*   The local Maven cache
*   Installing JARs to the local cache and why it is useful
*   Using non-standard repositories
*   Mirrors
*   Configure credentials

#### Deployment

*   What is a Maven deployment
*   Deploy to cloud Maven repo
*   Configuration

#### Maven Servers

*   Overview of Maven servers
*   Installation of Nexus
*   Installation of Artifactory
*   Deployment to an in-house Maven server

#### The Release Plugin

*   The release process
*   Supply chain management
*   Release prepare and perform
*   Release rollback
*   Dry run
*   Build profiles
*   Profile properties

### User-Defined Plugins

How to write your own plugin

#### How to write a simple plugin

*   Understanding Mojo
*   Build and usage
*   Parameters
*   Logging
*   Documentation

### Wrapping Up

#### Overview of the upcoming Maven 4

*   Better support for multi-project builds
*   Improved dependency management
*   Possibility of non-XML POM
