FELIX-3555 : Maven SCR Plugin shoudln't attempt to run on modules of type POM
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1355041 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
index 2474b5d..d20e101 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
@@ -23,6 +23,7 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -158,7 +159,24 @@
*/
private String specVersion;
+ /**
+ * Project types which this plugin supports.
+ *
+ * @parameter
+ */
+ protected List<String> supportedProjectTypes = Arrays.asList( new String[]
+ { "jar", "bundle" } );
+
public void execute() throws MojoExecutionException, MojoFailureException {
+ final String projectType = project.getArtifact().getType();
+
+ // ignore unsupported project types, useful when bundleplugin is configured in parent pom
+ if ( !supportedProjectTypes.contains( projectType ) ) {
+ getLog().debug(
+ "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
+ return;
+ }
+
// create the log for the generator
final org.apache.felix.scrplugin.Log scrLog = new MavenLog(getLog());