Usage

Overview

<?xml version="1.0" encoding="UTF-8"?>
<project>

  ...
  
  <packaging>deployment-package</packaging>
  
  ...
  
  <build>
    <plugins>
      <plugin>
        <groupId>net.sourceforge.mvn-dp-plugin</groupId>
        <artifactId>osgi-deployment-maven-plugin</artifactId>
        <version>PLUGIN_VERSION</version>
        <extensions>true</extensions>       
        <configuration>
          <deploymentPackage>
          
            ...
            
          </deploymentPackage>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
mvn osgi-deployment:package

Resources

Bundle-Resources

Processed-Resources

Localization-Resources

Overwriting standard Headers

Customizer

Processors

Fix-Packs

Changing target paths

By default all resources are placed in the root of the resulting Deployment-Package. To specify an alternative path you place a targetPath element to a bundleResource or a processedResource element.

...
<plugin>
  <groupId>net.sourceforge.mvn-dp-plugin</groupId>
  <artifactId>osgi-deployment-maven-plugin</artifactId>
  <version>PLUGIN_VERSION</version>
  ...         
  <configuration>
    <deploymentPackage>
      <bundleResource>
        <groupId>foo.bar</groupId>
        <artifactId>bar</artifactId>
        <version>0.0.1</version>
        <targetPath>bundles</targetPath>
      </bundleResource>
      <processedResource>
        <filePath>readme.not</filePath>
        <processor>foo</processor>
        <targetPath>resources</targetPath>
      </processedResource>
    </deploymentPackage>
  </configuration>
</plugin>

The resulting Deployment-Package would then look like:

   YOUR_DEPLOYMENT_PACKAGE-VERSION.dp
     +- bundles
     |  +- foo.bar.bar-0.0.1.jar
     +- resources
     |  +- readme.not
     +- META-INF
     |  +- MENIFEST.MF
     |

Extra data in manifest

By default the manifest file of the resulting Deployment-Package contains some extra data entries. Here is an example:

...
Created-By: 1.6.0_04 (Sun Microsystems Inc.)
Tool: osgi-deployment-maven-plugin 0.1.3
Created-At: 1206459281219
...

You can disable this feature by adding a configuration element writeExtraData

...
<plugin>
  <groupId>net.sourceforge.mvn-dp-plugin</groupId>
  <artifactId>osgi-deployment-maven-plugin</artifactId>
  <version>PLUGIN_VERSION</version>
  ...         
  <configuration>
    <writeExtraData>false</writeExtraData>
    ...
  </configuration>
</plugin>