Manifest Goal Example Usage

In the project pom:

<build>
   <plugins>
      <plugin>
         <groupId>com.springsource.bundlor</groupId>
         <artifactId>com.springsource.bundlor.maven</artifactId>
         <version>${bundlor.version}</version>
         <executions>
            <execution>
               <id>bundlor</id>
               <!-- This isn't necessary, but Q4E barfs without it. -->
               <phase>package</phase>
               <goals>
                  <goal>manifest</goal>
               </goals>
            </execution>
         </executions>
      </plugin>
   </plugins>
</build>

In the template (default location template.mf ) you put whatever hints and overrides you need to make bundlor behave (see Bundlor docos for details). Typically you will need a bundle version and symbolic name, and some patterns for imports (missing in the example):

Bundle-Name: Test App
Bundle-Version: 1.0.0
Bundle-SymbolicName: test.app

When the jar artifact is created (mvn package ) a manifest is created from this template and placed in target/generated-resources/META-INF > (by default). It's contents depend on the bundle classes, and on the template. Here is a simple example:

Manifest-Version: 1.0
Bundle-Name: Test App
Archiver-Version: Plexus Archiver
Build-Jdk: 1.5.0_13
Built-By: dsyer
Created-By: Apache Maven
Bundle-ManifestVersion: 2
Bundle-SymbolicName: test.app
Export-Package: test.app;version="1.0.0"
Bundle-Version: 1.0.0

Configuration Options

The manifest goal supports a configuration option for the location of the generated pom file, e.g.

<build>
   <plugins>
      <plugin>
         <groupId>com.springsource.bundlor</groupId>
         <artifactId>com.springsource.bundlor.maven</artifactId>
         <executions>
            <execution>
               <id>bundlor</id>
               <phase>package</phase>
               <goals>
                  <goal>manifest</goal>
               </goals>
               <configuration>
                  <outputManifest>src/main/resources/META-INF/MANIFEST.MF</outputManifest>
               </configuration>
            </execution>
         </executions>
      </plugin>
   </plugins>
</build>

The example above puts the manifest in the "standard" location. This can be useful for testing in Eclipse using the Spring dm Server tooling. If you do this it is probably a good idea not to configure the Maven jar plugin to use this location as well (otherwise when the Bundlor plugin runs it will merge manifests, which means possible contamination with obsolete contents).

See the transform example for more details of configuration options.