You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/03/10 16:04:32 UTC
[commons-release-plugin] branch master updated: Add commented out hack to workaround Maven breakage.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-release-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 12e46c6 Add commented out hack to workaround Maven breakage.
12e46c6 is described below
commit 12e46c6ab0552c3589e2e3e4d7972cae7cada864
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Thu Mar 10 11:04:29 2022 -0500
Add commented out hack to workaround Maven breakage.
https://issues.apache.org/jira/browse/MNG-7316
---
.../mojos/CommonsDistributionDetachmentMojo.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
index 30aad8c..c24e82c 100755
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
@@ -113,8 +113,7 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo {
@Override
public void execute() throws MojoExecutionException {
if (!isDistModule) {
- getLog().info(
- "This module is marked as a non distribution or assembly module, and the plugin will not run.");
+ getLog().info("This module is marked as a non distribution or assembly module, and the plugin will not run.");
return;
}
if (StringUtils.isEmpty(distSvnStagingUrl)) {
@@ -132,11 +131,27 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo {
getLog().info("Current project contains no distributions. Not executing.");
return;
}
+ //
+ // PROBLEM CODE for Maven >= 3.8.3
+ // https://issues.apache.org/jira/browse/MNG-7316
for (final Artifact artifactToRemove : detachedArtifacts) {
// Maven 3.8.3 throws an exception here because MavenProject.getAttachedArtifacts()
// returns an IMMUTABLE collection.
project.getAttachedArtifacts().remove(artifactToRemove);
}
+ //
+ // HACK START to replace the above.
+ // https://issues.apache.org/jira/browse/MNG-7316
+// final ArrayList<Artifact> arrayList = new ArrayList<>(project.getAttachedArtifacts());
+// arrayList.removeAll(detachedArtifacts);
+// try {
+// // MavenProject#setAttachedArtifacts(List) is protected
+// MethodUtils.invokeMethod(project, true, "setAttachedArtifacts", arrayList);
+// } catch (ReflectiveOperationException e) {
+// throw new MojoExecutionException(e);
+// }
+ // HACK END
+ //
if (!workingDirectory.exists()) {
SharedFunctions.initDirectory(getLog(), workingDirectory);
}