FELIX-3497: allow custom packaging of attached artifact (similar to custom classifier feature)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1490772 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 95039aa..4dea85b 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -132,6 +132,14 @@
     protected String classifier;
 
     /**
+     * Packaging type of the bundle to be installed.  For example, "jar".
+     * Defaults to none which means use the same packaging as the project.
+     *
+     * @parameter
+     */
+    protected String packaging;
+
+    /**
      * @component
      */
     private MavenProjectHelper m_projectHelper;
@@ -369,13 +377,24 @@
                 mainArtifact.setArtifactHandler( m_artifactHandlerManager.getArtifactHandler( "jar" ) );
             }
 
-            if ( null == classifier || classifier.trim().length() == 0 )
+            boolean customClassifier = null != classifier && classifier.trim().length() > 0;
+            boolean customPackaging = null != packaging && packaging.trim().length() > 0;
+
+            if ( customClassifier && customPackaging )
             {
-                mainArtifact.setFile( jarFile );
+                m_projectHelper.attachArtifact( currentProject, packaging, classifier, jarFile );
+            }
+            else if ( customClassifier )
+            {
+                m_projectHelper.attachArtifact( currentProject, jarFile, classifier );
+            }
+            else if ( customPackaging )
+            {
+                m_projectHelper.attachArtifact( currentProject, packaging, jarFile );
             }
             else
             {
-                m_projectHelper.attachArtifact( currentProject, jarFile, classifier );
+                mainArtifact.setFile( jarFile );
             }
 
             if ( unpackBundle )