Skip to content

Commit 968c1a2

Browse files
committed
[MNG-7634] Revert MNG-5982 and MNG-7417
This closes #916
1 parent 29e7b0e commit 968c1a2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ private Model loadPom(
194194
modelRequest.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
195195
modelRequest.setProcessPlugins(false);
196196
modelRequest.setTwoPhaseBuilding(false);
197-
modelRequest.setSystemProperties(toProperties(session.getSystemProperties()));
198-
modelRequest.setUserProperties(toProperties(session.getUserProperties()));
197+
// This merge is on purpose because otherwise user properties would override model
198+
// properties in dependencies the user does not know. See MNG-7563 for details.
199+
modelRequest.setSystemProperties(
200+
toProperties(session.getUserProperties(), session.getSystemProperties()));
201+
modelRequest.setUserProperties(new Properties());
199202
modelRequest.setModelCache(modelCacheFactory.createCache(session));
200203
modelRequest.setModelResolver(new DefaultModelResolver(
201204
session,
@@ -248,9 +251,14 @@ private Model loadPom(
248251
}
249252
}
250253

251-
private Properties toProperties(Map<String, String> map) {
254+
private Properties toProperties(Map<String, String> dominant, Map<String, String> recessive) {
252255
Properties props = new Properties();
253-
props.putAll(map);
256+
if (recessive != null) {
257+
props.putAll(recessive);
258+
}
259+
if (dominant != null) {
260+
props.putAll(dominant);
261+
}
254262
return props;
255263
}
256264

0 commit comments

Comments
 (0)