blob: afb8cb68d9c9ebc33a807e19601a5298adeab5e9 [file] [log] [blame]
<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&nbsp;4.&nbsp;Usage"><link rel="prev" href="ch04s02.html" title="Apache ANT Usage"><link rel="next" href="ch05.html" title="Chapter&nbsp;5.&nbsp;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>&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;<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">&lt;pluginRepositories&gt;
&lt;pluginRepository&gt;
&lt;id&gt;eclipse.virgo.build.bundles.@release.type@&lt;/id&gt;
&lt;name&gt;Eclipse Virgo Build&lt;/name&gt;
&lt;url&gt;http://build.eclipse.org/rt/virgo/maven/bundles/@release.type@&lt;/url&gt;
&lt;/pluginRepository&gt;
&lt;pluginRepository&gt;
&lt;id&gt;com.springsource.repository.bundles.external&lt;/id&gt;
&lt;name&gt;SpringSource Enterprise Bundle Repository - External Bundle Releases&lt;/name&gt;
&lt;url&gt;http://repository.springsource.com/maven/bundles/external&lt;/url&gt;
&lt;/pluginRepository&gt;
...
&lt;/pluginRepositories&gt;</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">&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.eclipse.virgo.bundlor&lt;/groupId&gt;
&lt;artifactId&gt;org.eclipse.virgo.bundlor.maven&lt;/artifactId&gt;
&lt;version&gt;3.5.0&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;bundlor&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;bundlor&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
&lt;version&gt;2.4&lt;/version&gt;
&lt;configuration&gt;
&lt;archive&gt;
&lt;manifestFile&gt;
target/classes/META-INF/MANIFEST.MF
&lt;/manifestFile&gt;
&lt;/archive&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
...
&lt;/plugins&gt;
...
&lt;/build&gt;</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&nbsp;4.3.&nbsp;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&nbsp;5.&nbsp;Manifest Templates">Chapter&nbsp;5.&nbsp;<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&nbsp;6.&nbsp;OSGi Profiles and Bundlor">Chapter&nbsp;6.&nbsp;<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">&lt;manifestTemplate/&gt;</code> element.
</p><pre class="programlisting">&lt;execution&gt;
&lt;id&gt;bundlor&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;bundlor&lt;/goal&gt;
&lt;/goals&gt;
&lt;configuration&gt;
&lt;manifestTemplate&gt;
Bundle-ManifestVersion: 2
Bundle-Name: Bundlor Core
Bundle-SymbolicName: org.eclipse.virgo.bundlor
Bundle-Version: 0
&lt;/manifestTemplate&gt;
&lt;/configuration&gt;
&lt;/execution&gt;</pre><p>See <a class="xref" href="ch05.html" title="Chapter&nbsp;5.&nbsp;Manifest Templates">Chapter&nbsp;5.&nbsp;<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">&lt;OSGiProfile/&gt;</code> element.
</p><pre class="programlisting">&lt;execution&gt;
&lt;id&gt;bundlor&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;bundlor&lt;/goal&gt;
&lt;/goals&gt;
&lt;configuration&gt;
&lt;OSGiProfile&gt;
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.*,\
...
&lt;/OSGiProfile&gt;
&lt;/configuration&gt;
&lt;/execution&gt;</pre><p>See <a class="xref" href="ch06.html" title="Chapter&nbsp;6.&nbsp;OSGi Profiles and Bundlor">Chapter&nbsp;6.&nbsp;<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">&lt;properties/&gt;</code> element.
</p><pre class="programlisting">&lt;project&gt;
...
&lt;properties&gt;
&lt;bundle.name&gt;${project.name}&lt;/bundle.name&gt;
&lt;bundle.version&gt;2.0.0.RELEASE&lt;/bundle.version&gt;
&lt;/properties&gt;
...
&lt;/project&gt;</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">&lt;project&gt;
...
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.eclipse.virgo.bundlor&lt;/groupId&gt;
&lt;artifactId&gt;org.eclipse.virgo.bundlor.maven&lt;/artifactId&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;bundlor&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;bundlor&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
...
&lt;/project&gt;</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">&lt;project&gt;
...
&lt;properties&gt;
&lt;bundle.name&gt;${project.name}&lt;/bundle.name&gt;
&lt;bundle.version&gt;2.0.0.RELEASE&lt;/bundle.version&gt;
&lt;/properties&gt;
...
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.eclipse.virgo.bundlor&lt;/groupId&gt;
&lt;artifactId&gt;org.eclipse.virgo.bundlor.maven&lt;/artifactId&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;bundlor&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;bundlor&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
...
&lt;/project&gt;</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>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="ch04.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="ch05.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;</td></tr></table></div></body></html>