You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2019/06/14 08:48:20 UTC

[sling-slingfeature-maven-plugin] branch master updated: SLING-8492 : Local feature can't be selected by specifying the classifierLocal feature can't be selected by specifying the classifier

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

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 90ddf88  SLING-8492 : Local feature can't be selected by specifying the classifierLocal feature can't be selected by specifying the classifier
90ddf88 is described below

commit 90ddf88e8e5cbcc4d29a25b685b01b8b8732a8e6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jun 14 10:48:12 2019 +0200

    SLING-8492 : Local feature can't be selected by specifying the classifierLocal feature can't be selected by specifying the classifier
---
 src/it/analyzer-errors-detected/verify.bsh         |  2 +-
 .../maven/mojos/AbstractIncludingFeatureMojo.java  | 22 ++++++-------
 .../feature/maven/mojos/AnalyseFeaturesMojo.java   | 37 +++++++++++-----------
 3 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/src/it/analyzer-errors-detected/verify.bsh b/src/it/analyzer-errors-detected/verify.bsh
index a3ed680..67a2c25 100644
--- a/src/it/analyzer-errors-detected/verify.bsh
+++ b/src/it/analyzer-errors-detected/verify.bsh
@@ -24,7 +24,7 @@ import org.codehaus.plexus.util.*;
         File file = new File(basedir, "build.log");
         String log = FileUtils.fileRead(file);
 
-        if (log.indexOf("One or more features Analyzer detected Feature error(s), please read the plugin log for more datils") < 0) {
+        if (log.indexOf("One or more features analyzer(s) detected feature error(s), please read the plugin log for more datils") < 0) {
             System.out.println( "FAILED!" );
             return false;
         }
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/AbstractIncludingFeatureMojo.java b/src/main/java/org/apache/sling/feature/maven/mojos/AbstractIncludingFeatureMojo.java
index d397fa9..d094706 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/AbstractIncludingFeatureMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/AbstractIncludingFeatureMojo.java
@@ -87,20 +87,18 @@ public abstract class AbstractIncludingFeatureMojo extends AbstractFeatureMojo {
         final Map<String, Feature> projectFeatures = ProjectHelper.getAssembledFeatures(this.project);
         boolean includeAll = "*".equals(selection);
         for (final Map.Entry<String, Feature> entry : projectFeatures.entrySet()) {
-            if (ProjectHelper.isAggregate(entry.getKey())) {
-                final String classifier = entry.getValue().getId().getClassifier();
-                boolean include = includeAll;
-                if (!include) {
-                    if (selection.trim().length() == 0 && classifier == null) {
-                        include = true;
-                    } else if (selection.equals(classifier)) {
-                        include = true;
-                    }
-                }
-                if (include) {
-                    result.put(entry.getKey(), entry.getValue());
+            final String classifier = entry.getValue().getId().getClassifier();
+            boolean include = includeAll;
+            if (!include) {
+                if (selection.trim().length() == 0 && classifier == null) {
+                    include = true;
+                } else if (selection.equals(classifier)) {
+                    include = true;
                 }
             }
+            if (include) {
+                result.put(entry.getKey(), entry.getValue());
+            }
         }
     }
 
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java b/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
index 613d256..a0f6bb2 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
@@ -16,6 +16,15 @@
  */
 package org.apache.sling.feature.maven.mojos;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -32,16 +41,6 @@ import org.apache.sling.feature.builder.ArtifactProvider;
 import org.apache.sling.feature.maven.ProjectHelper;
 import org.apache.sling.feature.scanner.Scanner;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Analyse the feature.
  */
@@ -104,7 +103,8 @@ public class AnalyseFeaturesMojo extends AbstractIncludingFeatureMojo {
                 Map<String, Map<String, String>> taskConfiguration = an.getTaskConfiguration();
                 addTaskConfigurationDefaults(taskConfiguration);
 
-                getLog().debug(MessageUtils.buffer().a("Setting up the ").strong("Analyser").a(" with following configuration:").toString());
+                getLog().debug(MessageUtils.buffer().a("Setting up the ").strong("analyser")
+                        .a(" with following configuration:").toString());
                 getLog().debug(" * Task Configuration = " + taskConfiguration);
                 getLog().debug(" * Include Tasks = " + an.getIncludeTasks());
                 getLog().debug(" * Exclude Tasks = " + an.getExcludeTasks());
@@ -116,15 +116,15 @@ public class AnalyseFeaturesMojo extends AbstractIncludingFeatureMojo {
 
                 if (features.isEmpty()) {
                     getLog().debug(
-                            "There are no assciated Feature files to current project, plugin execution will be interrupted");
+                            "There are no assciated feature files to current project, plugin execution will be skipped");
                     continue;
                 } else {
-                    getLog().debug("Starting Features analysis...");
+                    getLog().debug("Starting analysis of features...");
                 }
 
                 for (final Feature f : features) {
                     try {
-                        getLog().debug(MessageUtils.buffer().a("Analyzing Feature ").strong(f.getId().toMvnId())
+                        getLog().debug(MessageUtils.buffer().a("Analyzing feature ").strong(f.getId().toMvnId())
                                 .a(" ...").toString());
                         Dependency fwk = an.getFramework();
                         if (fwk == null) {
@@ -139,11 +139,11 @@ public class AnalyseFeaturesMojo extends AbstractIncludingFeatureMojo {
                         }
 
                         if (!result.getErrors().isEmpty()) {
-                            getLog().error("Analyser detected errors on Feature '" + f.getId().toMvnId()
+                            getLog().error("Analyser detected errors on feature '" + f.getId().toMvnId()
                                     + "'. See log output for error messages.");
                             hasErrors = true;
                         } else {
-                            getLog().debug(MessageUtils.buffer().a("Feature ").debug(f.getId().toMvnId())
+                            getLog().debug(MessageUtils.buffer().a("feature ").debug(f.getId().toMvnId())
                                     .a(" succesfully passed all analysis").toString());
                         }
                     } catch (Exception t) {
@@ -154,13 +154,14 @@ public class AnalyseFeaturesMojo extends AbstractIncludingFeatureMojo {
                 }
             } catch (IOException e) {
                 throw new MojoExecutionException(
-                        "A fatal error occurred while setting up the Analyzer, see error cause:", e);
+                        "A fatal error occurred while setting up the analyzer, see error cause:", e);
             } finally {
                 getLog().debug("Features analysis complete");
             }
         }
         if (hasErrors) {
-            throw new MojoFailureException("One or more features Analyzer detected Feature error(s), please read the plugin log for more datils");
+            throw new MojoFailureException(
+                    "One or more features analyzer(s) detected feature error(s), please read the plugin log for more datils");
         }
     }