This is an automated email from the ASF dual-hosted git repository.
mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new b34a0b3662 Better transient maven repo deduplication.
new 2bd51e8d55 Merge pull request #6757 from
mbien/better-transitive-repo-deduplication
b34a0b3662 is described below
commit b34a0b3662fe4e1d0c73212465a2522b01326776
Author: Michael Bien <[email protected]>
AuthorDate: Tue Nov 28 15:24:59 2023 +0100
Better transient maven repo deduplication.
Transient repos are added and removed based on what projects are open.
NB does some deduplication since projects may define the same repo
with a different ID or URL. This works fine until projects are closed
and there is nothing to deduplicate anymore - NB might think that
a repo is now new and index it again under a different ID.
this PR makes two changes:
- repo1.maven.org is now tracked as repo.maven.apache.org
- remote repos are registered in the services view once fully indexed,
this makes them no longer transient
---
.../modules/maven/indexer/NexusRepositoryIndexerImpl.java | 4 ++++
.../modules/maven/indexer/api/RepositoryPreferences.java | 11 ++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git
a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
index 2402b12e48..b62b68c6ef 100644
---
a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
+++
b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
@@ -569,6 +569,10 @@ public class NexusRepositoryIndexerImpl implements
RepositoryIndexerImplementati
removeGroupCache(repo);
fetchUpdateResult =
remoteIndexUpdater.fetchAndUpdateIndex(iur);
storeGroupCache(repo, indexingContext);
+ // register indexed repo in services view
+ if (fetchUpdateResult.isFullUpdate() &&
fetchUpdateResult.isSuccessful()) {
+
RepositoryPreferences.getInstance().addOrModifyRepositoryInfo(repo);
+ }
} catch (IOException | AlreadyClosedException |
IllegalArgumentException ex) {
// AlreadyClosedException can happen in low storage
situations when lucene is trying to handle IOEs
// IllegalArgumentException signals remote archive
format problems
diff --git
a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/api/RepositoryPreferences.java
b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/api/RepositoryPreferences.java
index 804a9ecbb4..ed7874e2ea 100644
---
a/java/maven.indexer/src/org/netbeans/modules/maven/indexer/api/RepositoryPreferences.java
+++
b/java/maven.indexer/src/org/netbeans/modules/maven/indexer/api/RepositoryPreferences.java
@@ -80,6 +80,7 @@ public final class RepositoryPreferences {
private static final String PROP_INDEX_DOWNLOAD_PERMISSIONS =
"indexDownloadPermissions"; //NOI18N
public static final String PROP_MT_INDEX_EXTRACTION =
"indexMultiThreadedExtraction"; //NOI18N
public static final String PROP_INDEX_DATE_CUTOFF_FILTER =
"indexDateCotoffFilter"; //NOI18N
+ private static final String ALT_CENTRAL_URL =
"https://repo1.maven.org/maven2"; //NOI18N
public static final int FREQ_ONCE_WEEK = 0;
public static final int FREQ_ONCE_DAY = 1;
@@ -545,12 +546,12 @@ public final class RepositoryPreferences {
//only register repositories we can safely handle.. #227322
return;
}
+ if (url.equals(ALT_CENTRAL_URL) || url.equals(ALT_CENTRAL_URL+"/")) {
+ // map to primary URL to avoid duplicates
+ url = RepositorySystem.DEFAULT_REMOTE_REPO_URL;
+ }
synchronized (infoCache) {
- List<RepositoryInfo> infos = transients.get(key);
- if (infos == null) {
- infos = new ArrayList<>();
- transients.put(key, infos);
- }
+ List<RepositoryInfo> infos = transients.computeIfAbsent(key, k ->
new ArrayList<>());
RepositoryInfo info = new RepositoryInfo(id, displayName, null,
url);
info.setMirrorStrategy(strategy);
infos.add(info);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists