You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2019/05/07 18:26:35 UTC

[karaf] branch master updated: [KARAF-6274] Karaf 4.2.5 maven plugin breaks if no archives are generated

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

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new a775677  [KARAF-6274] Karaf 4.2.5 maven plugin breaks if no archives are generated
     new c52e4da  Merge pull request #833 from lkiesow/karaf-6274-no-archive
a775677 is described below

commit a775677e8410b5667a09f8bb7eddac1834d22421
Author: Lars Kiesow <lk...@uos.de>
AuthorDate: Mon May 6 16:31:08 2019 +0200

    [KARAF-6274] Karaf 4.2.5 maven plugin breaks if no archives are generated
    
    Karaf 4.2.5 includes a line checking if archiveTarGz or archiveZip is
    selected, throwing an error otherwise. Unfortunately, this line breaks
    our build and a few of our use cases where we do not pack our
    assemblies.
    
    For example, we have a development assembly which we have end up in a
    special folder unpacked and prepared to be launched. We could, of
    course, pack and then automatically unpack it but that would just be a
    waste of time.
    
    We also have some assemblies which we pack with additional files
    (documentation, …) which is handled separately. Again a use-case for
    assemblies unpacked by the karaf-maven-plugin.
    
    The change in question is commit 7da5044 (pull request #811)
---
 .../src/main/java/org/apache/karaf/tooling/ArchiveMojo.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
index a9bdb45..a99634a 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
@@ -115,11 +115,13 @@ public class ArchiveMojo extends MojoSupport {
     public void execute() throws MojoExecutionException, MojoFailureException {
         org.apache.maven.artifact.Artifact artifact = project.getArtifact();
         artifact.setFile(targetFile);
-        try {
-            if (project.getPackaging().equals("karaf-assembly") && !archiveTarGz && !archiveZip) {
-                throw new IllegalArgumentException("For karaf-assembly packaging, you have to specify at least one archive type (tar.gz or zip)");
-            }
 
+        // abort if there are no archives to be created
+        if (!archiveTarGz && !archiveZip) {
+            return;
+        }
+
+        try {
             if (project.getPackaging().equals("karaf-assembly")) {
                 if (archiveZip) {
                     archive("zip", false, true);