Skip to main content

Updated for Fall 2026

Maven is the project management tool for coffee_maker, the Spring Boot backend. The Maven executable (mvn) can complete project management steps like building, testing, running, and deploying software systems, and it resolves software dependencies (other libraries) automatically. The details about a project are stored in a Project Object Model (POM) file.

This page walks through the POM section by section. The same material is in the technical-documents/maven-build.md document in your repository.

POM File

Details about how a project is built, tested, run, and deployed are stored in a POM file at the top level of the project. For CoffeeMaker that file is coffee_maker/pom.xml — open it alongside this page as you read.

When you open pom.xml in IntelliJ, you edit the XML directly. IntelliJ will autocomplete tag names and dependency coordinates as you type, and the Maven side panel gives you a structured view of the same information — dependencies, plugins, and lifecycle goals. After changing the POM, reload the project so IntelliJ picks up your edits — see Dependencies, below.

Project Overview

The first section of the Maven POM provides information about the project. These details are at the top of pom.xml.

The first line of the POM XML provides information about the schema for the project. The <modelVersion> is related to the version of Maven used.

The next group of items describes the project:

  • parent: The Spring project-type used as a template project. In this case, the Spring Boot starter parent. See Dependencies for why the parent matters more than it first appears.
  • groupId: The name of the group, ordered from most broad to most specific. Here, edu because we are an educational institution, ncsu because we are NC State, and csc326 for this course. The group id becomes the namespace of the packaged project for deployment.
  • artifactId: The name of the project artifact.
  • version: Version number for the project. This is especially important when you’re developing libraries, so that you can have multiple versions in case there are breaking changes.
  • name: The name of the project.
  • description: A short description of the project.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.5.16</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

	<groupId>edu.ncsu.csc326</groupId>
	<artifactId>coffee_maker</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>coffee_maker</name>
	<description>CoffeeMaker project for CSC 326</description>

    ...

</project>

Dependencies

The next section of the POM file lists the libraries that the project depends on. As part of the build process, Maven will visit the configured repositories and download the needed jars. The jars are cached in the .m2 folder under your computer’s user account, so they’re only downloaded once.

Each dependency has a groupId and an artifactId that together identify the library. A dependency may also have a scope — test for spring-boot-starter-test, so test-only libraries aren’t packaged into the deployed application, and runtime for the MySQL driver, which the application needs to run but not to compile.

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>com.mysql</groupId>
		<artifactId>mysql-connector-j</artifactId>
		<scope>runtime</scope>
	</dependency>

    ...

</dependencies>

Notice that none of CoffeeMaker’s dependencies specify a version. That is deliberate. When a version is left off, Maven uses the version that spring-boot-starter-parent specifies for that library — not the newest version available. The parent pins a set of library versions that Spring has tested together, so bumping the parent’s version upgrades the whole dependency set consistently. Declaring your own version on a dependency overrides the parent’s choice and opts you out of that guarantee, so leave it off unless you need a library the parent doesn’t manage.

If a dependency shows up underlined in red in pom.xml, or the Maven side panel reports it as unresolved, there is a problem with the dependencies. The first thing you should try is to have Maven redownload everything: in the Maven side panel, select the down arrow next to the reload icon and choose Reload All Maven Projects, or right click pom.xml and select Maven > Sync Project. If that doesn’t work, you may need to delete the current downloaded libraries. Close IntelliJ first, then delete the .m2 directory under your main user directory. Then restart IntelliJ and reload the Maven project.

To add a new dependency, search for its Maven coordinates on the library’s website or on a Maven repository. Spring maintains their own repository that you can search.

Properties

Properties about the project are in the properties tags. CoffeeMaker targets Java 21, and pins the versions of the Checkstyle plugin and the Checkstyle tool it runs.

<properties>
	<java.version>21</java.version>
	<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
	<checkstyle.version>13.10.0</checkstyle.version>
</properties>

Build

The build portion of the POM file describes the custom steps in building a Maven project.

Maven defines a standard build lifecycle made up of ordered phases — validate, compile, test, package, install, deploy — plus clean. Plugins attach their goals to those phases, which is how a build does anything beyond the defaults. CoffeeMaker uses three plugins.

  • spring-boot-maven-plugin binds its repackage goal to the package phase. That’s the step that turns the plain jar into an executable Spring Boot jar with its dependencies nested inside.
  • maven-checkstyle-plugin binds its check goal to the validate phase. Because validate is the first phase of the lifecycle, every build reports coding style problems before it compiles anything. It is configured with failOnViolation set to false, so style problems are reported to the console but do not break the build.
  • jacoco-maven-plugin measures test coverage. It attaches an agent before the tests run, writes a report after them, and — bound to the verify phase — compares your coverage against the course minimum of 60% line and 50% branch. It is configured with haltOnFailure set to false, so a shortfall is reported in the build output but does not break the build. See Coverage, below.
<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-checkstyle-plugin</artifactId>
			<version>${maven-checkstyle-plugin.version}</version>

            ...

			<executions>
				<execution>
					<id>checkstyle-validate</id>
					<phase>validate</phase>
					<goals>
						<goal>check</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

You can also run Checkstyle on its own:

./mvnw checkstyle:check        # report style problems to the console
./mvnw checkstyle:checkstyle   # generate the HTML report under target/

Your repository includes the Maven wrapper (mvnw), which downloads and uses a known-good Maven version. Prefer ./mvnw over a system-wide mvn — it is what the build server uses, so you get the same results.

See the technical-documents/static-analysis.md document in your repository for more on the CSC coding style and how to read Checkstyle’s output.

Coverage

JaCoCo measures how much of src/main/java your tests actually execute.

./mvnw test      # runs the tests and writes a coverage report
./mvnw verify    # also compares your coverage against the minimums and reports any shortfall

The minimums are 60% line and 50% branch, measured across the whole project rather than class by class, so a well-tested class can carry a thinner one. After a run, the browsable report is at target/site/jacoco-ut/index.html.

The build reports a shortfall; it does not fail on one. Coverage is still a course expectation and you are graded on it — the check is there to tell you where you stand, not to block you. So a green build does not mean you have met the minimum; you have to read the number.

Repositories

A repositories section lists the remote repositories Maven searches to resolve dependencies.

CoffeeMaker’s POM declares no repositories section, so Maven resolves everything from Maven Central, which is the default. A project only needs this section to pull from somewhere else — for example, Spring Milestones or Spring Snapshots for a pre-release Spring build:

<repositories>
	<repository>
		<id>spring-milestones</id>
		<name>Spring Milestones</name>
		<url>https://repo.spring.io/milestone</url>
	</repository>
</repositories>

Maven and GitHub Actions

Everything above runs on your machine. The same build also runs on GitHub every time you push to any branch — that is the continuous integration half of the tooling, and it is why the Maven lifecycle is worth understanding. Because it builds feature branches too, you get feedback before you open a pull request.

Your repository’s workflow runs two jobs:

  • Build backend — sets up JDK 21 and a MySQL service container, then runs ./mvnw -B verify in coffee_maker. Because verify comes after validate, compile, test, and package in the lifecycle, that single command runs Checkstyle, compiles, runs every JUnit test, measures coverage, and enforces the coverage minimum. The coverage numbers are published to the run’s summary page.
  • Lint frontend — sets up Node 22, runs npm ci and ESLint in coffee_maker_frontend, and uploads an HTML lint report.

Because the tests run against a MySQL container rather than anyone’s laptop, a build that passes on GitHub passes for everyone.

Three consequences worth internalizing:

  • ./mvnw verify passing locally is the best predictor of a green build. If you run only your tests in IntelliJ, you skip Checkstyle, packaging, and the coverage report — and the build server does not.
  • The build fails on broken code, not on quality shortfalls. A compile error or a failing test turns the run red. Coverage, Checkstyle, and ESLint all report — they land in the job log and the uploaded artifacts, never in a red X.
  • A green check does not mean clean code. Read the reports; a passing build is the floor, not the goal.

You can see the results under the Actions tab of your repository, and download the test results, the browsable JaCoCo coverage report, and the Checkstyle and ESLint reports from the run’s artifacts.

Resources