gnodet commented on code in PR #12442:
URL: https://github.com/apache/maven/pull/12442#discussion_r3542908606


##########
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:
##########
@@ -1636,6 +1645,12 @@ static void populateProperties(CliRequest cliRequest, 
Properties systemPropertie
         EnvironmentUtils.addEnvVars(systemProperties);
         SystemProperties.addSystemProperties(systemProperties);
 
+        // one distinguished env variable: MAVEN_REPO_CENTRAL; if present, we 
make it into property
+        if (systemProperties.contains(MAVEN_REPO_CENTRAL_ENV)) {

Review Comment:
   🐛 **Bug:** `Properties.contains()` is inherited from 
`Hashtable.contains(Object value)` and checks whether the given string exists 
as a **value** in the map, not as a key. This means the condition will almost 
never be `true` — it would only match if some other property happened to have 
the literal string `"env.MAVEN_REPO_CENTRAL"` as its **value**.
   
   The intent is to check whether the **key** `"env.MAVEN_REPO_CENTRAL"` 
exists, which requires `containsKey()`:
   
   ```suggestion
           if (systemProperties.containsKey(MAVEN_REPO_CENTRAL_ENV)) {
   ```
   
   As written, the `MAVEN_REPO_CENTRAL` environment variable → 
`maven.repo.central` property promotion does not work.



-- 
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