Updates to the Felix M2 Plugin:
o  Added support for package type 'osgi-bundle'.
o  Added support for the Maven 2 lifecycle commands 'package' and 'install'.
o  Removed the appended '-bundle'.
o  Version is now 0.3.0.

git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@329953 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/maven2/maven-osgi-plugin/pom.xml b/tools/maven2/maven-osgi-plugin/pom.xml
index d43934a..a895d15 100644
--- a/tools/maven2/maven-osgi-plugin/pom.xml
+++ b/tools/maven2/maven-osgi-plugin/pom.xml
@@ -1,45 +1,28 @@
 <project>
+  <parent>
+    <artifactId>maven-plugin-parent</artifactId>
+    <groupId>org.apache.maven.plugins</groupId>
+    <version>2.0</version>
+  </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-osgi-plugin</artifactId>
   <packaging>maven-plugin</packaging>
   <name>Maven OSGi Plugin</name>
-  <version>0.1.2</version>
+  <version>0.3.0</version>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <version>2.0-beta-1</version>
+      <artifactId>maven-archiver</artifactId>
+      <version>2.0</version>
     </dependency>
     <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-archiver</artifactId>
-        <version>2.0-beta-1</version>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
     </dependency>
     <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-project</artifactId>
-        <version>2.0-beta-1</version>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
     </dependency>
-    <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-archiver</artifactId>
-        <version>2.0-beta-1</version>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven-project</artifactId>
-        <version>2.0-beta-1</version>
-    </dependency>
-      <dependency>
-          <groupId>plexus</groupId>
-          <artifactId>plexus-archiver</artifactId>
-          <version>1.0-alpha-2</version>
-      </dependency>
-      <dependency>
-        <groupId>plexus</groupId>
-        <artifactId>plexus-utils</artifactId>
-        <version>1.0.3</version>
-      </dependency>
   </dependencies>
 </project>
diff --git a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
index 0b7bc821..1ac38bf 100644
--- a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
+++ b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
@@ -1,69 +1,58 @@
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ *   Copyright 2005 The Apache Software Foundation
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *       http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
  */
+
 package org.apache.felix.tools.maven.plugin;
 
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.archiver.MavenArchiver;
-import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.archiver.jar.JarArchiver;
-import org.codehaus.plexus.util.FileUtils;
-
 import java.io.File;
-import java.util.List;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+import org.codehaus.plexus.util.FileUtils;
+
 /**
- * @author <a href="tbennett@apache.org">Timothy Bennett</a>
- * @goal osgi-jar
+ * Package an OSGi jar "bundle."
+ * 
+ * @author <a href="mailto:felix-dev@incubator.apache.org">Apache Felix Project</a>
+ * @version $Rev$, $Date$
+ * @goal osgi-bundle
  * @phase package
  * @requiresDependencyResolution runtime
- * @description build a OSGi bundle jar
+ * @description build an OSGi bundle jar
  */
-public class OsgiJarMojo extends AbstractMojo {
-    private static final String[] DEFAULT_EXCLUDES = new String[]{"**/package.html"};
-    private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
+public class OsgiJarMojo extends AbstractMojo
+{
+    private static final String[] EMPTY_STRING_ARRAY = {};
 
     /**
-     * @todo Change type to File
-     *
-     * @parameter expression="${project.build.directory}"
-     * @required
-     * @readonly
-     */
-    private String basedir;
-
-    /**
-     * @parameter alias="jarName" expression="${project.build.finalName}"
-     * @required
-     */
-    private String finalName;
-
-    /**
-     * @parameter expression="${project.build.outputDirectory}"
-     * @required
-     * @readonly
-     */
-    private String outputDirectory;
-
-    /**
+     * The Maven project.
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -71,6 +60,59 @@
     private MavenProject project;
 
     /**
+     * The directory for the generated JAR.
+     *
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private String buildDirectory;
+
+    /**
+     * The directory containing generated classes.
+     *
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File outputDirectory;
+
+    /**
+     * The name of the generated JAR file.
+     * 
+     * @parameter alias="jarName" expression="${project.build.finalName}"
+     * @required
+     */
+    private String jarName;
+
+    /**
+     * The Jar archiver.
+     *
+     * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+     * @required
+     */
+    private JarArchiver jarArchiver;
+
+    /**
+     * The maven archive configuration to use.
+     */
+    private MavenArchiveConfiguration archiveConfig = new MavenArchiveConfiguration();
+
+    /**
+     * The comma separated list of tokens to include in the JAR.
+     * Default is '**'.
+     *
+     * @parameter alias="includes"
+     */
+    private String jarSourceIncludes = "**";
+
+    /**
+     * The comma separated list of tokens to exclude from the JAR.
+     *
+     * @parameter alias="excludes"
+     */
+    private String jarSourceExcludes;
+
+    /**
      * @parameter
      */
     private String manifestFile;
@@ -81,97 +123,179 @@
     private OsgiManifest osgiManifest;
 
     /**
-     * @parameter
+     * Execute this Mojo
+     * 
+     * @throws MojoExecutionException
      */
-    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+    public void execute() throws MojoExecutionException
+    {
+        File jarFile = new File( buildDirectory, jarName + ".jar" );
+
+        try
+        {
+            performPackaging( jarFile );
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "Error assembling JAR bundle", e );
+        }
+    }
 
     /**
-     * @todo Add license files in META-INF directory.
+     * Generates the JAR bundle file.
+     *
+     * @param  jarFile the target JAR file
+     * @throws IOException
+     * @throws ArchiverException
+     * @throws ManifestException
+     * @throws DependencyResolutionRequiredException
      */
-    public void execute() throws MojoExecutionException {
-        File jarFile = new File(basedir, finalName + "-bundle.jar");
+    private void performPackaging( File jarFile ) throws IOException, ArchiverException, ManifestException,
+            DependencyResolutionRequiredException, MojoExecutionException
+    {
+        getLog().info( "Generating JAR bundle " + jarFile.getAbsolutePath() );
 
         MavenArchiver archiver = new MavenArchiver();
-        archiver.setOutputFile(jarFile);
 
-        /*
-            TODO: Decide if we accept merging of entire manifest.mf files
-            Here's a big question to make a final decision at some point: Do accept
-            merging of manifest entries located in some file somewhere in the project
-            directory?  If so, do we allow both file and configuration based entries
-            to be specified simultaneously and how do we merge these?
-        */
-        if (manifestFile != null) {
-            File file = new File(project.getBasedir().getAbsolutePath(), manifestFile);
-            getLog().info("Manifest file: " + file.getAbsolutePath() + " will be used");
-            archive.setManifestFile(file);
-        } else {
-            getLog().info("No manifest file specified. Default will be used.");
+        archiver.setArchiver( jarArchiver );
+        archiver.setOutputFile( jarFile );
+
+        addManifestFile();
+        addManifestEntries();
+
+        addBundleClasspath();
+        addBundleVersion();
+
+        jarArchiver.addDirectory( outputDirectory, getIncludes(), getExcludes() );
+
+        archiver.createArchive( project, archiveConfig );
+
+        project.getArtifact().setFile( jarFile );
+    }
+
+    /**
+     * TODO: Decide if we accept merging of entire manifest.mf files
+     * Here's a big question to make a final decision at some point: Do accept
+     * merging of manifest entries located in some file somewhere in the project
+     * directory?  If so, do we allow both file and configuration based entries
+     * to be specified simultaneously and how do we merge these?
+     */
+    private void addManifestFile()
+    {
+        if ( manifestFile != null )
+        {
+            File file = new File( project.getBasedir().getAbsolutePath(), manifestFile );
+            getLog().info( "Manifest file: " + file.getAbsolutePath() + " will be used" );
+            archiveConfig.setManifestFile( file );
         }
+        else
+        {
+            getLog().info( "No manifest file specified. Default will be used." );
+        }
+    }
 
-        // Look for any OSGi specified manifest entries in the maven-felix-plugin configuration
-        // section of the POM.  If we find some, then add them to the target artifact's manifest.
-        if (osgiManifest != null) {
+    /**
+     * Look for any OSGi specified manifest entries in the maven-osgi-plugin configuration
+     * section of the POM.  If we find some, then add them to the target artifact's manifest.
+     */
+    private void addManifestEntries()
+    {
+        if ( osgiManifest != null && osgiManifest.getEntries().size() > 0 )
+        {
             Map entries = osgiManifest.getEntries();
-            if (entries.size() != 0) {
-                getLog().info("OSGi bundle manifest entries have been specified." +
-                        " Bundle manifest will be modified with the following entries: " + entries.toString());
-                archive.addManifestEntries(entries);
-            } else {
-                getLog().info("No OSGi bundle manifest entries have been specified.  Bundle manifest will not be modified");
-            }
-        } else {
-            getLog().info("No OSGi bundle manifest entries have been specified.  Bundle manifest will not be modified");
+
+            getLog().info( "Bundle manifest will be modified with the following entries: " + entries.toString() );
+            archiveConfig.addManifestEntries( entries );
         }
+        else
+        {
+            getLog().info( "No OSGi bundle manifest entries have been specified in the POM." );
+        }
+    }
 
-        /*
-            We are going to iterate thru the POM's specified jar dependencies.  If a dependency
-            has a scope of either RUNTIME or COMPILE, then we'll jar them up inside the
-            OSGi bundle artifact.
-
-            We are also going to automatically construct the Bundle-Classpath manifest entry.
-        */
+    /**
+     * We are going to iterate through the POM's specified JAR dependencies.  If a dependency
+     * has a scope of either RUNTIME or COMPILE, then we'll JAR them up inside the
+     * OSGi bundle artifact.  We will then add the Bundle-Classpath manifest entry.
+     */
+    private void addBundleClasspath() throws MojoExecutionException
+    {
         StringBuffer bundleClasspath = new StringBuffer();
         Set artifacts = project.getArtifacts();
-        for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
-            Artifact artifact = (Artifact) iter.next();
-            if (!Artifact.SCOPE_PROVIDED.equals(artifact.getScope()) &&
-                    !Artifact.SCOPE_TEST.equals(artifact.getScope())) {
+
+        for ( Iterator it = artifacts.iterator(); it.hasNext(); )
+        {
+            Artifact artifact = (Artifact) it.next();
+            if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() )
+                    && !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
+            {
                 String type = artifact.getType();
-                if ("jar".equals(type)) {
+
+                if ( "jar".equals( type ) )
+                {
                     File depFile = artifact.getFile();
-                    File outDir = new File(outputDirectory);
-                    try {
-                        FileUtils.copyFileToDirectory(depFile, outDir);
-                        if (bundleClasspath.length() == 0) bundleClasspath.append(".");
-                        bundleClasspath.append("," + artifact.getFile().getName());
-                    } catch (Exception e) {
-                        String errmsg = "Error copying " + depFile.getAbsolutePath() + " to " + outDir.getAbsolutePath();
-                        throw new MojoExecutionException(errmsg, e);
+
+                    try
+                    {
+                        FileUtils.copyFileToDirectory( depFile, outputDirectory );
+
+                        if ( bundleClasspath.length() == 0 )
+                        {
+                            bundleClasspath.append( "." );
+                        }
+
+                        bundleClasspath.append( "," + artifact.getFile().getName() );
+                    }
+                    catch ( Exception e )
+                    {
+                        String errmsg = "Error copying " + depFile.getAbsolutePath() + " to "
+                                + outputDirectory.getAbsolutePath();
+                        throw new MojoExecutionException( errmsg, e );
                     }
                 }
             }
         }
-        if (bundleClasspath.length() != 0) {
-            archive.addManifestEntry("Bundle-ClassPath", bundleClasspath.toString());
-        }
-        bundleClasspath = null;
 
-        // auto-set the bundle version...
-        archive.addManifestEntry("Bundle-Version", project.getVersion());
+        String finalPath = bundleClasspath.toString();
 
-        // create the target bundle archive...
-        try {
-            File contentDirectory = new File(outputDirectory);
-            if (!contentDirectory.exists()) {
-                getLog().warn("Bundle archive JAR will be empty -- no content was marked for inclusion!");
-            } else {
-                archiver.getArchiver().addDirectory(contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES);
-            }
-            archiver.createArchive(project, archive);
-        } catch (Exception e) {
-            // TODO: improve error handling
-            throw new MojoExecutionException("Error assembling Bundle archive JAR", e);
+        if ( finalPath.length() != 0 )
+        {
+            archiveConfig.addManifestEntry( "Bundle-Classpath", finalPath );
         }
     }
+
+    /**
+     * Auto-set the bundle version.
+     */
+    private void addBundleVersion()
+    {
+        archiveConfig.addManifestEntry( "Bundle-Version", project.getVersion() );
+    }
+
+    /**
+     * Returns a string array of the includes to be used when assembling/copying the war.
+     *
+     * @return an array of tokens to include
+     */
+    private String[] getIncludes()
+    {
+        return new String[] { jarSourceIncludes };
+    }
+
+    /**
+     * Returns a string array of the excludes to be used when assembling/copying the jar.
+     *
+     * @return an array of tokens to exclude
+     */
+    private String[] getExcludes()
+    {
+        List excludeList = new ArrayList( FileUtils.getDefaultExcludesAsList() );
+
+        if ( jarSourceExcludes != null && !"".equals( jarSourceExcludes ) )
+        {
+            excludeList.add( jarSourceExcludes );
+        }
+
+        return (String[]) excludeList.toArray( EMPTY_STRING_ARRAY );
+    }
 }
diff --git a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiManifest.java b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiManifest.java
index 5a8e299..a0abd55 100644
--- a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiManifest.java
+++ b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiManifest.java
@@ -14,207 +14,251 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.felix.tools.maven.plugin;
 
+import java.util.HashMap;
 import java.util.Map;
-import java.util.Hashtable;
 
 /**
- * Created by IntelliJ IDEA.
- * User: tbennett
- * Date: Aug 12, 2005
- * Time: 4:03:29 PM
- * To change this template use File | Settings | File Templates.
+ * Hold values for an OSGi jar "bundle" manifest.
+ * 
+ * @author <a href="mailto:felix-dev@incubator.apache.org">Apache Felix Project</a>
+ * @version $Rev$, $Date$
  */
-public class OsgiManifest {
+public class OsgiManifest
+{
     private String bundleActivator;
     private String bundleName;
     private String bundleDescription;
     private String bundleVendor;
-    //private String bundleVersion;
-    //private String bundleClassPath;
     private String bundleDate;
     private String bundleUpdateLocation;
     private String bundleSymbolicName;
-	private String bundleDocUrl;
-	private String bundleCategory;
-	private String exportService;
+    private String bundleDocUrl;
+    private String bundleCategory;
+    private String exportService;
     private String exportPackage;
     private String importPackage;
     private String metadataLocation;
-    private Hashtable entries = new Hashtable();
 
-    public Map getEntries() {
-        if (getBundleActivator() != null) {
-            entries.put("Bundle-Activator", getBundleActivator());
+    // private String bundleClasspath;
+
+    private Map entries = new HashMap();
+
+    public Map getEntries()
+    {
+        if ( getBundleActivator() != null )
+        {
+            entries.put( "Bundle-Activator", getBundleActivator() );
         }
-        if (getBundleName() != null) {
-            entries.put("Bundle-Name", getBundleName());
+
+        if ( getBundleName() != null )
+        {
+            entries.put( "Bundle-Name", getBundleName() );
         }
-        if (getBundleDescription() != null) {
-            entries.put("Bundle-Description", getBundleDescription());
+
+        if ( getBundleDescription() != null )
+        {
+            entries.put( "Bundle-Description", getBundleDescription() );
         }
-        if (getBundleVendor() != null) {
-            entries.put("Bundle-Vendor", getBundleVendor());
+
+        if ( getBundleVendor() != null )
+        {
+            entries.put( "Bundle-Vendor", getBundleVendor() );
         }
+
+        if ( getExportService() != null )
+        {
+            entries.put( "Export-Service", getExportService() );
+        }
+
+        if ( getExportPackage() != null )
+        {
+            entries.put( "Export-Package", getExportPackage() );
+        }
+
+        if ( getImportPackage() != null )
+        {
+            entries.put( "Import-Package", getImportPackage() );
+        }
+
         /*
-        if (getBundleVersion() != null) {
-            entries.put("Bundle-Version", getBundleVersion());
+         if (getBundleClassPath() != null) {
+         entries.put("Bundle-Classpath", getBundleClassPath());
+         }
+         */
+
+        if ( getBundleDate() != null )
+        {
+            entries.put( "Bundle-Date", getBundleDate() );
         }
-        */
-        if (getExportService() != null) {
-            entries.put("Export-Service", getExportService());
+
+        if ( getBundleUpdateLocation() != null )
+        {
+            entries.put( "Bundle-UpdateLocation", getBundleUpdateLocation() );
         }
-        if (getExportPackage() != null) {
-            entries.put("Export-Package", getExportPackage());
+
+        if ( getBundleSymbolicName() != null )
+        {
+            entries.put( "Bundle-SymbolicName", getBundleSymbolicName() );
         }
-        if (getImportPackage() != null) {
-            entries.put("Import-Package", getImportPackage());
+
+        if ( getMetadataLocation() != null )
+        {
+            entries.put( "Metadata-Location", getMetadataLocation() );
         }
-        /*
-        if (getBundleClassPath() != null) {
-            entries.put("Bundle-ClassPath", getBundleClassPath());
+
+        if ( getBundleCategory() != null )
+        {
+            entries.put( "Bundle-Category", getBundleCategory() );
         }
-        */
-        if (getBundleDate() != null) {
-            entries.put("Bundle-Date", getBundleDate());
+
+        if ( getBundleDocUrl() != null )
+        {
+            entries.put( "Bundle-DocUrl", getBundleDocUrl() );
         }
-        if (getBundleUpdateLocation() != null) {
-            entries.put("Bundle-UpdateLocation", getBundleUpdateLocation());
-        }
-        if (getBundleSymbolicName() != null) {
-            entries.put("Bundle-SymbolicName", getBundleSymbolicName());
-        }
-        if (getMetadataLocation() != null) {
-            entries.put("Metadata-Location", getMetadataLocation());
-        }
-		if (getBundleCategory() != null) {
-			entries.put("Bundle-Category", getBundleCategory());
-		}
-		if (getBundleDocUrl() != null) {
-			entries.put("Bundle-DocUrl", getBundleDocUrl());
-		}
-        return (Map) entries;
+
+        return entries;
     }
 
-    public String getBundleDocUrl() {
+    public String getBundleDocUrl()
+    {
         return bundleDocUrl;
     }
 
-    public void setBundleDocUrl(String bundleDocUrl) {
+    public void setBundleDocUrl( String bundleDocUrl )
+    {
         this.bundleDocUrl = bundleDocUrl;
     }
 
-    public String getBundleCategory() {
+    public String getBundleCategory()
+    {
         return bundleCategory;
     }
 
-    public void setBundleCategory(String bundleCategory) {
+    public void setBundleCategory( String bundleCategory )
+    {
         this.bundleCategory = bundleCategory;
     }
 
-    public String getBundleActivator() {
+    public String getBundleActivator()
+    {
         return bundleActivator;
     }
 
-    public void setBundleActivator(String bundleActivator) {
+    public void setBundleActivator( String bundleActivator )
+    {
         this.bundleActivator = bundleActivator;
     }
 
-    public String getBundleName() {
+    public String getBundleName()
+    {
         return bundleName;
     }
 
-    public void setBundleName(String bundleName) {
+    public void setBundleName( String bundleName )
+    {
         this.bundleName = bundleName;
     }
 
-    public String getBundleDescription() {
+    public String getBundleDescription()
+    {
         return bundleDescription;
     }
 
-    public void setBundleDescription(String bundleDescription) {
+    public void setBundleDescription( String bundleDescription )
+    {
         this.bundleDescription = bundleDescription;
     }
 
-    public String getBundleVendor() {
+    public String getBundleVendor()
+    {
         return bundleVendor;
     }
 
-    public void setBundleVendor(String bundleVendor) {
+    public void setBundleVendor( String bundleVendor )
+    {
         this.bundleVendor = bundleVendor;
     }
-/*
-    public String getBundleVersion() {
-        return bundleVersion;
-    }
 
-    public void setBundleVersion(String bundleVersion) {
-        this.bundleVersion = bundleVersion;
-    }
-*/
-    public String getExportService() {
+    public String getExportService()
+    {
         return exportService;
     }
 
-    public void setExportService(String exportService) {
+    public void setExportService( String exportService )
+    {
         this.exportService = exportService;
     }
 
-    public String getExportPackage() {
+    public String getExportPackage()
+    {
         return exportPackage;
     }
 
-    public void setExportPackage(String exportPackage) {
+    public void setExportPackage( String exportPackage )
+    {
         this.exportPackage = exportPackage;
     }
 
-    public String getImportPackage() {
+    public String getImportPackage()
+    {
         return importPackage;
     }
 
-    public void setImportPackage(String importPackage) {
+    public void setImportPackage( String importPackage )
+    {
         this.importPackage = importPackage;
     }
 
-/*
-    public String getBundleClassPath() {
-        return bundleClassPath;
-    }
+    /*
+     public String getBundleClasspath() {
+     return bundleClasspath;
+     }
 
-    public void setBundleClassPath(String bundleClassPath) {
-        this.bundleClassPath = bundleClassPath;
-    }
-*/
-    public String getBundleDate() {
+     public void setBundleClasspath(String bundleClasspath) {
+     this.bundleClasspath = bundleClasspath;
+     }
+     */
+
+    public String getBundleDate()
+    {
         return bundleDate;
     }
 
-    public void setBundleDate(String bundleDate) {
+    public void setBundleDate( String bundleDate )
+    {
         this.bundleDate = bundleDate;
     }
 
-    public String getBundleUpdateLocation() {
+    public String getBundleUpdateLocation()
+    {
         return bundleUpdateLocation;
     }
 
-    public void setBundleUpdateLocation(String bundleUpdateLocation) {
+    public void setBundleUpdateLocation( String bundleUpdateLocation )
+    {
         this.bundleUpdateLocation = bundleUpdateLocation;
     }
 
-    public String getBundleSymbolicName() {
+    public String getBundleSymbolicName()
+    {
         return bundleSymbolicName;
     }
 
-    public void setBundleSymbolicName(String bundleSymbolicName) {
+    public void setBundleSymbolicName( String bundleSymbolicName )
+    {
         this.bundleSymbolicName = bundleSymbolicName;
     }
 
-    public String getMetadataLocation() {
+    public String getMetadataLocation()
+    {
         return metadataLocation;
     }
 
-    public void setMetadataLocation(String metadataLocation) {
+    public void setMetadataLocation( String metadataLocation )
+    {
         this.metadataLocation = metadataLocation;
     }
 }
diff --git a/tools/maven2/maven-osgi-plugin/src/main/resources/META-INF/plexus/components.xml b/tools/maven2/maven-osgi-plugin/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..db3c912
--- /dev/null
+++ b/tools/maven2/maven-osgi-plugin/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,40 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role-hint>osgi-bundle</role-hint>
+      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <!-- START SNIPPET: osgi-bundle-lifecycle -->
+            <phases>
+              <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+              <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+              <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+              <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+              <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+              <package>org.apache.maven.plugins:maven-osgi-plugin:osgi-bundle</package>
+              <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+              <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+            </phases>
+            <!-- END SNIPPET: osgi-bundle-lifecycle -->
+          </lifecycle>
+        </lifecycles>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+      <role-hint>osgi-bundle</role-hint>
+      <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+      <configuration>
+        <type>osgi-bundle</type>
+        <includesDependencies>true</includesDependencies>
+        <language>java</language>
+        <extension>jar</extension>
+        <addedToClasspath>true</addedToClasspath>
+      </configuration>
+    </component>
+  </components>
+</component-set>