You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:16:46 UTC

[sling-maven-launchpad-plugin] 04/10: SLING-2591 : Provide a way to exclude sling properties from partial bundle lists

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

rombert pushed a commit to annotated tag maven-launchpad-plugin-2.2.0
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git

commit 8285db3efc5de3e6f374f8a7b1e3c3eea67295ef
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Aug 30 15:33:26 2012 +0000

    SLING-2591 : Provide a way to exclude sling properties from partial bundle lists
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1378990 13f79535-47bb-0310-9956-ffa450edef68
---
 .../AbstractUsingBundleListMojo.java               | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
index ce579ed..5640cba 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
@@ -108,7 +108,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
     private File[] rewriteRuleFiles;
 
     /**
-     * The comma separated list of tokens to include when copying configs
+     * The list of tokens to include when copying configs
      * from partial bundle lists.
      *
      * @parameter default-value="**"
@@ -116,7 +116,7 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
     private String[] configIncludes;
 
     /**
-     * The comma separated list of tokens to exclude when copying the configs
+     * The list of tokens to exclude when copying the configs
      * from partial bundle lists.
      *
      * @parameter
@@ -124,6 +124,14 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
     private String[] configExcludes;
 
     /**
+     * The list of names to exclude when copying properties
+     * from partial bundle lists.
+     *
+     * @parameter
+     */
+    private String[] propertiesExcludes;
+
+    /**
      * @component
      */
     protected MavenFileFilter mavenFileFilter;
@@ -406,18 +414,21 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
                     } else {
                         this.copyProperties(loadedProps, this.slingProperties);
                     }
+                    filterProperties(this.slingProperties);
                 } else if ( mode == 1 ) {
                     if ( this.slingWebappProperties == null ) {
                         this.slingWebappProperties = loadedProps;
                     } else {
                         this.copyProperties(loadedProps, this.slingWebappProperties);
                     }
+                    filterProperties(this.slingWebappProperties);
                 } else {
                     if ( this.slingStandaloneProperties == null ) {
                         this.slingStandaloneProperties = loadedProps;
                     } else {
                         this.copyProperties(loadedProps, this.slingStandaloneProperties);
                     }
+                    filterProperties(this.slingStandaloneProperties);
                 }
             } catch (IOException e) {
                 throw new MojoExecutionException("Unable to create filtered properties file", e);
@@ -431,6 +442,17 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo
         }
     }
 
+    /**
+     * Filter properties by removing excluded properties
+     */
+    private void filterProperties(final Properties props) {
+        if ( this.propertiesExcludes != null ) {
+            for(final String name : this.propertiesExcludes) {
+                props.remove(name.trim());
+            }
+        }
+    }
+
     protected Properties getSlingProperties(final boolean standalone) throws MojoExecutionException {
         readSlingProperties(this.commonSlingProps, 0);
         final Properties additionalProps = (standalone ? this.slingStandaloneProperties : this.slingWebappProperties);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.