The concept of inheritence of from generic to specific, where the more specific overrides the values of its ancestors.
In general we see three levels, also described at Maven – Guide to Configuring Maven (apache.org) : it uses the terms user, installation, project
Just to give a hint: when you're working with multiple Maven installations on your system, they all share "user" configuration. Think of server credentials, you don't want to sepecifcy these per installation.
user | installation | project | commandline | |
---|---|---|---|---|
JVM | MAVEN_OPTS | .mvn/jvm.config | ||
Maven arguments | .mvn/maven.config | -$ / --$$ | ||
Settings | $user.home/.m2/settings.xml (--settings) | $maven.home/conf/settings.xml (--global-settings) | ||
Toolchains | $user.home/.m2/toolchains.xml (--toolchains) | $maven.home/conf/toolchains.xml (--global-toolchains) |
Looking at the settings and toolchains there's something odd with the name of the flags: --global-x is AFTER --x
This is an inconsistency as nothing should be more global than "global".
I see a couple of options how to solve this:
1. Switch the flags. This breaks compatibility in 2 ways: The flag overrides a different file and --settings will now override --global-settings
user | installation | project | commandline | |
---|---|---|---|---|
JVM | MAVEN_OPTS | .mvn/jvm.config | ||
Maven arguments | .mvn/maven.config | -$ / --$$ | ||
Settings | $user.home/.m2/settings.xml (--global-settings) | $maven.home/conf/settings.xml (--settings) | ||
Toolchains | $user.home/.m2/toolchains.xml (--global-toolchains) | $maven.home/conf/toolchains.xml (--toolchains) |
2. Preserve user, and fix everything around it. This means that IF you use --global-settings, it's the new base. It can be overridden with user settings, which can be overridden with installation settings (maybe we don't need --maven-settings).
global | user | installation | project | commandline | |
---|---|---|---|---|---|
JVM | MAVEN_OPTS | .mvn/jvm.config | |||
Maven arguments | .mvn/maven.config | -$ / --$$ | |||
Settings | (--global-settings) | $user.home/.m2/settings.xml (--settings) | $maven.home/conf/settings.xml (--maven-settings) | ||
Toolchains | (--global-toolchains) | $user.home/.m2/toolchains.xml (--toolchains) | $maven.home/conf/toolchains.xml (--maven-toolchains) |
3. Deprecate --global-settings and replace it with --maven-settings
user | installation | project | commandline | |
---|---|---|---|---|
JVM | MAVEN_OPTS | .mvn/jvm.config | ||
Maven arguments | .mvn/maven.config | -$ / --$$ | ||
Settings | $user.home/.m2/settings.xml (--settings) | $maven.home/conf/settings.xml (--maven-settings) | ||
Toolchains | $user.home/.m2/toolchains.xml (--toolchains) | $maven.home/conf/toolchains.xml (--maven-toolchains) |
4. Rename the flags and use the terms from the configuration-page
user | installation | project | commandline | |
---|---|---|---|---|
JVM | MAVEN_OPTS | .mvn/jvm.config | ||
Maven arguments | .mvn/maven.config | -$ / --$$ | ||
Settings | $user.home/.m2/settings.xml (--user-settings) | $maven.home/conf/settings.xml (--installation-settings) | ||
Toolchains | $user.home/.m2/toolchains.xml (--user-toolchains) | $maven.home/conf/toolchains.xml (--installation-toolchains) |