| <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html><head><title>Apache Felix - Maven OBR Plugin</title> |
| |
| |
| |
| |
| <link rel="stylesheet" href="maven-obr-plugin_files/site.css" type="text/css" media="all"> |
| <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"></head><body> |
| <div class="title"><div class="logo"><a href="http://felix.apache.org/site/index.html"><img alt="Apache Felix" src="maven-obr-plugin_files/logo.png" border="0"></a></div><div class="header"><a href="http://www.apache.org/"><img alt="Apache" src="maven-obr-plugin_files/apache.png" border="0"></a></div></div> |
| <div class="menu"> |
| <ul> |
| <li><a href="http://felix.apache.org/site/index.html" title="Index">home</a></li> |
| <li><a href="http://felix.apache.org/site/news.html" title="news">news</a></li> |
| <li><a href="http://felix.apache.org/site/status.html" title="status">status</a></li> |
| <li><a href="http://felix.apache.org/site/license.html" title="license">license</a></li> |
| <li><span class="nobr"><a href="http://felix.apache.org/site/downloads.cgi">downloads<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li> |
| <li><a href="http://felix.apache.org/site/documentation.html" title="documentation">documentation</a></li> |
| <li><a href="http://felix.apache.org/site/mailinglists.html" title="mailinglists">mailing lists</a></li> |
| <li><span class="nobr"><a href="http://cwiki.apache.org/confluence/x/O-">wiki<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li> |
| <li><a href="http://felix.apache.org/site/committers.html" title="committers">committers</a></li> |
| <li><a href="http://felix.apache.org/site/faq.html" title="faq">faq</a></li> |
| <li><a href="http://felix.apache.org/site/roadmap.html" title="roadmap">roadmap</a></li> |
| <li><a href="http://felix.apache.org/site/sourcecode.html" title="sourcecode">source code</a></li> |
| <li><a href="http://felix.apache.org/site/codingstandards.html" title="codingstandards">coding standards</a></li> |
| <li><a href="http://felix.apache.org/site/issuetracking.html" title="issuetracking">issue tracking</a></li> |
| <li><a href="http://felix.apache.org/site/dependencies.html" title="dependencies">dependencies</a></li> |
| <li><span class="nobr"><a href="http://www.apache.org/">apache software foundation<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li> |
| <li><span class="nobr"><a href="http://www.apache.org/foundation/sponsorship.html">sponsorship<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li> |
| <li><span class="nobr"><a href="http://www.apache.org/foundation/thanks.html">sponsors<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span></li> |
| </ul> </div> |
| <div class="main"> |
| <p>This Maven plug-in aims to automate OBR (OSGi Bundle Repository) |
| management. It helps manage a local OBR for your local Maven |
| repository, and also supports remote OBRs for bundle distribution. The |
| plug-in automatically computes bundle capabilities and requirements, |
| using a combination of Bindex and Maven metadata.</p> |
| |
| <h2><a name="MavenOBRPlugin-Features"></a>Features</h2> |
| |
| <p>The maven-obr-plugin supports:</p> |
| |
| <ul> |
| <li>Management of both local and remote OBRs</li> |
| <li>Registering Maven and non-Maven artifacts with OBRs</li> |
| <li>Automatically discovering bundle capabilities and requirements</li> |
| <li>Customizing bundle descriptions</li> |
| </ul> |
| |
| |
| <h2><a name="MavenOBRPlugin-Howtousethemavenobrplugin?"></a>How to use the maven-obr-plugin?</h2> |
| |
| <p>The plug-in offers five Maven goals:</p> |
| |
| <ul> |
| <li><b>install</b> adds the current bundle project to the local OBR</li> |
| <li><b>install-file</b> adds a local bundle file to the local OBR</li> |
| <li><b>deploy</b> adds the current bundle project to a remote OBR</li> |
| <li><b>deploy-file</b> adds a local bundle file to a remote OBR</li> |
| <li><b>clean</b> cleans the local OBR, removing missing bundles</li> |
| </ul> |
| |
| |
| <p>Any of these goals can be disabled by setting <tt>-DobrRepository=NONE</tt></p> |
| |
| <h2><a name="MavenOBRPlugin-obr:install"></a>obr:install</h2> |
| |
| <p>The <b>install</b> goal updates the local OBR with the details of the installed bundle from the local Maven repository.</p> |
| |
| <p>(If the project has an <tt>obr.xml</tt> file somewhere in its resources, then it will be automatically detected and applied.)</p> |
| |
| <p>configuration:</p> |
| |
| <ul> |
| <li><em>obrRepository</em> path to local OBR, defaults to <em><local-maven-repository></em><tt>/repository.xml</tt></li> |
| </ul> |
| |
| |
| <p>To attach this goal to your project's lifecycle, use:</p> |
| |
| <div class="code"><div class="codeContent"> |
| <pre class="code-xml"><span class="code-tag"><plugin></span> |
| <span class="code-tag"><groupId></span>org.apache.felix<span class="code-tag"></groupId></span> |
| <span class="code-tag"><artifactId></span>maven-obr-plugin<span class="code-tag"></artifactId></span> |
| <span class="code-tag"><version></span>1.2.0-SNAPSHOT<span class="code-tag"></version></span> |
| <span class="code-tag"><executions></span> |
| <span class="code-tag"><execution></span> |
| <span class="code-tag"><goals></span> |
| <span class="code-tag"><goal></span>install<span class="code-tag"></goal></span> |
| <span class="code-tag"></goals></span> |
| <span class="code-tag"></execution></span> |
| <span class="code-tag"></executions></span> |
| <span class="code-tag"></plugin></span></pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-obr:installfile"></a>obr:install-file</h2> |
| |
| <p>The <b>install-file</b> goal updates the local OBR with the details of a bundle from the local filesystem.</p> |
| |
| <p>configuration:</p> |
| |
| <ul> |
| <li><em>obrRepository</em> path to local OBR, defaults to <em><local-maven-repository></em><tt>/repository.xml</tt></li> |
| <li><em>groupId</em> Maven groupId for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>artifactId</em> Maven artifactId for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>version</em> Maven version for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>packaging</em> Maven packaging type for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>classifier</em> Maven classifier type, defaults to none</li> |
| <li><em>pomFile</em> optional Pom file describing the bundle</li> |
| <li><em>file</em> bundle file, defaults to the bundle from the local Maven repository</li> |
| <li><em>obrXml</em> optional additional properties for the bundle</li> |
| </ul> |
| |
| |
| <p>Example:</p> |
| |
| <div class="preformatted"><div class="preformattedContent"> |
| <pre>mvn org.apache.felix:maven-obr-plugin:1.2.0-SNAPSHOT:install-file \ |
| -DpomFile=myPom.xml -Dfile=foo-1.0.jar |
| </pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-obr:deploy"></a>obr:deploy</h2> |
| |
| <p>The <b>deploy goal</b> updates the remote OBR with the details of |
| the deployed bundle from the local Maven repository. The remote OBR is |
| found by querying the <tt><distributionManagement></tt> section of the project, unless <tt>-DaltDeploymentRepository</tt> is set. See <span class="nobr"><a href="http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html" title="Visit page outside Confluence" rel="nofollow">http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span> for more details about these particular settings.</p> |
| |
| <p>(If the project has an <tt>obr.xml</tt> file somewhere in its resources, then it will be automatically detected and applied.)</p> |
| |
| <p>configuration:</p> |
| |
| <ul> |
| <li><em>obrRepository</em> name of remote OBR, defaults to <tt>repository.xml</tt></li> |
| <li><em>altDeploymentRepository</em> alternative remote repository, <em>id::layout::url</em></li> |
| <li><em>ignoreLock</em> ignore remote locking when updating the OBR</li> |
| </ul> |
| |
| |
| <p>To attach this goal to your project's lifecycle, use:</p> |
| |
| <div class="code"><div class="codeContent"> |
| <pre class="code-xml"><span class="code-tag"><plugin></span> |
| <span class="code-tag"><groupId></span>org.apache.felix<span class="code-tag"></groupId></span> |
| <span class="code-tag"><artifactId></span>maven-obr-plugin<span class="code-tag"></artifactId></span> |
| <span class="code-tag"><version></span>1.2.0-SNAPSHOT<span class="code-tag"></version></span> |
| <span class="code-tag"><executions></span> |
| <span class="code-tag"><execution></span> |
| <span class="code-tag"><goals></span> |
| <span class="code-tag"><goal></span>deploy<span class="code-tag"></goal></span> |
| <span class="code-tag"></goals></span> |
| <span class="code-tag"></execution></span> |
| <span class="code-tag"></executions></span> |
| <span class="code-tag"></plugin></span></pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-obr:deployfile"></a>obr:deploy-file</h2> |
| |
| <p>The <b>deploy-file</b> goal updates the remote OBR with the details of a deployed bundle from the local filesystem. The remote OBR is found using the <tt>-DrepositoryId</tt> and <tt>-Durl</tt> parameters. See <span class="nobr"><a href="http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html" title="Visit page outside Confluence" rel="nofollow">http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html<sup><img class="rendericon" src="maven-obr-plugin_files/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7"></sup></a></span> for more details about these particular settings.</p> |
| |
| <p>You can use the <tt>-DbundleUrl</tt> parameter to give the public location of the deployed bundle, which may differ from the remote OBR location.</p> |
| |
| <p>configuration:</p> |
| |
| <ul> |
| <li><em>obrRepository</em> name of remote OBR, defaults to <tt>repository.xml</tt></li> |
| <li><em>repositoryId</em> optional repository id, used to lookup authentication settings</li> |
| <li><em>url</em> remote repository transport URL, like <div class="preformatted"><div class="preformattedContent"> |
| <pre>scpexe://host/path/to/obr</pre> |
| </div></div></li> |
| <li><em>bundleUrl</em> public URL of deployed bundle, like <div class="preformatted"><div class="preformattedContent"> |
| <pre>http://www.foo.org/bundles/foo.jar</pre> |
| </div></div></li> |
| <li><em>groupId</em> Maven groupId for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>artifactId</em> Maven artifactId for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>version</em> Maven version for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>packaging</em> Maven packaging type for the bundle, taken from <em>pomFile</em> if given</li> |
| <li><em>classifier</em> Maven classifier type, defaults to none</li> |
| <li><em>pomFile</em> optional Pom file describing the bundle</li> |
| <li><em>file</em> bundle file, defaults to the bundle from the local Maven repository</li> |
| <li><em>obrXml</em> optional additional properties for the bundle</li> |
| <li><em>ignoreLock</em> ignore remote locking when updating the OBR</li> |
| </ul> |
| |
| |
| <p>Example:</p> |
| |
| <div class="preformatted"><div class="preformattedContent"> |
| <pre>mvn org.apache.felix:maven-obr-plugin:1.2.0-SNAPSHOT:deploy-file \ |
| -DpomFile=myPom.xml -Dfile=foo-1.0.jar -Durl=file:/tmp/example/OBR \ |
| -DbundleUrl=http://www.foo.org/bundles/foo.jar |
| </pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-obr:clean"></a>obr:clean</h2> |
| |
| <p>Sometimes you would like to clean your local OBR because it contains |
| bundles that are no longer in your local Maven repository. This case |
| often occurs when artifacts were deleted manually. The maven-obr-plugin |
| provides a simple goal to check for missing bundles, and remove them |
| from the local OBR.</p> |
| |
| <p>configuration:</p> |
| |
| <ul> |
| <li><em>obrRepository</em> path to local OBR, defaults to <em><local-maven-repository><tt></tt></em><tt>/repository.xml</tt></li> |
| </ul> |
| |
| |
| <p>To attach this goal to your project's lifecycle, use:</p> |
| |
| <div class="code"><div class="codeContent"> |
| <pre class="code-xml"><span class="code-tag"><plugin></span> |
| <span class="code-tag"><groupId></span>org.apache.felix<span class="code-tag"></groupId></span> |
| <span class="code-tag"><artifactId></span>maven-obr-plugin<span class="code-tag"></artifactId></span> |
| <span class="code-tag"><version></span>1.2.0-SNAPSHOT<span class="code-tag"></version></span> |
| <span class="code-tag"><executions></span> |
| <span class="code-tag"><execution></span> |
| <span class="code-tag"><goals></span> |
| <span class="code-tag"><goal></span>clean<span class="code-tag"></goal></span> |
| <span class="code-tag"></goals></span> |
| <span class="code-tag"></execution></span> |
| <span class="code-tag"></executions></span> |
| <span class="code-tag"></plugin></span></pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-Concurrentupdates"></a>Concurrent updates</h2> |
| |
| <p>With a remote OBR, several uploads may occur at the same time. |
| However, the remote OBR is centralized in one file, so concurrent |
| modification must be avoided. To achieve this, the plug-in implements a |
| locking system. Each time the plug-in tries to modify the file it sets |
| a file based lock. If it can't take the lock, it will wait and retry. |
| After 3 attempts the upload process fails. To bypass this lock add <tt>-DignoreLock</tt> to the command-line (or add <tt><ignoreLock>true<ignoreLock></tt> to the configuration section of your Pom).</p> |
| |
| <h2><a name="MavenOBRPlugin-FTPprotocol"></a>FTP protocol</h2> |
| |
| <p>Not all protocols are supported by Maven out of the box. For example the ftp protocol requires the <b>wagon-ftp</b> component. To enable the ftp protocol add this to your Pom:</p> |
| |
| <div class="code"><div class="codeContent"> |
| <pre class="code-xml"><span class="code-tag"><build></span> |
| <span class="code-tag"><extensions></span> |
| <span class="code-tag"><extension></span> |
| <span class="code-tag"><groupId></span>org.apache.maven.wagon<span class="code-tag"></groupId></span> |
| <span class="code-tag"><artifactId></span>wagon-ftp<span class="code-tag"></artifactId></span> |
| <span class="code-tag"><version></span>1.0-alpha-6<span class="code-tag"></version></span> |
| <span class="code-tag"></extension></span> |
| <span class="code-tag"></extensions></span> |
| <span class="code-tag"></build></span></pre> |
| </div></div> |
| |
| <h2><a name="MavenOBRPlugin-Howtheplugincomputesthedescriptionofthebundle"></a>How the plug-in computes the description of the bundle</h2> |
| |
| <p>The description of the bundle comes from three different sources:</p> |
| |
| <ul> |
| <li>Bindex : Bindex is a tool that analyzes a bundle manifest to generate OBR description</li> |
| <li>pom.xml : by analyzing the pom file, various information is collected (symbolic name ...)</li> |
| <li>obr.xml : this file contains customized description and capabilities for the bundle</li> |
| </ul> |
| |
| |
| <p>These sources are merged together using the following precedence:</p> |
| |
| <div class="preformatted"><div class="preformattedContent"> |
| <pre>Bindex |
| | (overrides) |
| pom.xml |
| | (overrides) |
| obr.xml |
| </pre> |
| </div></div> |
| |
| <p>A warning message is displayed when existing information is overridden.</p> |
| |
| <h2><a name="MavenOBRPlugin-Knownissues&limitations"></a>Known issues & limitations</h2> |
| |
| <ol> |
| <li>obr.xml (file given by the user to add properties not found |
| by Bindex) must be correct, because the plug-in does not check its |
| syntax.</li> |
| </ol> |
| |
| </div> |
| </body></html> |