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

ASF GitHub Bot commented on MNG-6112:
-------------------------------------

slawekjaranowski commented on code in PR #1142:
URL: https://github.com/apache/maven/pull/1142#discussion_r1234169184


##########
maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java:
##########
@@ -104,6 +106,26 @@ public SettingsBuildingResult 
build(SettingsBuildingRequest request) throws Sett
         settingsMerger.merge(projectSettings, globalSettings, 
TrackableBase.GLOBAL_LEVEL);
         settingsMerger.merge(userSettings, projectSettings, 
TrackableBase.PROJECT_LEVEL);
 
+        // If no repository is defined in the user/global settings,
+        // it means that we have "old" settings (as those are new in 4.0)
+        // so add central to the computed settings for backward compatibility.
+        if (userSettings.getRepositories().isEmpty()
+                && userSettings.getPluginRepositories().isEmpty()) {
+            Repository central = new Repository();
+            central.setId("central");
+            central.setName("Central Repository");
+            central.setUrl("https://repo.maven.apache.org/maven2";);
+            RepositoryPolicy disabledPolicy = new RepositoryPolicy();
+            disabledPolicy.setEnabled(false);
+            central.setSnapshots(disabledPolicy);
+            userSettings.getRepositories().add(central);
+            central = central.clone();
+            RepositoryPolicy updateNeverPolicy = new RepositoryPolicy();
+            disabledPolicy.setUpdatePolicy("never");

Review Comment:
   here we override update policy - but in settings.xml we don't such it





> Align artifacts and plugins policies using the default value
> ------------------------------------------------------------
>
>                 Key: MNG-6112
>                 URL: https://issues.apache.org/jira/browse/MNG-6112
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.5.0-beta-1
>            Reporter: Christian Schulte
>            Assignee: Guillaume Nodet
>            Priority: Major
>              Labels: must-be-in-4.0.0-alpha-2
>             Fix For: 4.0.0-alpha-6
>
>




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

Reply via email to