michael-o commented on code in PR #863:
URL: https://github.com/apache/maven/pull/863#discussion_r1014832112


##########
maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java:
##########
@@ -313,6 +317,28 @@ else if ( !MAVEN_RESOLVER_TRANSPORT_AUTO.equals( transport 
) )
         return session;
     }
 
+    private Map<?, ?> getConfigFromRequestProfiles( MavenExecutionRequest 
request )
+    {
+
+        HashSet<String> activeProfileId = new HashSet<>( 
request.getProfileActivation().getRequiredActiveProfileIds() );
+        activeProfileId.addAll( 
request.getProfileActivation().getOptionalActiveProfileIds() );
+
+        return request.getProfiles().stream()
+            .filter( profile -> activeProfileId.contains( profile.getId() ) )
+            .map( ModelBase::getProperties )
+            .flatMap( properties -> properties.entrySet().stream() )
+            .filter( entry -> isPropertyForResolver( entry.getKey().toString() 
) )
+            .collect(
+                Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue, ( 
k1, k2 ) -> k2  ) );
+    }
+
+    private boolean isPropertyForResolver( String propertyName )
+    {
+        return propertyName != null
+            && ( propertyName.startsWith( "maven.resolver." ) || 
propertyName.startsWith( "aether." ) );
+    }

Review Comment:
   We don't filter properties from user or system, why here?



##########
maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java:
##########
@@ -150,6 +152,8 @@ public DefaultRepositorySystemSession newRepositorySession( 
MavenExecutionReques
         configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
         configProps.put( ConfigurationProperties.INTERACTIVE, 
request.isInteractiveMode() );
         configProps.put( "maven.startTime", request.getStartTime() );
+        // First add properties populated from settings.xml
+        configProps.putAll( getConfigFromRequestProfiles( request ) );

Review Comment:
   getPropertiesFromRequestedProfiles()?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to