You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamas Cservenak (Jira)" <ji...@apache.org> on 2023/06/28 09:05:00 UTC

[jira] [Commented] (MNG-7829) CLI properties passed with -D are not accessible with session.getSystemProperties()

    [ https://issues.apache.org/jira/browse/MNG-7829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738020#comment-17738020 ] 

Tamas Cservenak commented on MNG-7829:
--------------------------------------

The CLI -D properties are called "maven user properties". The "maven system properties" are usually populated from Java System Properties (and more).
People usually mix up these above with Java System Properties (partially as Maven3 did that: it pushed "maven user properties" into Java System Properties).

To get "effective" properties:
create new map
put all system propertie
put all user properties (as their precedence is higher)
resulting map is "effective"

[~gnodet] please ping in here

> CLI properties passed with -D are not accessible with session.getSystemProperties()
> -----------------------------------------------------------------------------------
>
>                 Key: MNG-7829
>                 URL: https://issues.apache.org/jira/browse/MNG-7829
>             Project: Maven
>          Issue Type: Bug
>          Components: Command Line
>    Affects Versions: 4.0.0-alpha-7
>            Reporter: Jerome Prinet
>            Priority: Minor
>
> h3. Context
>  * Maven _4.0.0-alpha-6_ and above
>  * A Maven extension collecting CLI arguments passed with _-D_
> h3. Issue
> In a Maven extension, I am collecting CLI arguments which allow to skip tests if present ({_}skipTests, skipITs, maven.test.skip{_}). 
> The problem is that since Maven {_}4.0.0-alpha06{_}, these informations are not part of the [session.systemProperties|https://maven.apache.org/ref/3.9.3/maven-core/apidocs/org/apache/maven/execution/MavenSession.html#getSystemProperties()] anymore.
> This is working fine until [this commit|https://github.com/apache/maven/commit/a1fa3eb5346f562a745f054650eee1e84c44db30?diff=unified] if not mistaken.
> The missing instruction being [this one|https://github.com/apache/maven/commit/a1fa3eb5346f562a745f054650eee1e84c44db30?diff=unified#diff-b8b814f5b6b3855ae79dc45a0266b94871193dcef42803c316e07409e94af35cL1546].
> *If I add this back on the latest version of master, I am able to collect the information.*
> h3. Alternative
> Those properties can be accessed via the [session.getUserProperties()|https://maven.apache.org/ref/3.9.3/maven-core/apidocs/org/apache/maven/execution/MavenSession.html#getUserProperties()]
> Please confirm if this is the expected way to collect the data.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)