The version, the settings and offline mode
Maven is a Java program, and the first thing to know about the one in this container is that it cannot download anything. That is a property of this machine, not of Maven: the settings file switches offline mode on, and every artifact the build needs must already be in the local repository under ~/.m2/repository. This article reads the version, the settings file and the repository, so that a failure naming a plugin or a dependency later on makes sense at once.
The version
mvn -v prints the version of Maven, where it is installed, the Java it runs on and the machine it runs on:
mvn -v
Apache Maven 3.9.16 (2bdd9fddda4b155ebf8000e807eb73fd829a51d5)
Maven home: /usr/share/java/maven-3
Java version: 21.0.13.1, vendor: Alpine, runtime: /usr/lib/jvm/java-21-openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.8.0-149-generic", arch: "amd64", family: "unix"
The first line is the version this course was written with: 3.9.16, and the long hash in brackets is the commit it was built from. The second line is the installation directory. The third is the JDK Maven runs on, 21.0.13.1 of the Alpine build, which is the same JDK that compiles the projects; Maven itself needs Java 8 or newer, and a project can target a newer release than the JDK that runs Maven.
The last line describes the machine: the kernel version, the architecture and the family. It changes from one machine to another and it says nothing about the project, so the pages of this course never build a decision on it. The locale and the encoding are the ones a build reads file names with; en_US and UTF-8 here.
The settings file
Maven reads two configuration files: the installation one under $MAVEN_HOME/conf/settings.xml, which nobody should edit, and the user one at ~/.m2/settings.xml, which belongs to the person running the build. This image has the second one, and it is one line:
~/.m2/settings.xml
<settings><offline>true</offline></settings>
The file is not pretty-printed, because nothing reads it by eye except this page. An ordinary settings file holds mirrors, servers, proxies and profiles; this one holds the switch that makes Maven refuse the network, and it is the reason that no command in this course needs -o. The settings article shows a full file with a mirror and a repository, and why none of it is applied here.
What offline means
In offline mode Maven resolves every artifact from the local repository only. A plugin, a dependency, a parent pom and a BOM are looked up under ~/.m2/repository by their coordinates; when one is missing, the build stops before it compiles a single file and says which artifact it wanted and which repository it could not reach. Nothing is downloaded, so nothing waits for a network that is not there.
The repository of this image was filled when the image was built and holds what the course needs: the plugins of the default lifecycle, the dependency, help and archetype plugins, and one test library, JUnit Jupiter. It is about 126 MB. Which versions are inside is not a guess: every build log prints the ones it used, and the lifecycle article reads them.
A goal that is not there
The difference between offline and broken is visible with a goal whose plugin is not in the repository at all. enforcer:enforce is a common plugin for rules about versions; this image does not have it, so the version of the plugin cannot even be resolved:
mvn -B enforcer:enforce
[INFO] Scanning for projects...
[WARNING] Plugin not found in any plugin repository: org.apache.maven.plugins:maven-enforcer-plugin
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.495 s
[INFO] Finished at: 2026-11-22T08:22:35Z
[INFO] ------------------------------------------------------------------------
[ERROR] Error resolving version for plugin 'org.apache.maven.plugins:maven-enforcer-plugin' from the repositories [local (<HOME>/.m2/repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
Read the first two lines together: the plugin prefix enforcer was found in the metadata of the plugin groups, so Maven knows the artifact name, and the artifact itself is in no repository it can see. The failure is a PluginVersionResolutionException, which is the same family as the failure the IntelliJ article shows for a version that is named but missing.
A page that names a plugin this image does not have says so and shows one real failure; the others are listed as not run. That is the rule of the whole course: a command either has a real output under it or a note that says it was not run here.
The local repository
The local repository is a plain folder tree, and its top level is the group ids of everything Maven has ever resolved, one folder per group:
ls -1 ~/.m2/repository
aopalliance
archetype-catalog-central.xml
archetype-catalog-central.xml.sha1
avalon-framework
com
commons-beanutils
commons-chain
commons-codec
commons-collections
commons-digester
commons-io
commons-lang
commons-logging
dom4j
io
javax
log4j
logkit
net
org
oro
resolver-status.properties
seed
xml-apis
xmlpull
The two files at the top are a catalog of archetypes, which the next article uses, and a bookkeeping file of the resolver. The rest is the layout the local repository article reads in full: group id, artifact id, version, and inside the version folder the jar, the pom and their checksums.
Where to go next
With the version and the offline rule known, the next article generates a whole project from an archetype and builds it, offline, with one command. The lifecycle article comes back to the log lines this page only named.
Article author: Arthur Isaev