blob: b2179b572bd56f797e8712e79ccad4810ea609c1 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>11.4&nbsp;Maven plugin</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo Tools Guide"><link rel="up" href="ch11.html" title="11.&nbsp;Installation and Release Notes"><link rel="prev" href="ch11s03.html" title="11.3&nbsp;Known Issues"><link rel="next" href="ch11s05.html" title="11.5&nbsp;Importing Virgo Projects into Eclipse"><!--Begin Google Analytics code--><script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2728886-3");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">11.4&nbsp;Maven plugin</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">11.&nbsp;Installation and Release Notes</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch11s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Maven_plugin"></a>11.4&nbsp;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" lang="en"><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>&amp;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.
&lt; pre&gt;mvn clean install&lt;/pre&gt;
Moreover to generate the documentation just execute the following Maven command (or take the one provided in the repository on Github).
&lt; pre&gt;mvn clean&amp;nbsp;plugin:xdoc javadoc:javadoc jxr:jxr site
&lt; /pre&gt;
</p></div><div class="section" lang="en"><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><tr>
<td rowspan="1" colspan="1">
<span class="bold"><strong>Goal</strong></span>
</td>
<td rowspan="1" colspan="1">
<span class="bold"><strong>Description</strong></span>
</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:start&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Starts a Virgo instance by executing the provided startup script. &lt;br&gt; </td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:shutdown&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Stops a running Virgo instance.</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:immediateShutdown&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Stops a running Virgo instance immediately.</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:deploy&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Deploys an OSGi bundle to a running Virgo instance.</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:undeploy&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Undeploys an OSGi bundle from a running Virgo instance.</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:refresh&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Refreshs an already installed module on a running Virgo instance.</td>
</tr><tr>
<td rowspan="1" colspan="1">&lt;code&gt;virgo:bundleRefresh&lt;/code&gt; </td>
<td rowspan="1" colspan="1">Refreshs an already installed OSGi bundle on a running Virgo instance.</td>
</tr></table></div><div class="section" lang="en"><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.&amp;nbsp;
&lt; pre&gt;&amp;lt;project xmlns="
<a class="ulink" href="http://maven.apache.org/POM/4.0.0&amp;quot" target="_top">http://maven.apache.org/POM/4.0.0&amp;quot</a>; xmlns:xsi="
<a class="ulink" href="http://www.w3.org/2001/XMLSchema-instance&amp;quot" target="_top">http://www.w3.org/2001/XMLSchema-instance&amp;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&amp;quot;&amp;amp;gt" target="_top">http://maven.apache.org/xsd/maven-4.0.0.xsd&amp;quot;&amp;amp;gt</a>;
&amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
&amp;lt;groupId&amp;gt;org.example.osgi&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;test-bundle&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;0.0.1-SNAPSHOT&amp;lt;/version&amp;gt;
&amp;lt;packaging&amp;gt;bundle&amp;lt;/packaging&amp;gt;
&amp;lt;name&amp;gt;OSGi Test Bundle&amp;lt;/name&amp;gt;
&amp;lt;properties&amp;gt;
&amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt;
&amp;lt;/properties&amp;gt;
&amp;lt;build&amp;gt;
&amp;lt;plugins&amp;gt;
&amp;lt;plugin&amp;gt;
&amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;2.3.6&amp;lt;/version&amp;gt;
&amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
&amp;lt;configuration&amp;gt;
&amp;lt;instructions&amp;gt;
&amp;lt;Bundle-SymbolicName&amp;gt;${project.groupId}.${project.artifactId}&amp;lt;/Bundle-SymbolicName&amp;gt;
&amp;lt;Bundle-Name&amp;gt;${project.name}&amp;lt;/Bundle-Name&amp;gt;
&amp;lt;Bundle-Version&amp;gt;${project.version}&amp;lt;/Bundle-Version&amp;gt;
&amp;lt;/instructions&amp;gt;
&amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;plugin&amp;gt;
&amp;lt;groupId&amp;gt;net.flybyte.virgo&amp;lt;/groupId&amp;gt;
&amp;lt;artifactId&amp;gt;virgo-maven-plugin&amp;lt;/artifactId&amp;gt;
&amp;lt;version&amp;gt;1.0.0&amp;lt;/version&amp;gt;
&amp;lt;configuration&amp;gt;
&amp;lt;virgoRoot&amp;gt;C:/Java/virgo-tomcat-server-3.0.2.RELEASE&amp;lt;/virgoRoot&amp;gt;
&amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;/plugins&amp;gt;
&amp;lt;/build&amp;gt;
&amp; lt;/project&amp;gt;
&lt; /pre&gt;
More examples can be found in the documentation. Following are some exemplary Maven commands.
&lt; pre&gt;mvn virgo:start &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;-- will start a Virgo instance
mvn clean package virgo:deploy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;-- will create an artifact and deploy it to Virgo&lt;/pre&gt;
</p></div></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript">
_lf_cid = "LF_48be82fa";
_lf_remora();
</script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch11s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11.3&nbsp;Known Issues&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;11.5&nbsp;Importing Virgo Projects into Eclipse</td></tr></table></div></body></html>