FELIX-479: add supportedProjectTypes configuration option

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@618881 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
index 7635924..02d5419 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
@@ -20,6 +20,8 @@
 
 
 import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.felix.obr.plugin.Config;
 import org.apache.felix.obr.plugin.ObrUpdate;
@@ -31,7 +33,7 @@
 
 
 /**
- * Installs bundle details in the local OBR repository
+ * Installs bundle details in the local OBR repository (life-cycle goal)
  * 
  * @goal install
  * @phase install
@@ -48,6 +50,14 @@
     private String obrRepository;
 
     /**
+     * Project types which this plugin supports.
+     *
+     * @parameter
+     */
+    private List supportedProjectTypes = Arrays.asList( new String[]
+        { "jar", "bundle" } );
+
+    /**
      * Local Repository.
      * 
      * @parameter expression="${localRepository}"
@@ -68,8 +78,14 @@
 
     public void execute()
     {
-        if ( "NONE".equalsIgnoreCase( obrRepository ) )
+        if ( !supportedProjectTypes.contains( project.getPackaging() ) )
         {
+            getLog().info( "Ignoring packaging type " + project.getPackaging() );
+            return;
+        }
+        else if ( "NONE".equalsIgnoreCase( obrRepository ) )
+        {
+            getLog().info( "OBR update disabled (enable with -DobrRepository)" );
             return;
         }
 
@@ -81,18 +97,18 @@
             String mavenRepository = localRepository.getBasedir();
 
             URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
-            URI obrXml = ObrUtils.findObrXml( project.getResources() );
+            URI obrXmlFile = ObrUtils.findObrXml( project.getResources() );
             URI bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact() );
 
             Config userConfig = new Config();
 
-            update = new ObrUpdate( repositoryXml, obrXml, project, bundleJar, mavenRepository, userConfig, log );
+            update = new ObrUpdate( repositoryXml, obrXmlFile, project, bundleJar, mavenRepository, userConfig, log );
 
             update.updateRepository();
         }
         catch ( Exception e )
         {
-            log.warn( "Exception while updating OBR: " + e.getLocalizedMessage(), e );
+            log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e );
         }
     }
 }
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
index e026d91..8d0207f 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
@@ -20,6 +20,8 @@
 
 
 import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.felix.obr.plugin.Config;
 import org.apache.felix.obr.plugin.ObrUpdate;
@@ -48,6 +50,14 @@
     private String obrRepository;
 
     /**
+     * Project types which this plugin supports.
+     *
+     * @parameter
+     */
+    private List supportedProjectTypes = Arrays.asList( new String[]
+        { "jar", "bundle" } );
+
+    /**
      * Local Repository.
      * 
      * @parameter expression="${localRepository}"
@@ -68,7 +78,12 @@
 
     public void execute()
     {
-        if ( "NONE".equalsIgnoreCase( obrRepository ) )
+        if ( !supportedProjectTypes.contains( project.getPackaging() ) )
+        {
+            getLog().info( "Ignoring packaging type " + project.getPackaging() );
+            return;
+        }
+        else if ( "NONE".equalsIgnoreCase( obrRepository ) )
         {
             getLog().info( "OBR update disabled (enable with -DobrRepository)" );
             return;