mirror of https://github.com/apache/maven.git
[MNG-7556] Clean up notion between user properties and system properties
This closes #810
This commit is contained in:
parent
bc8c6be269
commit
9c60138915
|
@ -82,6 +82,7 @@ under the License.
|
||||||
-->
|
-->
|
||||||
</pluginGroups>
|
</pluginGroups>
|
||||||
|
|
||||||
|
<!-- TODO Since when can proxies be selected as depicted? -->
|
||||||
<!-- proxies
|
<!-- proxies
|
||||||
| This is a list of proxies which can be used on this machine to connect to the network.
|
| This is a list of proxies which can be used on this machine to connect to the network.
|
||||||
| Unless otherwise specified (by system property or command-line switch), the first proxy
|
| Unless otherwise specified (by system property or command-line switch), the first proxy
|
||||||
|
@ -176,7 +177,7 @@ under the License.
|
||||||
|
|
|
|
||||||
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
|
||||||
| section of this document (settings.xml) - will be discussed later. Another way essentially
|
| section of this document (settings.xml) - will be discussed later. Another way essentially
|
||||||
| relies on the detection of a system property, either matching a particular value for the property,
|
| relies on the detection of a property, either matching a particular value for the property,
|
||||||
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
|
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
|
||||||
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
|
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
|
||||||
| Finally, the list of active profiles can be specified directly from the command line.
|
| Finally, the list of active profiles can be specified directly from the command line.
|
||||||
|
@ -218,9 +219,9 @@ under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
|
| Here is another profile, activated by the property 'target-env' with a value of 'dev', which
|
||||||
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
|
| provides a specific path to the Tomcat instance. To use this, your plugin configuration might
|
||||||
| might hypothetically look like:
|
| hypothetically look like:
|
||||||
|
|
|
|
||||||
| ...
|
| ...
|
||||||
| <plugin>
|
| <plugin>
|
||||||
|
|
|
@ -2672,7 +2672,7 @@
|
||||||
<field>
|
<field>
|
||||||
<name>property</name>
|
<name>property</name>
|
||||||
<version>4.0.0+</version>
|
<version>4.0.0+</version>
|
||||||
<description>Specifies that this profile will be activated when this system property is
|
<description>Specifies that this profile will be activated when this property is
|
||||||
specified.</description>
|
specified.</description>
|
||||||
<association>
|
<association>
|
||||||
<type>ActivationProperty</type>
|
<type>ActivationProperty</type>
|
||||||
|
@ -2774,7 +2774,7 @@
|
||||||
activated. On the other hand, {@code exists} will test for the existence of the file and if it is
|
activated. On the other hand, {@code exists} will test for the existence of the file and if it is
|
||||||
there, the profile will be activated.<br>
|
there, the profile will be activated.<br>
|
||||||
Variable interpolation for these file specifications is limited to {@code ${basedir}},
|
Variable interpolation for these file specifications is limited to {@code ${basedir}},
|
||||||
System properties and request properties.]]></description>
|
system properties and user properties.]]></description>
|
||||||
<fields>
|
<fields>
|
||||||
<field>
|
<field>
|
||||||
<name>missing</name>
|
<name>missing</name>
|
||||||
|
|
|
@ -789,7 +789,7 @@
|
||||||
<version>1.0.0+</version>
|
<version>1.0.0+</version>
|
||||||
<description>
|
<description>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
Specifies that this profile will be activated when this System property is specified.
|
Specifies that this profile will be activated when this property is specified.
|
||||||
]]>
|
]]>
|
||||||
</description>
|
</description>
|
||||||
<association>
|
<association>
|
||||||
|
|
|
@ -162,7 +162,7 @@ under the License.
|
||||||
<name>property</name>
|
<name>property</name>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
Specifies that this profile will be activated when this System property is specified.
|
Specifies that this profile will be activated when this property is specified.
|
||||||
]]></description>
|
]]></description>
|
||||||
<association>
|
<association>
|
||||||
<type>ActivationProperty</type>
|
<type>ActivationProperty</type>
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A core extension to monitor Maven's execution. Typically, such an extension gets loaded into Maven by specifying the
|
* A core extension to monitor Maven's execution. Typically, such an extension gets loaded into Maven by specifying the
|
||||||
* system property {@code maven.ext.class.path} on the command line. As soon as dependency injection is set up, Maven
|
* property {@code maven.ext.class.path} on the command line. As soon as dependency injection is set up, Maven
|
||||||
* looks up all implementers of this interface and calls their {@link #init(Context)} method. <em>Note:</em>
|
* looks up all implementers of this interface and calls their {@link #init(Context)} method. <em>Note:</em>
|
||||||
* Implementors are strongly advised to inherit from {@link AbstractEventSpy} instead of directly implementing this
|
* Implementors are strongly advised to inherit from {@link AbstractEventSpy} instead of directly implementing this
|
||||||
* interface.
|
* interface.
|
||||||
|
|
|
@ -150,6 +150,7 @@ public class DefaultRepositorySystemSessionFactory
|
||||||
configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
|
configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
|
||||||
configProps.put( ConfigurationProperties.INTERACTIVE, request.isInteractiveMode() );
|
configProps.put( ConfigurationProperties.INTERACTIVE, request.isInteractiveMode() );
|
||||||
configProps.put( "maven.startTime", request.getStartTime() );
|
configProps.put( "maven.startTime", request.getStartTime() );
|
||||||
|
// Resolver's ConfigUtils solely rely on config properties, that is why we need to add both here as well.
|
||||||
configProps.putAll( request.getSystemProperties() );
|
configProps.putAll( request.getSystemProperties() );
|
||||||
configProps.putAll( request.getUserProperties() );
|
configProps.putAll( request.getUserProperties() );
|
||||||
|
|
||||||
|
@ -288,14 +289,14 @@ public class DefaultRepositorySystemSessionFactory
|
||||||
+ MAVEN_RESOLVER_TRANSPORT_NATIVE + ", " + MAVEN_RESOLVER_TRANSPORT_AUTO );
|
+ MAVEN_RESOLVER_TRANSPORT_NATIVE + ", " + MAVEN_RESOLVER_TRANSPORT_AUTO );
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setTransferListener( request.getTransferListener() );
|
|
||||||
|
|
||||||
session.setRepositoryListener( eventSpyDispatcher.chainListener( new LoggingRepositoryListener( logger ) ) );
|
|
||||||
|
|
||||||
session.setUserProperties( request.getUserProperties() );
|
session.setUserProperties( request.getUserProperties() );
|
||||||
session.setSystemProperties( request.getSystemProperties() );
|
session.setSystemProperties( request.getSystemProperties() );
|
||||||
session.setConfigProperties( configProps );
|
session.setConfigProperties( configProps );
|
||||||
|
|
||||||
|
session.setTransferListener( request.getTransferListener() );
|
||||||
|
|
||||||
|
session.setRepositoryListener( eventSpyDispatcher.chainListener( new LoggingRepositoryListener( logger ) ) );
|
||||||
|
|
||||||
mavenRepositorySystem.injectMirror( request.getRemoteRepositories(), request.getMirrors() );
|
mavenRepositorySystem.injectMirror( request.getRemoteRepositories(), request.getMirrors() );
|
||||||
mavenRepositorySystem.injectProxy( session, request.getRemoteRepositories() );
|
mavenRepositorySystem.injectProxy( session, request.getRemoteRepositories() );
|
||||||
mavenRepositorySystem.injectAuthentication( session, request.getRemoteRepositories() );
|
mavenRepositorySystem.injectAuthentication( session, request.getRemoteRepositories() );
|
||||||
|
|
|
@ -61,8 +61,9 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
||||||
* <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
|
* <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
|
||||||
* getPluginDescriptor()}</td></tr>
|
* getPluginDescriptor()}</td></tr>
|
||||||
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
||||||
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>user properties</td></tr>
|
||||||
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
|
||||||
|
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
* <i>Notice:</i> <code>reports</code> was supported in Maven 2.x but was removed in Maven 3
|
* <i>Notice:</i> <code>reports</code> was supported in Maven 2.x but was removed in Maven 3
|
||||||
*
|
*
|
||||||
|
@ -368,7 +369,7 @@ public class PluginParameterExpressionEvaluator
|
||||||
/*
|
/*
|
||||||
* MNG-4312: We neither have reserved all of the above magic expressions nor is their set fixed/well-known (it
|
* MNG-4312: We neither have reserved all of the above magic expressions nor is their set fixed/well-known (it
|
||||||
* gets occasionally extended by newer Maven versions). This imposes the risk for existing plugins to
|
* gets occasionally extended by newer Maven versions). This imposes the risk for existing plugins to
|
||||||
* unintentionally use such a magic expression for an ordinary system property. So here we check whether we
|
* unintentionally use such a magic expression for an ordinary property. So here we check whether we
|
||||||
* ended up with a magic value that is not compatible with the type of the configured mojo parameter (a string
|
* ended up with a magic value that is not compatible with the type of the configured mojo parameter (a string
|
||||||
* could still be converted by the configurator so we leave those alone). If so, back off to evaluating the
|
* could still be converted by the configurator so we leave those alone). If so, back off to evaluating the
|
||||||
* expression from properties only.
|
* expression from properties only.
|
||||||
|
@ -384,10 +385,10 @@ public class PluginParameterExpressionEvaluator
|
||||||
|
|
||||||
if ( properties != null )
|
if ( properties != null )
|
||||||
{
|
{
|
||||||
// We will attempt to get nab a system property as a way to specify a
|
// We will attempt to get nab a property as a way to specify a parameter
|
||||||
// parameter to a plugins. My particular case here is allowing the surefire
|
// to a plugin. My particular case here is allowing the surefire plugin
|
||||||
// plugin to run a single test so I want to specify that class on the cli
|
// to run a single test so I want to specify that class on the cli as
|
||||||
// as a parameter.
|
// a parameter.
|
||||||
|
|
||||||
value = properties.getProperty( expression );
|
value = properties.getProperty( expression );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
||||||
* <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
|
* <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
|
||||||
* getPluginDescriptor()}</td></tr>
|
* getPluginDescriptor()}</td></tr>
|
||||||
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
|
||||||
|
* <tr><td><code>*</code></td> <td></td> <td>user properties</td></tr>
|
||||||
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
|
||||||
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
|
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
|
@ -376,7 +377,7 @@ public class PluginParameterExpressionEvaluatorV4
|
||||||
/*
|
/*
|
||||||
* MNG-4312: We neither have reserved all of the above magic expressions nor is their set fixed/well-known (it
|
* MNG-4312: We neither have reserved all of the above magic expressions nor is their set fixed/well-known (it
|
||||||
* gets occasionally extended by newer Maven versions). This imposes the risk for existing plugins to
|
* gets occasionally extended by newer Maven versions). This imposes the risk for existing plugins to
|
||||||
* unintentionally use such a magic expression for an ordinary system property. So here we check whether we
|
* unintentionally use such a magic expression for an ordinary property. So here we check whether we
|
||||||
* ended up with a magic value that is not compatible with the type of the configured mojo parameter (a string
|
* ended up with a magic value that is not compatible with the type of the configured mojo parameter (a string
|
||||||
* could still be converted by the configurator so we leave those alone). If so, back off to evaluating the
|
* could still be converted by the configurator so we leave those alone). If so, back off to evaluating the
|
||||||
* expression from properties only.
|
* expression from properties only.
|
||||||
|
@ -392,10 +393,10 @@ public class PluginParameterExpressionEvaluatorV4
|
||||||
|
|
||||||
if ( properties != null )
|
if ( properties != null )
|
||||||
{
|
{
|
||||||
// We will attempt to get nab a system property as a way to specify a
|
// We will attempt to get nab a property as a way to specify a parameter
|
||||||
// parameter to a plugins. My particular case here is allowing the surefire
|
// to a plugin. My particular case here is allowing the surefire plugin
|
||||||
// plugin to run a single test so I want to specify that class on the cli
|
// to run a single test so I want to specify that class on the cli as
|
||||||
// as a parameter.
|
// a parameter.
|
||||||
|
|
||||||
value = properties.getProperty( expression );
|
value = properties.getProperty( expression );
|
||||||
}
|
}
|
||||||
|
|
|
@ -576,8 +576,17 @@ public class MavenMetadataSource
|
||||||
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
|
||||||
configuration.setProcessPlugins( false );
|
configuration.setProcessPlugins( false );
|
||||||
configuration.setRepositoryMerging( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT );
|
configuration.setRepositoryMerging( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT );
|
||||||
configuration.setSystemProperties( getSystemProperties() );
|
MavenSession session = legacySupport.getSession();
|
||||||
configuration.setUserProperties( new Properties() );
|
if ( session != null )
|
||||||
|
{
|
||||||
|
configuration.setSystemProperties( session.getSystemProperties() );
|
||||||
|
configuration.setUserProperties( session.getUserProperties() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configuration.setSystemProperties( getSystemProperties() );
|
||||||
|
configuration.setUserProperties( new Properties() );
|
||||||
|
}
|
||||||
configuration.setRepositorySession( legacySupport.getRepositorySession() );
|
configuration.setRepositorySession( legacySupport.getRepositorySession() );
|
||||||
|
|
||||||
project = projectBuilder.build( pomArtifact, configuration ).getProject();
|
project = projectBuilder.build( pomArtifact, configuration ).getProject();
|
||||||
|
|
|
@ -30,7 +30,7 @@ Abstract
|
||||||
|
|
||||||
In order to really achieve this, we need mojo configurations (which are
|
In order to really achieve this, we need mojo configurations (which are
|
||||||
provided both in terms of static expressions that are just looked up, and
|
provided both in terms of static expressions that are just looked up, and
|
||||||
in terms of user-provided configuration from system properties or the POM).
|
in terms of user-provided configuration from properties or the POM).
|
||||||
If these mojos are to be first-class components, the configuration from these
|
If these mojos are to be first-class components, the configuration from these
|
||||||
various sources must be consolidated and injected using the container.
|
various sources must be consolidated and injected using the container.
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,13 @@ public class CLIManager
|
||||||
|
|
||||||
public static final char BATCH_MODE = 'B';
|
public static final char BATCH_MODE = 'B';
|
||||||
|
|
||||||
public static final char SET_SYSTEM_PROPERTY = 'D';
|
public static final char SET_USER_PROPERTY = 'D';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link #SET_USER_PROPERTY}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final char SET_SYSTEM_PROPERTY = SET_USER_PROPERTY;
|
||||||
|
|
||||||
public static final char OFFLINE = 'o';
|
public static final char OFFLINE = 'o';
|
||||||
|
|
||||||
|
@ -123,7 +129,7 @@ public class CLIManager
|
||||||
options = new Options();
|
options = new Options();
|
||||||
options.addOption( Option.builder( Character.toString( HELP ) ).longOpt( "help" ).desc( "Display help information" ).build() );
|
options.addOption( Option.builder( Character.toString( HELP ) ).longOpt( "help" ).desc( "Display help information" ).build() );
|
||||||
options.addOption( Option.builder( Character.toString( ALTERNATE_POM_FILE ) ).longOpt( "file" ).hasArg().desc( "Force the use of an alternate POM file (or directory with pom.xml)" ).build() );
|
options.addOption( Option.builder( Character.toString( ALTERNATE_POM_FILE ) ).longOpt( "file" ).hasArg().desc( "Force the use of an alternate POM file (or directory with pom.xml)" ).build() );
|
||||||
options.addOption( Option.builder( Character.toString( SET_SYSTEM_PROPERTY ) ).numberOfArgs( 2 ).valueSeparator( '=' ).desc( "Define a system property" ).build() );
|
options.addOption( Option.builder( Character.toString( SET_USER_PROPERTY ) ).numberOfArgs( 2 ).valueSeparator( '=' ).desc( "Define a user property" ).build() );
|
||||||
options.addOption( Option.builder( Character.toString( OFFLINE ) ).longOpt( "offline" ).desc( "Work offline" ).build() );
|
options.addOption( Option.builder( Character.toString( OFFLINE ) ).longOpt( "offline" ).desc( "Work offline" ).build() );
|
||||||
options.addOption( Option.builder( Character.toString( VERSION ) ).longOpt( "version" ).desc( "Display version information" ).build() );
|
options.addOption( Option.builder( Character.toString( VERSION ) ).longOpt( "version" ).desc( "Display version information" ).build() );
|
||||||
options.addOption( Option.builder( Character.toString( QUIET ) ).longOpt( "quiet" ).desc( "Quiet output - only show errors" ).build() );
|
options.addOption( Option.builder( Character.toString( QUIET ) ).longOpt( "quiet" ).desc( "Quiet output - only show errors" ).build() );
|
||||||
|
|
|
@ -477,7 +477,7 @@ public class MavenCli
|
||||||
List<Option> setPropertyOptions = new ArrayList<>();
|
List<Option> setPropertyOptions = new ArrayList<>();
|
||||||
for ( Option opt : mavenArgs.getOptions() )
|
for ( Option opt : mavenArgs.getOptions() )
|
||||||
{
|
{
|
||||||
if ( String.valueOf( CLIManager.SET_SYSTEM_PROPERTY ).equals( opt.getOpt() ) )
|
if ( String.valueOf( CLIManager.SET_USER_PROPERTY ).equals( opt.getOpt() ) )
|
||||||
{
|
{
|
||||||
setPropertyOptions.add( opt );
|
setPropertyOptions.add( opt );
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ public class MavenCli
|
||||||
{
|
{
|
||||||
commandLineBuilder.addOption( opt );
|
commandLineBuilder.addOption( opt );
|
||||||
}
|
}
|
||||||
// finally add the CLI system properties
|
// finally add the CLI user properties
|
||||||
for ( Option opt : setPropertyOptions )
|
for ( Option opt : setPropertyOptions )
|
||||||
{
|
{
|
||||||
commandLineBuilder.addOption( opt );
|
commandLineBuilder.addOption( opt );
|
||||||
|
@ -1745,7 +1745,7 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// System properties handling
|
// Properties handling
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
static void populateProperties( CommandLine commandLine, Properties systemProperties, Properties userProperties )
|
static void populateProperties( CommandLine commandLine, Properties systemProperties, Properties userProperties )
|
||||||
|
@ -1759,7 +1759,7 @@ public class MavenCli
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
final Properties userSpecifiedProperties = commandLine.getOptionProperties(
|
final Properties userSpecifiedProperties = commandLine.getOptionProperties(
|
||||||
String.valueOf( CLIManager.SET_SYSTEM_PROPERTY ) );
|
String.valueOf( CLIManager.SET_USER_PROPERTY ) );
|
||||||
userSpecifiedProperties.forEach(
|
userSpecifiedProperties.forEach(
|
||||||
( prop, value ) -> setCliProperty( (String) prop, (String) value, userProperties )
|
( prop, value ) -> setCliProperty( (String) prop, (String) value, userProperties )
|
||||||
);
|
);
|
||||||
|
|
|
@ -338,9 +338,9 @@ public class MavenCliTest
|
||||||
String revision = System.getProperty( "revision" );
|
String revision = System.getProperty( "revision" );
|
||||||
assertEquals( "8.2.0", revision );
|
assertEquals( "8.2.0", revision );
|
||||||
|
|
||||||
assertEquals( "bar ", request.getSystemProperties().getProperty( "foo" ) );
|
assertEquals( "bar ", request.getUserProperties().getProperty( "foo" ) );
|
||||||
assertEquals( "bar two", request.getSystemProperties().getProperty( "foo2" ) );
|
assertEquals( "bar two", request.getUserProperties().getProperty( "foo2" ) );
|
||||||
assertEquals( "Apache Maven", request.getSystemProperties().getProperty( "label" ) );
|
assertEquals( "Apache Maven", request.getUserProperties().getProperty( "label" ) );
|
||||||
|
|
||||||
assertEquals( "-Dpom.xml", request.getCommandLine().getOptionValue( CLIManager.ALTERNATE_POM_FILE ) );
|
assertEquals( "-Dpom.xml", request.getCommandLine().getOptionValue( CLIManager.ALTERNATE_POM_FILE ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setModelProcessor(ModelProcessor)
|
* @see DefaultModelBuilderFactory#setModelProcessor(ModelProcessor)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
|
public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
|
||||||
|
@ -187,7 +187,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setModelProcessor(ModelProcessor)
|
* @see DefaultModelBuilderFactory#setModelProcessor(ModelProcessor)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelValidator( ModelValidator modelValidator )
|
public DefaultModelBuilder setModelValidator( ModelValidator modelValidator )
|
||||||
|
@ -201,7 +201,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setModelNormalizer(ModelNormalizer)
|
* @see DefaultModelBuilderFactory#setModelNormalizer(ModelNormalizer)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
|
public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
|
||||||
|
@ -215,7 +215,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setModelInterpolator(ModelInterpolator)
|
* @see DefaultModelBuilderFactory#setModelInterpolator(ModelInterpolator)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
|
public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
|
||||||
|
@ -243,7 +243,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setModelUrlNormalizer(ModelUrlNormalizer)
|
* @see DefaultModelBuilderFactory#setModelUrlNormalizer(ModelUrlNormalizer)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
|
||||||
|
@ -257,7 +257,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setSuperPomProvider(SuperPomProvider)
|
* @see DefaultModelBuilderFactory#setSuperPomProvider(SuperPomProvider)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
|
public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
|
||||||
|
@ -271,7 +271,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setInheritanceAssembler(InheritanceAssembler)
|
* @see DefaultModelBuilderFactory#setInheritanceAssembler(InheritanceAssembler)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
|
||||||
|
@ -299,7 +299,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setProfileInjector(ProfileInjector)
|
* @see DefaultModelBuilderFactory#setProfileInjector(ProfileInjector)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
|
public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
|
||||||
|
@ -313,7 +313,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setPluginManagementInjector(PluginManagementInjector)
|
* @see DefaultModelBuilderFactory#setPluginManagementInjector(PluginManagementInjector)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
|
||||||
|
@ -327,7 +327,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setDependencyManagementInjector(DependencyManagementInjector)
|
* @see DefaultModelBuilderFactory#setDependencyManagementInjector(DependencyManagementInjector)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setDependencyManagementInjector(
|
public DefaultModelBuilder setDependencyManagementInjector(
|
||||||
|
@ -342,7 +342,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setDependencyManagementImporter(DependencyManagementImporter)
|
* @see DefaultModelBuilderFactory#setDependencyManagementImporter(DependencyManagementImporter)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setDependencyManagementImporter(
|
public DefaultModelBuilder setDependencyManagementImporter(
|
||||||
|
@ -357,7 +357,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setLifecycleBindingsInjector(LifecycleBindingsInjector)
|
* @see DefaultModelBuilderFactory#setLifecycleBindingsInjector(LifecycleBindingsInjector)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
|
public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
|
||||||
|
@ -371,7 +371,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setPluginConfigurationExpander(PluginConfigurationExpander)
|
* @see DefaultModelBuilderFactory#setPluginConfigurationExpander(PluginConfigurationExpander)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
|
public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
|
||||||
|
@ -385,7 +385,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setReportConfigurationExpander(ReportConfigurationExpander)
|
* @see DefaultModelBuilderFactory#setReportConfigurationExpander(ReportConfigurationExpander)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setReportConfigurationExpander( ReportConfigurationExpander reportConfigurationExpander )
|
public DefaultModelBuilder setReportConfigurationExpander( ReportConfigurationExpander reportConfigurationExpander )
|
||||||
|
@ -399,7 +399,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Maven 4
|
* @deprecated since Maven 4
|
||||||
* @see DefaultModelBuilderFactory#setReportingConverter(ReportingConverter)
|
* @see DefaultModelBuilderFactory#setReportingConverter(ReportingConverter)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
|
public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
|
||||||
|
@ -973,7 +973,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// must implement TransformContext, but should use request to access system properties/modelcache
|
// must implement TransformContext, but should use request to access properties/model cache
|
||||||
org.apache.maven.api.model.Model transformedFileModel = modelProcessor.read( pomFile,
|
org.apache.maven.api.model.Model transformedFileModel = modelProcessor.read( pomFile,
|
||||||
Collections.singletonMap( ModelReader.TRANSFORMER_CONTEXT, context ) );
|
Collections.singletonMap( ModelReader.TRANSFORMER_CONTEXT, context ) );
|
||||||
|
|
||||||
|
@ -1352,7 +1352,7 @@ public class DefaultModelBuilder
|
||||||
|
|
||||||
// Validate versions aren't inherited when using parent ranges the same way as when read externally.
|
// Validate versions aren't inherited when using parent ranges the same way as when read externally.
|
||||||
String rawChildModelVersion = childModel.getVersion();
|
String rawChildModelVersion = childModel.getVersion();
|
||||||
|
|
||||||
if ( rawChildModelVersion == null )
|
if ( rawChildModelVersion == null )
|
||||||
{
|
{
|
||||||
// Message below is checked for in the MNG-2199 core IT.
|
// Message below is checked for in the MNG-2199 core IT.
|
||||||
|
@ -1483,7 +1483,7 @@ public class DefaultModelBuilder
|
||||||
if ( !parent.getVersion().equals( version ) )
|
if ( !parent.getVersion().equals( version ) )
|
||||||
{
|
{
|
||||||
String rawChildModelVersion = childModel.getVersion();
|
String rawChildModelVersion = childModel.getVersion();
|
||||||
|
|
||||||
if ( rawChildModelVersion == null )
|
if ( rawChildModelVersion == null )
|
||||||
{
|
{
|
||||||
// Message below is checked for in the MNG-2199 core IT.
|
// Message below is checked for in the MNG-2199 core IT.
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class DefaultModelVersionProcessor
|
||||||
|| SHA1_PROPERTY.equals( property );
|
|| SHA1_PROPERTY.equals( property );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO This class MUST test for user properties and THEN for system properties
|
||||||
@Override
|
@Override
|
||||||
public void overwriteModelProperties( Properties modelProperties, ModelBuildingRequest request )
|
public void overwriteModelProperties( Properties modelProperties, ModelBuildingRequest request )
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
* Determines profile activation based on the existence/absence of some file.
|
* Determines profile activation based on the existence/absence of some file.
|
||||||
* File name interpolation support is limited to <code>${basedir}</code> (since Maven 3,
|
* File name interpolation support is limited to <code>${basedir}</code> (since Maven 3,
|
||||||
* see <a href="https://issues.apache.org/jira/browse/MNG-2363">MNG-2363</a>),
|
* see <a href="https://issues.apache.org/jira/browse/MNG-2363">MNG-2363</a>),
|
||||||
* System properties and request properties.
|
* system properties and user properties.
|
||||||
* <code>${project.basedir}</code> is intentionally not supported as this form would suggest that other
|
* <code>${project.basedir}</code> is intentionally not supported as this form would suggest that other
|
||||||
* <code>${project.*}</code> expressions can be used, which is however beyond the design.
|
* <code>${project.*}</code> expressions can be used, which is however beyond the design.
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,7 +41,7 @@ Maven Model Builder
|
||||||
|
|
||||||
** profile activation: see {{{./apidocs/org/apache/maven/model/profile/activation/package-summary.html}available activators}}.
|
** profile activation: see {{{./apidocs/org/apache/maven/model/profile/activation/package-summary.html}available activators}}.
|
||||||
Notice that model interpolation hasn't happened yet, then interpolation for file-based activation is limited to
|
Notice that model interpolation hasn't happened yet, then interpolation for file-based activation is limited to
|
||||||
<<<$\{basedir}>>> (since Maven 3), System properties and request properties
|
<<<$\{basedir}>>> (since Maven 3), system properties and user properties
|
||||||
|
|
||||||
** file model validation: <<<ModelValidator>>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}),
|
** file model validation: <<<ModelValidator>>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}),
|
||||||
with its <<<DefaultModelValidator>>> implementation
|
with its <<<DefaultModelValidator>>> implementation
|
||||||
|
@ -162,7 +162,7 @@ Maven Model Builder
|
||||||
|
|
||||||
Notice that model interpolation happens <after> profile activation, then profile activation doesn't benefit from every values:
|
Notice that model interpolation happens <after> profile activation, then profile activation doesn't benefit from every values:
|
||||||
interpolation for file-based activation is limited to <<<$\{basedir}>>> (which was introduced in Maven 3 and is not deprecated
|
interpolation for file-based activation is limited to <<<$\{basedir}>>> (which was introduced in Maven 3 and is not deprecated
|
||||||
in this context), System properties and request properties.
|
in this context), system properties and user properties.
|
||||||
|
|
||||||
Values are evaluated in sequence from different syntaxes:
|
Values are evaluated in sequence from different syntaxes:
|
||||||
|
|
||||||
|
@ -198,9 +198,11 @@ Maven Model Builder
|
||||||
*----+------+------+
|
*----+------+------+
|
||||||
| <<<maven.repo.local>>> | The repository on the local machine Maven shall use to store installed and downloaded artifacts (POMs, JARs, etc). | <<<$\{user.home\}/.m2/repository>>> |
|
| <<<maven.repo.local>>> | The repository on the local machine Maven shall use to store installed and downloaded artifacts (POMs, JARs, etc). | <<<$\{user.home\}/.m2/repository>>> |
|
||||||
*----+------+------+
|
*----+------+------+
|
||||||
| <<<*>>> | Java system properties (see {{{http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties()}JDK reference}}) | <<<$\{user.home\}>>>\
|
| <<<*>>> | Java system properties (see {{{https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#getProperties()}JDK reference}}) | <<<$\{user.home\}>>>\
|
||||||
| | <<<$\{java.home\}>>> |
|
| | <<<$\{java.home\}>>> |
|
||||||
*----+------+------+
|
*----+------+------+
|
||||||
|
| <<<*>>> | User properties | <<<$\{foo\}>>> |
|
||||||
|
*----+------+------+
|
||||||
| <<<env.*>>>\
|
| <<<env.*>>>\
|
||||||
<<<*>>> | environment variables | <<<$\{env.PATH\}>>> |
|
<<<*>>> | environment variables | <<<$\{env.PATH\}>>> |
|
||||||
*----+------+------+
|
*----+------+------+
|
||||||
|
|
|
@ -455,7 +455,7 @@ under the License.
|
||||||
<required>true</required>
|
<required>true</required>
|
||||||
<version>1.0.0+</version>
|
<version>1.0.0+</version>
|
||||||
<type>String</type>
|
<type>String</type>
|
||||||
<description>Parameter expression, to let user override default value with a system property, pom property or settings property.</description>
|
<description>Parameter expression, to let user override default value with a user property, system property or project property.</description>
|
||||||
</field>
|
</field>
|
||||||
<field xml.attribute="true" xml.tagName="implementation">
|
<field xml.attribute="true" xml.tagName="implementation">
|
||||||
<name>implementation</name>
|
<name>implementation</name>
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.maven.repository.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||||
import org.eclipse.aether.artifact.DefaultArtifactType;
|
import org.eclipse.aether.artifact.DefaultArtifactType;
|
||||||
import org.eclipse.aether.collection.DependencyGraphTransformer;
|
import org.eclipse.aether.collection.DependencyGraphTransformer;
|
||||||
|
@ -104,19 +102,6 @@ public final class MavenRepositorySystemUtils
|
||||||
|
|
||||||
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
|
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
|
||||||
|
|
||||||
final Properties systemProperties = new Properties();
|
|
||||||
|
|
||||||
// MNG-5670 guard against ConcurrentModificationException
|
|
||||||
// MNG-6053 guard against key without value
|
|
||||||
Properties sysProp = System.getProperties();
|
|
||||||
synchronized ( sysProp )
|
|
||||||
{
|
|
||||||
systemProperties.putAll( sysProp );
|
|
||||||
}
|
|
||||||
|
|
||||||
session.setSystemProperties( systemProperties );
|
|
||||||
session.setConfigProperties( systemProperties );
|
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue