diff --git a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/LocalSnapshotMetadata.java b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/LocalSnapshotMetadata.java index 8ca41fba34..511a2246b4 100644 --- a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/LocalSnapshotMetadata.java +++ b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/LocalSnapshotMetadata.java @@ -113,6 +113,11 @@ final class LocalSnapshotMetadata extends MavenMetadata { metadata = metadata.withVersioning(metadata.getVersioning().withSnapshotVersions(versions.values())); + // just carry-on as-is + if (recessive.getPlugins() != null && !recessive.getPlugins().isEmpty()) { + metadata = metadata.withPlugins(new ArrayList<>(recessive.getPlugins())); + } + artifacts.clear(); } diff --git a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/PluginsMetadata.java b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/PluginsMetadata.java index 9a424e9765..8c9665ba08 100644 --- a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/PluginsMetadata.java +++ b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/PluginsMetadata.java @@ -74,12 +74,16 @@ final class PluginsMetadata extends MavenMetadata { protected void merge(Metadata recessive) { List recessivePlugins = recessive.getPlugins(); List plugins = metadata.getPlugins(); - if (!plugins.isEmpty()) { + if (!recessivePlugins.isEmpty() || !plugins.isEmpty()) { LinkedHashMap mergedPlugins = new LinkedHashMap<>(); recessivePlugins.forEach(p -> mergedPlugins.put(p.getPrefix(), p)); plugins.forEach(p -> mergedPlugins.put(p.getPrefix(), p)); metadata = metadata.withPlugins(mergedPlugins.values()); } + // just carry-on as-is + if (recessive.getVersioning() != null) { + metadata = metadata.withVersioning(recessive.getVersioning()); + } } @Deprecated diff --git a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/RemoteSnapshotMetadata.java b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/RemoteSnapshotMetadata.java index 9f0a168d55..2365cb2482 100644 --- a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/RemoteSnapshotMetadata.java +++ b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/RemoteSnapshotMetadata.java @@ -22,6 +22,7 @@ import java.io.File; import java.nio.file.Path; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.GregorianCalendar; import java.util.LinkedHashMap; @@ -130,6 +131,11 @@ final class RemoteSnapshotMetadata extends MavenSnapshotMetadata { } metadata = metadata.withVersioning(metadata.getVersioning().withSnapshotVersions(versions.values())); + + // just carry-on as-is + if (recessive.getPlugins() != null && !recessive.getPlugins().isEmpty()) { + metadata = metadata.withPlugins(new ArrayList<>(recessive.getPlugins())); + } } private static int getBuildNumber(Metadata metadata) { diff --git a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/VersionsMetadata.java b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/VersionsMetadata.java index 2ee20677d2..219550e0ba 100644 --- a/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/VersionsMetadata.java +++ b/maven-api-impl/src/main/java/org/apache/maven/internal/impl/resolver/VersionsMetadata.java @@ -90,6 +90,11 @@ final class VersionsMetadata extends MavenMetadata { } metadata = metadata.withVersioning(versioning.build()); + + // just carry-on as-is + if (recessive.getPlugins() != null && !recessive.getPlugins().isEmpty()) { + metadata = metadata.withPlugins(new ArrayList<>(recessive.getPlugins())); + } } public Object getKey() { diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java index 506a138b0e..aea6a01267 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java @@ -114,6 +114,11 @@ final class LocalSnapshotMetadata extends MavenMetadata { metadata.getVersioning().setSnapshotVersions(new ArrayList<>(versions.values())); + // just carry-on as-is + if (!recessive.getPlugins().isEmpty()) { + metadata.setPlugins(new ArrayList<>(recessive.getPlugins())); + } + artifacts.clear(); } diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadata.java index 46444d55f5..8326f7ae58 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadata.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadata.java @@ -75,12 +75,17 @@ final class PluginsMetadata extends MavenMetadata { protected void merge(Metadata recessive) { List recessivePlugins = recessive.getPlugins(); List plugins = metadata.getPlugins(); - if (!plugins.isEmpty()) { + if (!recessivePlugins.isEmpty() || !plugins.isEmpty()) { LinkedHashMap mergedPlugins = new LinkedHashMap<>(); recessivePlugins.forEach(p -> mergedPlugins.put(p.getPrefix(), p)); plugins.forEach(p -> mergedPlugins.put(p.getPrefix(), p)); metadata.setPlugins(new ArrayList<>(mergedPlugins.values())); } + + // just carry-on as-is + if (recessive.getVersioning() != null) { + metadata.setVersioning(recessive.getVersioning()); + } } @Deprecated diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java index ae6789b9a2..a543495f7e 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java @@ -128,6 +128,11 @@ final class RemoteSnapshotMetadata extends MavenSnapshotMetadata { } metadata.getVersioning().setSnapshotVersions(new ArrayList<>(versions.values())); + + // just carry-on as-is + if (!recessive.getPlugins().isEmpty()) { + metadata.setPlugins(new ArrayList<>(recessive.getPlugins())); + } } private static int getBuildNumber(Metadata metadata) { diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java index 2a7737a395..8cd465fcab 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java @@ -84,6 +84,11 @@ final class VersionsMetadata extends MavenMetadata { versions.addAll(versioning.getVersions()); versioning.setVersions(new ArrayList<>(versions)); } + + // just carry-on as-is + if (!recessive.getPlugins().isEmpty()) { + metadata.setPlugins(new ArrayList<>(recessive.getPlugins())); + } } public Object getKey() {