[MNG-6102] Introduce ${maven.conf} in m2.conf

Set maven.conf to default ${maven.home}/conf in ${maven.home}/bin/m2.conf
to have a canonical property pointing to global configuration files from
within Java code.

This also helps package maintainers to decouple the Maven installation
from a global configuration by solely modifying m2.conf instead of using
dirty hacks, if possible at all.
This commit is contained in:
Michael Osipov 2016-10-09 21:00:42 +02:00
parent 149cce7a86
commit be5caccaff
7 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,8 @@
main is org.apache.maven.cli.MavenCli from plexus.core
set maven.conf default ${maven.home}/conf
[plexus.core]
load ${maven.home}/conf/logging
load ${maven.conf}/logging
optionally ${maven.home}/lib/ext/*.jar
load ${maven.home}/lib/*.jar

View File

@ -32,7 +32,7 @@ under the License.
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.home}/conf/settings.xml.
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|

View File

@ -32,7 +32,7 @@ under the License.
| 2. Global Level. This toolchains.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.home}/conf/toolchains.xml.
| ${maven.conf}/toolchains.xml.
|
| NOTE: This location can be overridden with the CLI option:
|

View File

@ -66,7 +66,7 @@ public class DefaultMavenSettingsBuilder
throws IOException, XmlPullParserException
{
File globalSettingsFile =
getFile( "${maven.home}/conf/settings.xml", "maven.home",
getFile( "${maven.conf}/settings.xml", "maven.conf",
MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION );
SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();

View File

@ -142,7 +142,7 @@ public class MavenCli
public static final File DEFAULT_USER_TOOLCHAINS_FILE = new File( userMavenConfigurationHome, "toolchains.xml" );
public static final File DEFAULT_GLOBAL_TOOLCHAINS_FILE =
new File( System.getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/toolchains.xml" );
new File( System.getProperty( "maven.conf" ), "toolchains.xml" );
private static final String EXT_CLASS_PATH = "maven.ext.class.path";

View File

@ -59,8 +59,8 @@ public class SettingsXmlConfigurationProcessor
public static final File DEFAULT_USER_SETTINGS_FILE = new File( USER_MAVEN_CONFIGURATION_HOME, "settings.xml" );
public static final File DEFAULT_GLOBAL_SETTINGS_FILE = new File( System.getProperty( "maven.home", System
.getProperty( "user.dir", "" ) ), "conf/settings.xml" );
public static final File DEFAULT_GLOBAL_SETTINGS_FILE =
new File( System.getProperty( "maven.conf" ), "settings.xml" );
@Requirement
private Logger logger;

View File

@ -54,7 +54,7 @@ Maven Logging
Logging configuration loading is actually done by logging implementation, without any Maven extensions to support merging
Maven installation configuration with per-user configuration for example:
`${maven.home}/conf/logging` directory was added to core's classpath (see `${maven.home}/bin/m2.conf`). See your implementation
<<<$\{maven.conf}/logging>>> directory was added to core's classpath (see <<<$\{maven.home}/bin/m2.conf>>>). See your implementation
documentation for details on file names, formats, and so on.
During Maven initialization, Maven tweaks default root logging level to match CLI verbosity choice. Since such feature isn't available