Generator: add plugin configuration for prereq/deps 04/52004/6
authorStephen Kitt <skitt@redhat.com>
Fri, 17 Feb 2017 14:59:23 +0000 (15:59 +0100)
committerStephen Kitt <skitt@redhat.com>
Fri, 24 Feb 2017 10:45:03 +0000 (11:45 +0100)
This adds two lists of features as configuration elements in
karaf-maven-plugin, dependencyFeatures and prerequisiteFeatures;
features named there (and defined elsewhere, in the POM) will be
flagged as dependencies and prerequisites respectively.

Bug: 7752
Bug: 7753
Change-Id: Ice35279822f513945df08f70880edcc74395da33
Signed-off-by: Stephen Kitt <skitt@redhat.com>
karaf/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java

index 2328d25a3facd921a2edbfc4c411f1de679e7034..8643d8fb81c66f77bbe0f73e5be0ef1ee6cf8064 100644 (file)
@@ -258,7 +258,19 @@ public class GenerateDescriptorMojo extends MojoSupport {
      */
     @Parameter(defaultValue = "false")
     private boolean simplifyBundleDependencies;
-    
+
+    /**
+     * Names of features which are prerequisites (they still need to be defined separately).
+     */
+    @Parameter
+    private List<String> prerequisiteFeatures = new ArrayList<>();
+
+    /**
+     * Names of features which are dependencies (they still need to be defined separately).
+     */
+    @Parameter
+    private List<String> dependencyFeatures = new ArrayList<>();
+
     // *************************************************
     // READ-ONLY MAVEN PLUGIN PARAMETERS
     // *************************************************
@@ -537,6 +549,8 @@ public class GenerateDescriptorMojo extends MojoSupport {
             }
             for (Feature includedFeature : includedFeatures.getFeature()) {
                 Dependency dependency = new Dependency(includedFeature.getName(), includedFeature.getVersion());
+                dependency.setPrerequisite(prerequisiteFeatures.contains(dependency.getName()));
+                dependency.setDependency(dependencyFeatures.contains(dependency.getName()));
                 // Determine what dependency we're actually going to use
                 Dependency matchingDependency = findMatchingDependency(feature.getFeature(), dependency);
                 if (matchingDependency != null) {