blob: 47f5730edfe6d43a2e26aa2ed1df4d33010c0fd5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<title>Apache Felix - Apache Felix Maven OBR Plugin</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.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="https://felix.apache.org/">
<img border="0" alt="Apache Felix" src="/res/logo.png">
</a>
</div>
<div class="header">
<a href="https://www.apache.org/">
<img border="0" alt="Apache" src="/res/apache.png">
</a>
</div>
</div>
<div class="menu">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a href="/news.html">News</a> <br />
<a href="/license.html">License</a> <br />
<a href="/downloads.cgi">Downloads</a> <br />
<a href="/documentation.html">Documentation</a> <br />
<a href="/documentation/community/project-info.html">Project Info</a> <br />
<a href="/documentation/community/contributing.html">Contributing</a> <br />
<a href="/sitemap.html">Site Map</a> <br />
<a href="https://www.apache.org/">ASF</a> <br />
<a href="https://www.apache.org/security/">Security</a> <br />
<a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> <br />
<a href="https://www.apache.org/foundation/thanks.html">Sponsors</a> </p>
<iframe
src="https://www.apache.org/ads/button.html"
style="border-width:0; float: left"
frameborder="0"
scrolling="no"
width="135"
height="135">
</iframe>
</div>
<div class="main">
<div class="breadcrump" style="font-size: 80%;">
<a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>
</div>
<h1>Apache Felix Maven OBR Plugin</h1>
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<div class="warning" markdown="1">
The *maven-obr-plugin* is *deprecated* and its features have been *merged* into the *1.4.0* release of the *[maven-bundle-plugin](/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html)*
</div>
<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 id="features">Features<a class="headerlink" href="#features" title="Permanent link">&para;</a></h2>
<p>The maven-obr-plugin supports:
<em> Management of both local and remote OBRs
</em> Registering Maven and non-Maven artifacts with OBRs
<em> Automatically discovering bundle capabilities and requirements
</em> Customizing bundle descriptions</p>
<h2 id="how-to-use-the-maven-obr-plugin">How to use the maven-obr-plugin?<a class="headerlink" href="#how-to-use-the-maven-obr-plugin" title="Permanent link">&para;</a></h2>
<p>The plug-in offers five Maven goals:
<em> </em>install<em> adds the current bundle project to the local OBR
</em> <em>install-file</em> adds a local bundle file to the local OBR
<em> </em>deploy<em> adds the current bundle project to a remote OBR
</em> <em>deploy-file</em> adds a local bundle file to a remote OBR
<em> </em>clean* cleans the local OBR, removing missing bundles</p>
<p>Any of these goals can be disabled by setting <code>\-DobrRepository=NONE</code></p>
<h2 id="obrinstall">obr:install<a class="headerlink" href="#obrinstall" title="Permanent link">&para;</a></h2>
<p>The <em>install</em> goal updates the local OBR with the details of the installed bundle from the local Maven repository.</p>
<p>(If the project has an <code>obr.xml</code> file somewhere in its resources, then it will be automatically detected and applied.)</p>
<p>configuration:
<em> </em>obrRepository<em> path to local OBR, defaults to </em><local-maven-repository>*<code>/repository.xml</code></p>
<p>To attach this goal to your project's lifecycle, use:</p>
<div class="codehilite"><pre><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.felix<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>maven-obr-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.2.0<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>install<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/executions&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</pre></div>
<h2 id="obrinstall-file">obr:install-file<a class="headerlink" href="#obrinstall-file" title="Permanent link">&para;</a></h2>
<p>The <em>install-file</em> goal updates the local OBR with the details of a bundle from the local filesystem.</p>
<p>configuration:
<em> </em>obrRepository<em> path to local OBR, defaults to </em><local-maven-repository><em><code>/repository.xml</code>
</em> <em>groupId</em> Maven groupId for the bundle, taken from <em>pomFile</em> if given
<em> </em>artifactId<em> Maven artifactId for the bundle, taken from </em>pomFile<em> if given
</em> <em>version</em> Maven version for the bundle, taken from <em>pomFile</em> if given
<em> </em>packaging<em> Maven packaging type for the bundle, taken from </em>pomFile<em> if given
</em> <em>classifier</em> Maven classifier type, defaults to none
<em> </em>pomFile<em> optional Pom file describing the bundle
</em> <em>file</em> bundle file, defaults to the bundle from the local Maven repository
<em> </em>obrXml* optional additional properties for the bundle</p>
<p>Example:</p>
<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">:</span><span class="n">maven</span><span class="o">-</span><span class="n">obr</span><span class="o">-</span><span class="n">plugin</span><span class="p">:</span>1<span class="p">.</span>2<span class="p">.</span>0<span class="p">:</span><span class="n">install</span><span class="o">-</span><span class="n">file</span> <span class="o">\</span>
<span class="o">-</span><span class="n">DpomFile</span><span class="p">=</span><span class="n">myPom</span><span class="p">.</span><span class="n">xml</span> <span class="o">-</span><span class="n">Dfile</span><span class="p">=</span><span class="n">foo</span><span class="o">-</span>1<span class="p">.</span>0<span class="p">.</span><span class="n">jar</span>
</pre></div>
<h2 id="obrdeploy">obr:deploy<a class="headerlink" href="#obrdeploy" title="Permanent link">&para;</a></h2>
<p>The <em>deploy goal</em> updates the remote OBR with the details of the deployed bundle from the local Maven repository. The remote OBR is found by querying the <code>&lt;distributionManagement&gt;</code> section of the project, unless <code>\-DaltDeploymentRepository</code> is set. See <a href="http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html">http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html</a> for more details about these particular settings.</p>
<p>(If the project has an <code>obr.xml</code> file somewhere in its resources, then it will be automatically detected and applied.)</p>
<p>configuration:
<em> </em>obrRepository<em> name of remote OBR, defaults to <code>repository.xml</code>
</em> <em>altDeploymentRepository</em> alternative remote repository, <em>id::layout::url</em>
<em> </em>ignoreLock* ignore remote locking when updating the OBR</p>
<p>To attach this goal to your project's lifecycle, use:</p>
<div class="codehilite"><pre><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.felix<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>maven-obr-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.2.0<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>deploy<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/executions&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</pre></div>
<h2 id="obrdeploy-file">obr:deploy-file<a class="headerlink" href="#obrdeploy-file" title="Permanent link">&para;</a></h2>
<p>The <em>deploy-file</em> goal updates the remote OBR with the details of a deployed bundle from the local filesystem. The remote OBR is found using the <code>\-DrepositoryId</code> and <code>\-Durl</code> parameters. See <a href="http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html">http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html</a> for more details about these particular settings.</p>
<p>You can use the <code>\-DbundleUrl</code> parameter to give the public location of the deployed bundle, which may differ from the remote OBR location.</p>
<p>configuration:
<em> </em>obrRepository<em> name of remote OBR, defaults to <code>repository.xml</code>
</em> <em>repositoryId</em> optional repository id, used to lookup authentication settings
<em> </em>url* remote repository transport URL, like</p>
<div class="codehilite"><pre><span class="n">scpexe</span><span class="p">:</span><span class="o">//</span><span class="n">host</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">obr</span>
</pre></div>
<ul>
<li>
<p><em>bundleUrl</em> public URL of deployed bundle, like</p>
<p>http://www.foo.org/bundles/foo.jar</p>
</li>
<li>
<p><em>groupId</em> Maven groupId for the bundle, taken from <em>pomFile</em> if given</p>
</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="codehilite"><pre><span class="n">mvn</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">felix</span><span class="p">:</span><span class="n">maven</span><span class="o">-</span><span class="n">obr</span><span class="o">-</span><span class="n">plugin</span><span class="p">:</span>1<span class="p">.</span>2<span class="p">.</span>0<span class="p">:</span><span class="n">deploy</span><span class="o">-</span><span class="n">file</span> <span class="o">\</span>
<span class="o">-</span><span class="n">DpomFile</span><span class="p">=</span><span class="n">myPom</span><span class="p">.</span><span class="n">xml</span> <span class="o">-</span><span class="n">Dfile</span><span class="p">=</span><span class="n">foo</span><span class="o">-</span>1<span class="p">.</span>0<span class="p">.</span><span class="n">jar</span> <span class="o">-</span><span class="n">Durl</span><span class="p">=</span><span class="n">file</span><span class="p">:</span><span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">example</span><span class="o">/</span><span class="n">OBR</span> <span class="o">\</span>
<span class="o">-</span><span class="n">DbundleUrl</span><span class="p">=</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="p">.</span><span class="n">foo</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="n">bundles</span><span class="o">/</span><span class="n">foo</span><span class="p">.</span><span class="n">jar</span>
</pre></div>
<h2 id="obrclean">obr:clean<a class="headerlink" href="#obrclean" title="Permanent link">&para;</a></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:
<em> </em>obrRepository<em> path to local OBR, defaults to </em><local-maven-repository>*<code>{}{</code>}<code>/repository.xml</code></p>
<p>To attach this goal to your project's lifecycle, use:</p>
<div class="codehilite"><pre><span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.felix<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>maven-obr-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.2.0<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>clean<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/executions&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</pre></div>
<h2 id="concurrent-updates">Concurrent updates<a class="headerlink" href="#concurrent-updates" title="Permanent link">&para;</a></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 <code>\-DignoreLock</code> to the command-line (or add <code>&lt;ignoreLock&gt;true&lt;ignoreLock&gt;</code> to the configuration section of your Pom).</p>
<h2 id="ftp-protocol">FTP protocol<a class="headerlink" href="#ftp-protocol" title="Permanent link">&para;</a></h2>
<p>Not all protocols are supported by Maven out of the box. For example the ftp protocol requires the <em>wagon-ftp</em> component. To enable the ftp protocol add this to your Pom:</p>
<div class="codehilite"><pre><span class="nt">&lt;build&gt;</span>
<span class="nt">&lt;extensions&gt;</span>
<span class="nt">&lt;extension&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.maven.wagon<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>wagon-ftp<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.0-alpha-6<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;/extension&gt;</span>
<span class="nt">&lt;/extensions&gt;</span>
<span class="nt">&lt;/build&gt;</span>
</pre></div>
<h2 id="how-the-plug-in-computes-the-description-of-the-bundle">How the plug-in computes the description of the bundle<a class="headerlink" href="#how-the-plug-in-computes-the-description-of-the-bundle" title="Permanent link">&para;</a></h2>
<p>The description of the bundle comes from three different sources:
<em> Bindex : Bindex is a tool that analyzes a bundle manifest to generate OBR description
</em> pom.xml : by analyzing the pom file, various information is collected (symbolic name ...)
* obr.xml : this file contains customized description and capabilities for the bundle</p>
<p>These sources are merged together using the following precedence:</p>
<div class="codehilite"><pre><span class="n">Bindex</span>
<span class="o">|</span> <span class="p">(</span><span class="n">overrides</span><span class="p">)</span>
<span class="n">pom</span><span class="p">.</span><span class="n">xml</span>
<span class="o">|</span> <span class="p">(</span><span class="n">overrides</span><span class="p">)</span>
<span class="n">obr</span><span class="p">.</span><span class="n">xml</span>
</pre></div>
<p>A warning message is displayed when existing information is overridden.</p>
<h2 id="known-issues-limitations">Known issues &amp; limitations<a class="headerlink" href="#known-issues-limitations" title="Permanent link">&para;</a></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 class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
Rev. 1700393 by cziegeler on Tue, 1 Sep 2015 06:04:06 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project
logo are trademarks of The Apache Software Foundation. All other marks mentioned
may be trademarks or registered trademarks of their respective owners.
</div>
</div>
</body>
</html>