| <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Maven plugin</title><meta content="DocBook XSL Stylesheets V1.76.0" name="generator"><link rel="home" href="index.html" title="Virgo Tools Guide"><link rel="up" href="ch11.html" title="Chapter 11. Installation and Release Notes"><link rel="prev" href="ch11s03.html" title="Known Issues"><link rel="next" href="ch11s05.html" title="Importing Virgo Projects into Eclipse"></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="ch11s03.html">Prev</a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="ch11s05.html">Next</a></td></tr></table><hr></div><div class="section" title="Maven plugin"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Maven_plugin"></a>Maven plugin</h2></div></div></div><p>To support the development of OSGi bundles for Eclipse Virgo with Maven a Maven plugin is available. This plugin is able to start/stop a local Eclipse Virgo instance. Moreover it is possible to deploy/undeploy/refresh bundles via Maven. </p><div class="section" title="Build"><div class="titlepage"><div><div><h3 class="title"><a name="Build"></a>Build</h3></div></div></div><p>In order to use the plugin one has to download the source code from |
| <a class="ulink" href="https://github.com/frieder/virgo-maven-plugin" target="_top">Github</a>&nbsp;and build the binary manually. This can be easily done by executing the following Maven command in the root folder of the plugin where the pom.xml file is located. |
| < pre>mvn clean install</pre> |
| Moreover to generate the documentation just execute the following Maven command (or take the one provided in the repository on Github). |
| < pre>mvn clean&nbsp;plugin:xdoc javadoc:javadoc jxr:jxr site |
| < /pre> |
| </p></div><div class="section" title="Goals"><div class="titlepage"><div><div><h3 class="title"><a name="Goals"></a>Goals</h3></div></div></div><p>The plugin provides a set of Maven goals that allow different actions. </p><table id="N10586"><tr> |
| <td> |
| <span class="bold"><strong>Goal</strong></span> |
| </td> |
| <td> |
| <span class="bold"><strong>Description</strong></span> |
| </td> |
| </tr><tr> |
| <td><code>virgo:start</code> </td> |
| <td>Starts a Virgo instance by executing the provided startup script. <br> </td> |
| </tr><tr> |
| <td><code>virgo:shutdown</code> </td> |
| <td>Stops a running Virgo instance.</td> |
| </tr><tr> |
| <td><code>virgo:immediateShutdown</code> </td> |
| <td>Stops a running Virgo instance immediately.</td> |
| </tr><tr> |
| <td><code>virgo:deploy</code> </td> |
| <td>Deploys an OSGi bundle to a running Virgo instance.</td> |
| </tr><tr> |
| <td><code>virgo:undeploy</code> </td> |
| <td>Undeploys an OSGi bundle from a running Virgo instance.</td> |
| </tr><tr> |
| <td><code>virgo:refresh</code> </td> |
| <td>Refreshs an already installed module on a running Virgo instance.</td> |
| </tr><tr> |
| <td><code>virgo:bundleRefresh</code> </td> |
| <td>Refreshs an already installed OSGi bundle on a running Virgo instance.</td> |
| </tr></table></div><div class="section" title="Simple example POM"><div class="titlepage"><div><div><h3 class="title"><a name="Simple_example_POM"></a>Simple example POM</h3></div></div></div><p>Once the plugin has been build and installed in the local Maven repository it can be used within a Maven project. Following is a simple example of a pom file that uses the Maven plugin.&nbsp; |
| < pre>&lt;project xmlns=" |
| <a class="ulink" href="http://maven.apache.org/POM/4.0.0&quot" target="_top">http://maven.apache.org/POM/4.0.0&quot</a>; xmlns:xsi=" |
| <a class="ulink" href="http://www.w3.org/2001/XMLSchema-instance&quot" target="_top">http://www.w3.org/2001/XMLSchema-instance&quot</a>; |
| xsi:schemaLocation=" |
| <a class="ulink" href="http://maven.apache.org/POM/4.0.0" target="_top">http://maven.apache.org/POM/4.0.0</a> |
| <a class="ulink" href="http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&amp;gt" target="_top">http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&amp;gt</a>; |
| &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; |
| &lt;groupId&gt;org.example.osgi&lt;/groupId&gt; |
| &lt;artifactId&gt;test-bundle&lt;/artifactId&gt; |
| &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; |
| &lt;packaging&gt;bundle&lt;/packaging&gt; |
| &lt;name&gt;OSGi Test Bundle&lt;/name&gt; |
| &lt;properties&gt; |
| &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; |
| &lt;/properties&gt; |
| &lt;build&gt; |
| &lt;plugins&gt; |
| &lt;plugin&gt; |
| &lt;groupId&gt;org.apache.felix&lt;/groupId&gt; |
| &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt; |
| &lt;version&gt;2.3.6&lt;/version&gt; |
| &lt;extensions&gt;true&lt;/extensions&gt; |
| &lt;configuration&gt; |
| &lt;instructions&gt; |
| &lt;Bundle-SymbolicName&gt;${project.groupId}.${project.artifactId}&lt;/Bundle-SymbolicName&gt; |
| &lt;Bundle-Name&gt;${project.name}&lt;/Bundle-Name&gt; |
| &lt;Bundle-Version&gt;${project.version}&lt;/Bundle-Version&gt; |
| &lt;/instructions&gt; |
| &lt;/configuration&gt; |
| &lt;/plugin&gt; |
| &lt;plugin&gt; |
| &lt;groupId&gt;net.flybyte.virgo&lt;/groupId&gt; |
| &lt;artifactId&gt;virgo-maven-plugin&lt;/artifactId&gt; |
| &lt;version&gt;1.0.0&lt;/version&gt; |
| &lt;configuration&gt; |
| &lt;virgoRoot&gt;C:/Java/virgo-tomcat-server-3.0.2.RELEASE&lt;/virgoRoot&gt; |
| &lt;/configuration&gt; |
| &lt;/plugin&gt; |
| &lt;/plugins&gt; |
| &lt;/build&gt; |
| & lt;/project&gt; |
| < /pre> |
| More examples can be found in the documentation. Following are some exemplary Maven commands. |
| < pre>mvn virgo:start &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;-- will start a Virgo instance |
| mvn clean package virgo:deploy &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;-- will create an artifact and deploy it to Virgo</pre> |
| </p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch11s03.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="ch11.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="ch11s05.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> |