| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| <section id="usage.maven"> |
| <title>Apache Maven Usage</title> |
| |
| <para>The Maven plugin allows Bundlor to be run from inside any Maven project.</para> |
| |
| <section id="usage.maven.setup"> |
| <title>Maven Setup</title> |
| <para> |
| The following procedure shows how to set up Bundlor inside of an existing Maven <literal>POM</literal> file. |
| </para> |
| |
| <orderedlist> |
| <listitem> |
| <para>Add the SpringSource Enterprise Bundle Repository to the <filename>pom.xml</filename> file.</para> |
| <programlisting language="xml"><pluginRepositories> |
| <pluginRepository> |
| <id>com.springsource.repository.bundles.@release.type@</id> |
| <name>SpringSource Enterprise Bundle Repository</name> |
| <url>http://repository.springsource.com/maven/bundles/@release.type@</url> |
| </pluginRepository> |
| ... |
| </pluginRepositories></programlisting> |
| </listitem> |
| <listitem> |
| <para> |
| Use the <literal>bundlor</literal> plugin, as shown in the following example. See |
| <xref linkend="usage.maven.reference"/> for details about the parameters of the plugin. |
| </para> |
| <programlisting language="xml"><build> |
| <plugins> |
| <plugin> |
| <groupId>org.eclipse.virgo.bundlor</groupId> |
| <artifactId>org.eclipse.virgo.bundlor.maven</artifactId> |
| <version>@bundle.version@</version> |
| <executions> |
| <execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| ... |
| </plugins> |
| ... |
| </build></programlisting> |
| </listitem> |
| </orderedlist> |
| </section> |
| |
| <section id="usage.maven.reference"> |
| <title>Maven Plugin Reference</title> |
| <section> |
| <title>Plugin Configuration</title> |
| <para> |
| The following table lists all the elements that you can specify for the <literal>bundlor</literal> |
| Maven plugin. |
| </para> |
| <table> |
| <title>Elements</title> |
| <tgroup cols="3"> |
| <thead> |
| <row> |
| <entry>Attribute</entry> |
| <entry>Description</entry> |
| <entry>Required</entry> |
| </row> |
| </thead> |
| <tbody> |
| <row> |
| <entry>bundleSymbolicName</entry> |
| <entry>The OSGi <literal>Bundle-SymbolicName</literal> for the resulting manifest</entry> |
| <entry>No - defaults to <literal>${project.artifactId}</literal></entry> |
| </row> |
| <row> |
| <entry>bundleVersion</entry> |
| <entry>The OSGi <literal>Bundle-Version</literal> for the resulting manifest</entry> |
| <entry>No - defaults to <literal>${project.version}</literal></entry> |
| </row> |
| <row> |
| <entry>enabled</entry> |
| <entry>Whether Bundlor should create a manifest</entry> |
| <entry>No - defaults to <literal>true</literal></entry> |
| </row> |
| <row> |
| <entry>failOnWarnings</entry> |
| <entry> |
| Whether Bundlor should cause a build failure when there are warnings warnings about the |
| resulting manifest |
| </entry> |
| <entry>No - defaults to <literal>false</literal></entry> |
| </row> |
| <row> |
| <entry>inputPath</entry> |
| <entry> |
| The path to the input to create a manifest for. This can either be a directory or a JAR |
| file. |
| </entry> |
| <entry>No - defaults to <literal>${project.build.outputDirectory}</literal></entry> |
| </row> |
| <row> |
| <entry>manifestTemplatePath</entry> |
| <entry> |
| The path to the manifest template. See <xref linkend="manifest.template"/> for details. |
| </entry> |
| <entry>No - defaults to <literal>${basedir}/template.mf</literal></entry> |
| </row> |
| <row> |
| <entry>osgiProfilePath</entry> |
| <entry> |
| The path to the OSGi profile. See <xref linkend="osgi.profile"/> for details. |
| </entry> |
| <entry>No</entry> |
| </row> |
| <row> |
| <entry>outputPath</entry> |
| <entry> |
| <para> |
| The path to write the manifest to. This can either be a directory, a JAR file, or |
| not specified. |
| </para> |
| <para> |
| If a directory is specified, the manifest will be written to |
| <literal>${directory}/META-INF/MANIFEST.MF</literal>. |
| </para> |
| <para> |
| If a JAR file is specified, the manifest will be written as the manifest for that |
| JAR file. |
| </para> |
| </entry> |
| <entry>No - defaults to <literal>${project.build.outputDirectory}</literal></entry> |
| </row> |
| <row> |
| <entry>propertiesPath</entry> |
| <entry> |
| The path to a properties file used for substitution. See |
| <xref linkend="manifest.template.property"/> for details. |
| </entry> |
| <entry>No</entry> |
| </row> |
| </tbody> |
| </tgroup> |
| </table> |
| </section> |
| |
| <section> |
| <title>Inline Manifest Template</title> |
| <para> |
| Manifest templates can be optionally specified inline instead of as an external file using the |
| <literal><manifestTemplate/></literal> element. |
| </para> |
| <programlisting language="xml"><execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| <configuration> |
| <manifestTemplate> |
| Bundle-ManifestVersion: 2 |
| Bundle-Name: Bundlor Core |
| Bundle-Vendor: SpringSource Inc. |
| Bundle-SymbolicName: org.eclipse.virgo.bundlor |
| Bundle-Version: 0 |
| </manifestTemplate> |
| </configuration> |
| </execution></programlisting> |
| <para>See <xref linkend="manifest.template"/> for details.</para> |
| </section> |
| |
| <section> |
| <title>Inline OSGi Profile</title> |
| <para> |
| OSGI profiles can be optionally specified inline instead of as an external file using the |
| <literal><osgiProfile/></literal> element. |
| </para> |
| <programlisting language="xml"><execution> |
| <id>bundlor</id> |
| <goals> |
| <goal>bundlor</goal> |
| </goals> |
| <configuration> |
| <osgiProfile> |
| org.osgi.framework.system.packages = \ |
| javax.accessibility,\ |
| javax.activation,\ |
| javax.activation;version="1.1.0",\ |
| javax.activity,\ |
| javax.annotation,\ |
| ... |
| |
| org.osgi.framework.bootdelegation = \ |
| com_cenqua_clover,\ |
| com.cenqua.*,\ |
| com.yourkit.*,\ |
| ... |
| </osgiProfile> |
| </configuration> |
| </execution></programlisting> |
| <para>See <xref linkend="osgi.profile"/> for details.</para> |
| </section> |
| |
| <section> |
| <title>Inline Property Values</title> |
| <para> |
| Property substitution values can be optionally specified inline instead of as an external file using the |
| <literal><properties/></literal> element. |
| </para> |
| <programlisting language="xml"><project> |
| ... |
| <properties> |
| <bundle.name>${project.name}</bundle.name> |
| <bundle.version>2.0.0.RELEASE</bundle.version> |
| </properties> |
| ... |
| </project></programlisting> |
| <para>See <xref linkend="manifest.template.property"/> for details.</para> |
| </section> |
| </section> |
| |
| <section id="usage.maven.example"> |
| <title>Maven Plugin Examples</title> |
| <section> |
| <title>Creating a manifest</title> |
| <programlisting language="xml"><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></programlisting> |
| </section> |
| |
| <section> |
| <title>Creating a manifest with placeholder replacement</title> |
| <programlisting language="xml"><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></programlisting> |
| </section> |
| </section> |
| </section> |