You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2022/04/13 16:29:39 UTC

[tomee-patch-plugin] 01/01: TOMEE-3903 - Allow the user to configure, if *.tar.gz files should be attached or not. For TomEE build attaching an *.tar.gz files is done twice leading to undefined Maven deploy behaviour.

This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch TOMEE-3903
in repository https://gitbox.apache.org/repos/asf/tomee-patch-plugin.git

commit db0b911c3df32f1011593decc53cb07ea7d7a55f
Author: Richard Zowalla <ri...@hs-heilbronn.de>
AuthorDate: Wed Apr 13 18:29:16 2022 +0200

    TOMEE-3903 - Allow the user to configure, if *.tar.gz files should be attached or not. For TomEE build attaching an *.tar.gz files is done twice leading to undefined Maven deploy behaviour.
---
 .../java/org/apache/tomee/patch/plugin/PatchMojo.java     | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
index 192e54a..bb97aef 100644
--- a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
+++ b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
@@ -189,6 +189,9 @@ public class PatchMojo extends AbstractMojo {
     @Parameter(defaultValue = "false")
     private Boolean transformSources;
 
+    @Parameter(defaultValue = "false")
+    private Boolean attach;
+
     /**
      * Sets the executable of the compiler to use when fork is <code>true</code>.
      */
@@ -299,11 +302,13 @@ public class PatchMojo extends AbstractMojo {
                         continue;
                     }
 
-                    final String classifier = artifact.getClassifier();
-                    final AttachedArtifact attachedArtifact = new AttachedArtifact(project.getArtifact(), "tar.gz", classifier, project.getArtifact().getArtifactHandler());
-                    attachedArtifact.setFile(tarGz);
-                    attachedArtifact.setResolved(true);
-                    project.addAttachedArtifact(attachedArtifact);
+                    if(attach) {
+                        final String classifier = artifact.getClassifier();
+                        final AttachedArtifact attachedArtifact = new AttachedArtifact(project.getArtifact(), "tar.gz", classifier, project.getArtifact().getArtifactHandler());
+                        attachedArtifact.setFile(tarGz);
+                        attachedArtifact.setResolved(true);
+                        project.addAttachedArtifact(attachedArtifact);
+                    }
                 }
             }