This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/maven-remote-resources-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 3ab7e00 Keep a dependency's URLs when a supplemental model is merged
(#326)
3ab7e00 is described below
commit 3ab7e00bfb8c1a48670dc972a75f9f76a58e7f27
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Oct 28 10:21:38 2026 +0000
Keep a dependency's URLs when a supplemental model is merged (#326)
---
.../remote/AbstractProcessRemoteResourcesMojo.java | 3 +-
.../resources/remote/SupplementMergeTest.java | 53 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git
a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
index 1e4caf3..c5493c9 100644
---
a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
+++
b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
@@ -1039,7 +1039,8 @@ public abstract class AbstractProcessRemoteResourcesMojo
extends AbstractMojo {
}
protected Model mergeModels(Model parent, Model child) {
- inheritanceAssembler.assembleModelInheritance(child, parent);
+ // a supplement describes the same artifact, not a child module, so
URLs must not get the artifactId appended
+ inheritanceAssembler.copyModel(child, parent);
return child;
}
diff --git
a/src/test/java/org/apache/maven/plugin/resources/remote/SupplementMergeTest.java
b/src/test/java/org/apache/maven/plugin/resources/remote/SupplementMergeTest.java
new file mode 100644
index 0000000..d9462af
--- /dev/null
+++
b/src/test/java/org/apache/maven/plugin/resources/remote/SupplementMergeTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugin.resources.remote;
+
+import org.apache.maven.model.License;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Scm;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class SupplementMergeTest {
+
+ @Test
+ void supplementKeepsTheDependencyUrls() {
+ Model pom = new Model();
+ pom.setGroupId("org.foo");
+ pom.setArtifactId("widget");
+ pom.setUrl("https://widget.example.org/site");
+ Scm scm = new Scm();
+ scm.setUrl("https://github.com/example/widget");
+ pom.setScm(scm);
+
+ Model supplement = new Model();
+ supplement.setGroupId("org.foo");
+ supplement.setArtifactId("widget");
+ License license = new License();
+ license.setName("MIT License");
+ supplement.addLicense(license);
+
+ Model merged = new ProcessRemoteResourcesMojo(null, null, null, null,
null).mergeModels(pom, supplement);
+
+ assertEquals("https://widget.example.org/site", merged.getUrl());
+ assertEquals("https://github.com/example/widget",
merged.getScm().getUrl());
+ assertEquals("MIT License", merged.getLicenses().get(0).getName());
+ }
+}