You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2024/05/20 16:14:04 UTC

(nifi-maven) branch main updated: NIFI-13264 Add extension-manifest.xml to the build artifacts produced by the NAR plugin

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

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-maven.git


The following commit(s) were added to refs/heads/main by this push:
     new b079dd1  NIFI-13264 Add extension-manifest.xml to the build artifacts produced by the NAR plugin
b079dd1 is described below

commit b079dd163b2366dc33c935a6fff49540b5e41872
Author: Bryan Bende <bb...@datavolo.io>
AuthorDate: Mon May 20 10:02:18 2024 -0400

    NIFI-13264 Add extension-manifest.xml to the build artifacts produced by the NAR plugin
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #37.
---
 src/main/java/org/apache/nifi/NarMojo.java | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/nifi/NarMojo.java b/src/main/java/org/apache/nifi/NarMojo.java
index 333bc72..4429e73 100644
--- a/src/main/java/org/apache/nifi/NarMojo.java
+++ b/src/main/java/org/apache/nifi/NarMojo.java
@@ -1041,16 +1041,22 @@ public class NarMojo extends AbstractMojo {
     }
 
     private void makeNar() throws MojoExecutionException {
-        File narFile = createArchive();
+        final NarResult narResult = createArchive();
+        final File narFile = narResult.getNarFile();
 
         if (classifier != null) {
             projectHelper.attachArtifact(project, "nar", classifier, narFile);
         } else {
             project.getArtifact().setFile(narFile);
         }
+
+        final File extensionDocsFile = narResult.getExtensionDocsFile();
+        if (extensionDocsFile != null && !skipDocGeneration) {
+            projectHelper.attachArtifact(project, "xml", "nar-extension-manifest", extensionDocsFile);
+        }
     }
 
-    public File createArchive() throws MojoExecutionException {
+    private NarResult createArchive() throws MojoExecutionException {
         final File outputDirectory = projectBuildDirectory;
         File narFile = getNarFile(outputDirectory, finalName, classifier);
         MavenArchiver archiver = new MavenArchiver();
@@ -1122,7 +1128,7 @@ public class NarMojo extends AbstractMojo {
             archive.addManifestEntry("Clone-During-Instance-Class-Loading", String.valueOf(cloneDuringInstanceClassLoading));
 
             archiver.createArchive(session, project, archive);
-            return narFile;
+            return new NarResult(narFile, extensionDocsFile);
         } catch (ArchiverException | MojoExecutionException | ManifestException | IOException | DependencyResolutionRequiredException e) {
             throw new MojoExecutionException("Error assembling NAR", e);
         }
@@ -1219,4 +1225,22 @@ public class NarMojo extends AbstractMojo {
         }
     }
 
+    private static class NarResult {
+        private final File narFile;
+        private final File extensionDocsFile;
+
+        public NarResult(final File narFile, final File extensionDocsFile) {
+            this.narFile = narFile;
+            this.extensionDocsFile = extensionDocsFile;
+        }
+
+        public File getNarFile() {
+            return narFile;
+        }
+
+        public File getExtensionDocsFile() {
+            return extensionDocsFile;
+        }
+    }
+
 }