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 a97af45  Correct implementation of aggregate selection
a97af45 is described below

commit a97af459b514876da3a4282324d133ddfe7c6831
Author: Carsten Ziegeler <cziege...@apache.org>
AuthorDate: Thu Nov 22 16:49:13 2018 +0100

    Correct implementation of aggregate selection
---
 README.md                                          |  6 ++---
 .../maven/mojos/AbstractIncludingFeatureMojo.java  | 27 ++++++++++++----------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index 0b60736..79e47d2 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Sample configuration:
                    <filesInclude/> <!-- optional include for local files, this 
can be specified more than once -->
                    <filesExclude/>  <!-- optional exclude for local files, 
this can be specified more than once -->
                    <includeArtifact/>       <!-- optional artifact for 
external features, this can be specified more than once -->
-                   <includeClassifier/>   <!-- optional classifier for local 
files or aggregates, this can be specified more than once -->
+                   <includeClassifier/>   <!-- optional classifier for 
aggregates, this can be specified more than once -->
                    <variablesOverrides>
                        <!-- Feature variables can be specified/overridden here 
-->
                        <https.port>8443</https.port>
@@ -134,7 +134,7 @@ 
https://github.com/apache/sling-org-apache-sling-feature-analyser/blob/master/sr
         <!-- optional exclude for local files, this can be specified more than 
once -->
         <filesExclude>dontcheck.json</filesExclude>
 
-       <!-- optional classifier for local files or aggregates, this can be 
specified more than once -->
+       <!-- optional classifier for aggregates, this can be specified more 
than once -->
        <includeClassifier>aggregated</includeClassifier
 
        <!-- optional artifact for external features, this can be specified 
more than once -->
@@ -186,7 +186,7 @@ found in `src/main/features` as well as features produce 
with the `aggregate-fea
               <filesInclude/> <!-- optional include for local files, this can 
be specified more than once -->
               <filesExclude/>  <!-- optional exclude for local files, this can 
be specified more than once -->
               <includeArtifact/>       <!-- optional artifact for external 
features, this can be specified more than once -->
-              <includeClassifier/>   <!-- optional classifier for local files 
or aggregates, this can be specified more than once -->
+              <includeClassifier/>   <!-- optional classifier for aggregates, 
this can be specified more than once -->
               <embedArtifact/> <!-- optional artifact to be embedded in the 
repository. This can be specified more than once -->
          </repository>
      </repositories>
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 de050d7..33ae4cd 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
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.TreeMap;
 
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
@@ -81,19 +82,21 @@ public abstract class AbstractIncludingFeatureMojo extends 
AbstractFeatureMojo {
             throw new MojoExecutionException("Match all (*) and additional 
classifiers are specified.");
         }
         for (final Map.Entry<String, Feature> entry : 
projectFeatures.entrySet()) {
-            final String classifier = entry.getValue().getId().getClassifier();
-            boolean include = includeAll;
-            if (!include) {
-                for (final String c : config.getIncludeClassifiers()) {
-                    if (c.trim().length() == 0 && classifier == null) {
-                        include = true;
-                    } else if (c.equals(classifier)) {
-                        include = true;
+            if (ProjectHelper.isAggregate(entry.getKey())) {
+                final String classifier = 
entry.getValue().getId().getClassifier();
+                boolean include = includeAll;
+                if (!include) {
+                    for (final String c : config.getIncludeClassifiers()) {
+                        if (c.trim().length() == 0 && classifier == null) {
+                            include = true;
+                        } else if (c.equals(classifier)) {
+                            include = true;
+                        }
                     }
                 }
-            }
-            if (include) {
-                selection.put(entry.getKey(), entry.getValue());
+                if (include) {
+                    selection.put(entry.getKey(), entry.getValue());
+                }
             }
         }
     }
@@ -161,7 +164,7 @@ public abstract class AbstractIncludingFeatureMojo extends 
AbstractFeatureMojo {
 
         private final Map<String, Feature> features;
 
-        private final Map<String, Feature> included = new LinkedHashMap<>();
+        private final Map<String, Feature> included = new TreeMap<>();
 
         private final String prefix;
 

Reply via email to