| <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Apache Maven Usage</title><meta content="DocBook XSL Stylesheets V1.76.0" name="generator"><link rel="home" href="index.html" title="Bundlor User Guide"><link rel="up" href="ch04.html" title="Chapter 4. Usage"><link rel="prev" href="ch04s02.html" title="Apache ANT Usage"><link rel="next" href="ch05.html" title="Chapter 5. Manifest Templates"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><td align="left" width="20%"><a accesskey="p" href="ch04s02.html">Prev</a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr></div><div class="section" title="Apache Maven Usage"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="usage.maven"></a>Apache Maven Usage</h2></div></div></div><p>The Maven plugin allows Bundlor to be run from inside any Maven project.</p><div class="section" title="Maven Setup"><div class="titlepage"><div><div><h3 class="title"><a name="usage.maven.setup"></a>Maven Setup</h3></div></div></div><p> |
| The following procedure shows how to set up Bundlor inside of an existing Maven <code class="literal">POM</code> file. |
| </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Add the Eclipse Virgo build and SpringSource Enterprise Bundle Repository to the <code class="filename">pom.xml</code> file.</p><pre class="programlisting"><pluginRepositories> |
| <pluginRepository> |
| <id>eclipse.virgo.build.bundles.@release.type@</id> |
| <name>Eclipse Virgo Build</name> |
| <url>http://build.eclipse.org/rt/virgo/maven/bundles/@release.type@</url> |
| </pluginRepository> |
| <pluginRepository> |
| <id>com.springsource.repository.bundles.external</id> |
| <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name> |
| <url>http://repository.springsource.com/maven/bundles/external</url> |
| </pluginRepository> |
| ... |
| </pluginRepositories></pre></li><li class="listitem"><p> |
| Use the <code class="literal">bundlor</code> plugin, as shown in the following example. See |
| <a class="xref" href="ch04s03.html#usage.maven.reference" title="Maven Plugin Reference">Maven Plugin Reference</a> for details about the parameters of the plugin. |
| </p><pre class="programlisting"><build> |
| <plugins> |
| <plugin> |
| <groupId>org.eclipse.virgo.bundlor</groupId> |
| <artifactId>org.eclipse.virgo.bundlor.maven</artifactId> |
| <version>3.5.0</version> |
| <executions> |
| <execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-jar-plugin</artifactId> |
| <version>2.4</version> |
| <configuration> |
| <archive> |
| <manifestFile> |
| target/classes/META-INF/MANIFEST.MF |
| </manifestFile> |
| </archive> |
| </configuration> |
| </plugin> |
| ... |
| </plugins> |
| ... |
| </build></pre></li></ol></div></div><div class="section" title="Maven Plugin Reference"><div class="titlepage"><div><div><h3 class="title"><a name="usage.maven.reference"></a>Maven Plugin Reference</h3></div></div></div><div class="section" title="Plugin Configuration"><div class="titlepage"><div><div><h4 class="title"><a name="N102FF"></a>Plugin Configuration</h4></div></div></div><p> |
| The following table lists all the elements that you can specify for the <code class="literal">bundlor</code> |
| Maven plugin. |
| </p><div class="table"><a name="N10308"></a><p class="title"><b>Table 4.3. Elements</b></p><div class="table-contents"><table summary="Elements" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>bundleSymbolicName</td><td>The OSGi <code class="literal">Bundle-SymbolicName</code> for the resulting manifest</td><td>No - defaults to <code class="literal">${project.artifactId}</code></td></tr><tr><td>bundleVersion</td><td>The OSGi <code class="literal">Bundle-Version</code> for the resulting manifest</td><td>No - defaults to <code class="literal">${project.version}</code></td></tr><tr><td>enabled</td><td>Whether Bundlor should create a manifest</td><td>No - defaults to <code class="literal">true</code></td></tr><tr><td>failOnWarnings</td><td> |
| Whether Bundlor should cause a build failure when there are warnings about the |
| resulting manifest |
| </td><td>No - defaults to <code class="literal">false</code></td></tr><tr><td>inputPath</td><td> |
| The path to the input to create a manifest for. This can either be a directory or a JAR |
| file. |
| </td><td>No - defaults to <code class="literal">${project.build.outputDirectory}</code></td></tr><tr><td>manifestTemplatePath</td><td> |
| The path to the manifest template. See <a class="xref" href="ch05.html" title="Chapter 5. Manifest Templates">Chapter 5. <i>Manifest Templates</i></a> for details. |
| </td><td>No - defaults to <code class="literal">${basedir}/template.mf</code></td></tr><tr><td>OSGiProfilePath</td><td> |
| The path to the OSGi profile. See <a class="xref" href="ch06.html" title="Chapter 6. OSGi Profiles and Bundlor">Chapter 6. <i>OSGi Profiles and Bundlor</i></a> for details. |
| </td><td>No</td></tr><tr><td>outputPath</td><td> |
| <p> |
| The path to write the manifest to. This can either be a directory, a JAR file, or |
| not specified. |
| </p> |
| <p> |
| If a directory is specified, the manifest will be written to |
| <code class="literal">${directory}/META-INF/MANIFEST.MF</code>. |
| </p> |
| <p> |
| If a JAR file is specified, the manifest will be written as the manifest for that |
| JAR file. |
| </p> |
| </td><td>No - defaults to <code class="literal">${project.build.outputDirectory}</code></td></tr><tr><td>propertiesPath</td><td> |
| The path to a properties file used for substitution. See |
| <a class="xref" href="ch05s03.html" title="Specifying property placeholders">Specifying property placeholders</a> for details. |
| </td><td>No</td></tr></tbody></table></div></div><br class="table-break"></div><div class="section" title="Inline Manifest Template"><div class="titlepage"><div><div><h4 class="title"><a name="N10388"></a>Inline Manifest Template</h4></div></div></div><p> |
| Manifest templates can be optionally specified inline instead of as an external file using the |
| <code class="literal"><manifestTemplate/></code> element. |
| </p><pre class="programlisting"><execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| <configuration> |
| <manifestTemplate> |
| Bundle-ManifestVersion: 2 |
| Bundle-Name: Bundlor Core |
| Bundle-SymbolicName: org.eclipse.virgo.bundlor |
| Bundle-Version: 0 |
| </manifestTemplate> |
| </configuration> |
| </execution></pre><p>See <a class="xref" href="ch05.html" title="Chapter 5. Manifest Templates">Chapter 5. <i>Manifest Templates</i></a> for details.</p></div><div class="section" title="Inline OSGi Profile"><div class="titlepage"><div><div><h4 class="title"><a name="N1039A"></a>Inline OSGi Profile</h4></div></div></div><p> |
| OSGi profiles can be optionally specified inline instead of as an external file using the |
| <code class="literal"><OSGiProfile/></code> element. |
| </p><pre class="programlisting"><execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| <configuration> |
| <OSGiProfile> |
| org.OSGi.framework.system.packages = \ |
| org.eclipse.virgo.osgi.extensions.equinox.hooks,\ |
| javax.accessibility,\ |
| javax.activation,\ |
| javax.activation;version="1.1.1",\ |
| javax.activity,\ |
| javax.annotation,\ |
| ... |
| |
| org.OSGi.framework.bootdelegation = \ |
| org.eclipse.virgo.kernel.authentication,\ |
| com.sun.*,\ |
| javax.xml.*,\ |
| ... |
| </OSGiProfile> |
| </configuration> |
| </execution></pre><p>See <a class="xref" href="ch06.html" title="Chapter 6. OSGi Profiles and Bundlor">Chapter 6. <i>OSGi Profiles and Bundlor</i></a> for details.</p></div><div class="section" title="Inline Property Values"><div class="titlepage"><div><div><h4 class="title"><a name="N103AC"></a>Inline Property Values</h4></div></div></div><p> |
| Property substitution values can be optionally specified inline instead of as an external file using the |
| <code class="literal"><properties/></code> element. |
| </p><pre class="programlisting"><project> |
| ... |
| <properties> |
| <bundle.name>${project.name}</bundle.name> |
| <bundle.version>2.0.0.RELEASE</bundle.version> |
| </properties> |
| ... |
| </project></pre><p>See <a class="xref" href="ch05s03.html" title="Specifying property placeholders">Specifying property placeholders</a> for details.</p></div></div><div class="section" title="Maven Plugin Examples"><div class="titlepage"><div><div><h3 class="title"><a name="usage.maven.example"></a>Maven Plugin Examples</h3></div></div></div><div class="section" title="Creating a manifest"><div class="titlepage"><div><div><h4 class="title"><a name="N103C2"></a>Creating a manifest</h4></div></div></div><pre class="programlisting"><project> |
| ... |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.eclipse.virgo.bundlor</groupId> |
| <artifactId>org.eclipse.virgo.bundlor.maven</artifactId> |
| <executions> |
| <execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| ... |
| </project></pre></div><div class="section" title="Creating a manifest with placeholder replacement"><div class="titlepage"><div><div><h4 class="title"><a name="N103C9"></a>Creating a manifest with placeholder replacement</h4></div></div></div><pre class="programlisting"><project> |
| ... |
| <properties> |
| <bundle.name>${project.name}</bundle.name> |
| <bundle.version>2.0.0.RELEASE</bundle.version> |
| </properties> |
| ... |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.eclipse.virgo.bundlor</groupId> |
| <artifactId>org.eclipse.virgo.bundlor.maven</artifactId> |
| <executions> |
| <execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| ... |
| </project></pre></div></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch04s02.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="ch04.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="ch05.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%"> </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> </td></tr></table></div></body></html> |