kwin commented on code in PR #762:
URL: https://github.com/apache/maven-surefire/pull/762#discussion_r1678192059


##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -319,25 +320,49 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
      */
     @Deprecated
     @Parameter
-    private Properties systemProperties;
+    Properties systemProperties;
 
     /**
      * List of System properties to pass to a provider.
      * The effective system properties given to a provider are contributed 
from several sources:
      * <ol>
+     * <li>properties set via {@link #argLine} with {@code -D} (only for 
forked executions)</li>
      * <li>{@link #systemProperties}</li>
      * <li>{@link AbstractSurefireMojo#getSystemPropertiesFile()} (set via 
parameter {@code systemPropertiesFile} on some goals)</li>
      * <li>{@link #systemPropertyVariables}</li>
-     * <li>User properties from {@link MavenSession#getUserProperties()}, 
usually set via CLI options given with {@code -D}</li>
+     * <li>User properties from {@link MavenSession#getUserProperties()}, 
usually set via CLI options given with {@code -D} on the current Maven 
process</li>
+     * <li>{@link #userPropertyVariables}</li>
      * </ol>
      * Later sources may overwrite same named properties from earlier sources, 
that means for example that one cannot overwrite user properties with either
-     * {@link #systemProperties}, {@link 
AbstractSurefireMojo#getSystemPropertiesFile()} or {@link 
#systemPropertyVariables}.
+     * {@link #systemProperties}, {@link #getSystemPropertiesFile()} or {@link 
#systemPropertyVariables} but only with
+     * {@link #userPropertyVariables}.
+     * <p>
+     * Certain properties may only be overwritten via {@link #argLine} 
(applicable only for forked executions) because their values are cached and 
only evaluated at the start of the JRE.
+     * Those include:
+     * <ul>
+     * <li>{@code java.library.path}</li>
+     * <li>{@code file.encoding}</li>
+     * <li>{@code jdk.map.althashing.threshold}</li>
+     * <li>{@code line.separator}</li>
+     * </ul>
      *
      * @since 2.5
      * @see #systemProperties
      */
     @Parameter
-    private Map<String, String> systemPropertyVariables;
+    Map<String, String> systemPropertyVariables;
+
+    /**
+     * List of user properties to pass to a provider.
+     * Similar to {@link #systemPropertyVariables} but having a higher 
precedence, therefore allows to overwrite user properties from the current 
Maven session.
+     * This should only be used in case a user property from the parent 
process needs to be explicitly overwritten.
+     * Regular properties should be set via {@link #systemPropertyVariables} 
instead in order to allow them to be overwritten
+     * via CLI arguments ({@code -Dmyproperty=myvalue})
+     * @since 3.4
+     * @see #systemPropertyVariables
+     */
+    @Parameter
+    Map<String, String> userPropertyVariables;

Review Comment:
   > let's make it right
   
   What is right? As outlined in 
https://issues.apache.org/jira/browse/SUREFIRE-1385?focusedCommentId=17864170&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17864170
 there is no simple solution IMHO: 
   The default should still be to allow overwrites with CLI arguments. 
Overwriting CLI arguments with plugin parameters is the edge case which we need 
to support on an exceptional base. I don't see a simple solution without adding 
a param. Please make a proposal what you consider right here.



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to