mirror of https://github.com/apache/maven.git
[MNG-6656] Features must use userProperties instead of systemProperties
This commit is contained in:
parent
1328d6ef7f
commit
a2f81065ff
|
@ -249,7 +249,7 @@ public class DefaultRepositorySystemSessionFactory
|
|||
mavenRepositorySystem.injectProxy( session, request.getPluginArtifactRepositories() );
|
||||
mavenRepositorySystem.injectAuthentication( session, request.getPluginArtifactRepositories() );
|
||||
|
||||
if ( Features.buildConsumer().isActive() )
|
||||
if ( Features.buildConsumer( request.getUserProperties() ).isActive() )
|
||||
{
|
||||
session.setFileTransformerManager( a -> getTransformersForArtifact( a, session.getData() ) );
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.lifecycle.internal.builder;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -109,7 +110,8 @@ public class BuilderCommon
|
|||
// With Maven 4's build/consumer the POM will always rewrite during distribution.
|
||||
// The maven-gpg-plugin uses the original POM, causing an invalid signature.
|
||||
// Fail as long as there's no solution available yet
|
||||
if ( Features.buildConsumer().isActive() )
|
||||
Properties userProperties = session.getUserProperties();
|
||||
if ( Features.buildConsumer( userProperties ).isActive() )
|
||||
{
|
||||
Optional<MojoExecution> gpgMojo = executionPlan.getMojoExecutions().stream()
|
||||
.filter( m -> "maven-gpg-plugin".equals( m.getArtifactId() )
|
||||
|
@ -120,7 +122,7 @@ public class BuilderCommon
|
|||
{
|
||||
throw new LifecycleExecutionException( "The maven-gpg-plugin is not supported by Maven 4."
|
||||
+ " Verify if there is a compatible signing solution,"
|
||||
+ " add -D" + Features.buildConsumer().propertyName() + "=false"
|
||||
+ " add -D" + Features.buildConsumer( userProperties ).propertyName() + "=false"
|
||||
+ " or use Maven 3." );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ public class DefaultProjectBuilder
|
|||
Thread.currentThread().setContextClassLoader( oldContextClassLoader );
|
||||
}
|
||||
|
||||
if ( Features.buildConsumer().isActive() )
|
||||
if ( Features.buildConsumer( request.getUserProperties() ).isActive() )
|
||||
{
|
||||
request.getRepositorySession().getData().set( TransformerContext.KEY,
|
||||
config.transformerContextBuilder.build() );
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.feature;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Centralized class for feature information
|
||||
*
|
||||
|
@ -31,11 +33,9 @@ public final class Features
|
|||
{
|
||||
}
|
||||
|
||||
private static final Feature BUILDCONSUMER = new Feature( "maven.experimental.buildconsumer", "true" );
|
||||
|
||||
public static Feature buildConsumer()
|
||||
public static Feature buildConsumer( Properties userProperties )
|
||||
{
|
||||
return BUILDCONSUMER;
|
||||
return new Feature( userProperties, "maven.experimental.buildconsumer", "true" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,10 +50,10 @@ public final class Features
|
|||
|
||||
private final String name;
|
||||
|
||||
Feature( String name, String defaultValue )
|
||||
Feature( Properties userProperties, String name, String defaultValue )
|
||||
{
|
||||
this.name = name;
|
||||
this.active = "true".equals( System.getProperty( name, defaultValue ) );
|
||||
this.active = "true".equals( userProperties.getProperty( name, defaultValue ) );
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
|
|
|
@ -790,7 +790,8 @@ public class DefaultModelBuilder
|
|||
}
|
||||
|
||||
Model rawModel;
|
||||
if ( Features.buildConsumer().isActive() && modelSource instanceof FileModelSource )
|
||||
if ( Features.buildConsumer( request.getUserProperties() ).isActive()
|
||||
&& modelSource instanceof FileModelSource )
|
||||
{
|
||||
rawModel = readFileModel( request, problems );
|
||||
File pomFile = ( (FileModelSource) modelSource ).getFile();
|
||||
|
|
Loading…
Reference in New Issue