sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Maven Launchpad Plugin
Date Tue, 27 Apr 2010 14:04:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/1/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Maven+Launchpad+Plugin">Maven
Launchpad Plugin</a></h2>
    <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~justinedelson">Justin
Edelson</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>By default, bundles are
added to start level 0. To change, this use the {{startLevel}} element within each additional
bundle definition. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h2. Integration Testing <br> <br>For integration testing examples, see
{{/samples/inplace-integration-test}} and {{launchpad/testing}} in the Sling source tree.
<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="MavenLaunchpadPlugin-MavenLaunchpadPlugin"></a>Maven
Launchpad Plugin</h1>

<p>The Maven Launchpad Plugin provides goals which facilitate the creation of OSGi applications.
It supports the following runtime scenarios:</p>
<ul>
	<li>A WAR file suitable for running in a JavaEE servlet container.</li>
	<li>A standalone Java application, with HTTP support from the Felix HttpService implementation</li>
	<li>Inside Apache Karaf</li>
</ul>


<p>In addition, the Maven Launchpad Plugin supports the publishing of an application
descriptor, in the form of a <b>bundle list</b>, as a Maven artifact. This descriptor
can then be used by downstream application builders as the basis for other applications. In
Sling, this is embodied by two Maven projects:</p>
<ul>
	<li><a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/builder" class="external-link"
rel="nofollow">org.apache.sling.launchpad</a> - produces an application descriptor.</li>
	<li><a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/builder/testing"
class="external-link" rel="nofollow">org.apache.sling.launchpad.testing</a> - uses
the application descriptor from <tt>org.apache.sling.launchpad</tt> and adds two
bundles.</li>
</ul>


<p>Maven Launchpad Plugin provides the following goals: </p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Goals </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> launchpad:prepare-package </td>
<td class='confluenceTd'> Create the file system structure required by Sling's Launchpad
framework. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:attach-bundle-list </td>
<td class='confluenceTd'> Attach the bundle list descriptor to the current project as
a Maven artifact. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:create-karaf-descriptor </td>
<td class='confluenceTd'> Create an Apache Karaf Feature descriptor. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:create-bundle-jar </td>
<td class='confluenceTd'> Create a JAR file containing the bundles in a Launchpad-structured
JAR file. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:check-bundle-list-for-snapshots </td>
<td class='confluenceTd'> Validate that the bundle list does not contain any SNAPSHOT
versions. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:run </td>
<td class='confluenceTd'> Run a Launchpad application. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:start </td>
<td class='confluenceTd'> Start a Launchpad application. </td>
</tr>
<tr>
<td class='confluenceTd'> launchpad:stop </td>
<td class='confluenceTd'> Stop a Launchpad application. </td>
</tr>
</tbody></table>
</div>


<h3><a name="MavenLaunchpadPlugin-GeneralConfiguration"></a>General Configuration</h3>

<p>In general, the bulk of the configuration of the Maven Launchpad Plugin is concerned
with setting up the bundle list which all of the goals will use. This bundle list is created
using the following steps:</p>
<ol>
	<li>If <tt>includeDefaultBundles</tt> is <tt>true</tt> (the
default), the default bundle list is loaded. By default, this is <tt>org.apache.sling.launchpad:org.apache.sling.launchpad:RELEASE:xml:bundlelist</tt>,
but can be overridden by setting the <tt>defaultBundleList</tt> plugin parameter.</li>
	<li>If <tt>includeDefaultBundles</tt> is <tt>false</tt>, an
empty list is created.</li>
	<li>If the bundle list file exists (by default, at <tt>src/main/bundles/list.xml</tt>),
the bundles defined in it are added to the bundle list.</li>
	<li>If the <tt>additionalBundles</tt> plugin parameter is defined, those
bundles are added to the bundle list.</li>
	<li>If the <tt>bundleExclusions</tt> plugin parameter is defined, those
bundles are removed from the bundle list.</li>
</ol>


<p>When a bundle is added to the bundle list, if a bundle with the same groupId, artifactId,
type, and classifier is already in the bundle list, the version of the existing bundle is
modified. However, the start level of a bundle is never changed once that bundle is added
to the bundle list.</p>

<p>The plugin may also contribute bundles to (or remove bundles from) the bundle list
as it sees fit.</p>

<h3><a name="MavenLaunchpadPlugin-FrameworkConfiguration"></a>Framework
Configuration</h3>

<p>For the <tt>run</tt> and <tt>start</tt> goals, the plugin
will look for a file named <tt>src/test/config/sling.properties</tt>. If this
file is present, it will be filtered using standard Maven filtering and used to populate the
OSGi framework properties. This can be used, for example, to specify a <tt>repository.xml</tt>
file to be used during development:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sling.repository.config.file.url=${basedir}/src/test/config/repository.xml
</pre>
</div></div>

<h2><a name="MavenLaunchpadPlugin-BundleListFiles"></a>Bundle List Files</h2>

<p>The bundle list file uses a simple XML syntax representing a list of bundles organized
into start levels:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>?&gt;</span>
<span class="code-tag">&lt;bundles&gt;</span>
    <span class="code-tag">&lt;startLevel level=<span class="code-quote">"0"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>
            <span class="code-tag">&lt;groupId&gt;</span>commons-io<span
class="code-tag">&lt;/groupId&gt;</span>
            <span class="code-tag">&lt;artifactId&gt;</span>commons-io<span
class="code-tag">&lt;/artifactId&gt;</span>
            <span class="code-tag">&lt;version&gt;</span>1.4<span class="code-tag">&lt;/version&gt;</span>
        <span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>
            <span class="code-tag">&lt;groupId&gt;</span>commons-collections<span
class="code-tag">&lt;/groupId&gt;</span>
            <span class="code-tag">&lt;artifactId&gt;</span>commons-collections<span
class="code-tag">&lt;/artifactId&gt;</span>
            <span class="code-tag">&lt;version&gt;</span>3.2.1<span
class="code-tag">&lt;/version&gt;</span>
        <span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/startLevel&gt;</span>

    <span class="code-tag">&lt;startLevel level=<span class="code-quote">"10"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>
            <span class="code-tag">&lt;groupId&gt;</span>org.apache.felix<span
class="code-tag">&lt;/groupId&gt;</span>
            <span class="code-tag">&lt;artifactId&gt;</span>org.apache.felix.eventadmin<span
class="code-tag">&lt;/artifactId&gt;</span>
            <span class="code-tag">&lt;version&gt;</span>1.0.0<span
class="code-tag">&lt;/version&gt;</span>
        <span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/startLevel&gt;</span>

    <span class="code-tag">&lt;startLevel level=<span class="code-quote">"15"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>
            <span class="code-tag">&lt;groupId&gt;</span>org.apache.sling<span
class="code-tag">&lt;/groupId&gt;</span>
            <span class="code-tag">&lt;artifactId&gt;</span>org.apache.sling.jcr.api<span
class="code-tag">&lt;/artifactId&gt;</span>
            <span class="code-tag">&lt;version&gt;</span>2.0.2-incubator<span
class="code-tag">&lt;/version&gt;</span>
        <span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/startLevel&gt;</span>
<span class="code-tag">&lt;/bundles&gt;</span>
</pre>
</div></div>

<p>Within each <tt>bundle</tt> element, <tt>type</tt> and <tt>classifier</tt>
are also supported.</p>

<h2><a name="MavenLaunchpadPlugin-ArtifactDefinition"></a>Artifact Definition</h2>

<p>The <tt>defaultBundleList</tt>, <tt>jarWebSupport</tt>, <tt>additionalBundles</tt>,
and <tt>bundleExclusions</tt> parameters are configured with artifact definitions.
This is done using a syntax similar to Maven dependency elements:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;configuration&gt;</span>
...
  <span class="code-tag">&lt;jarWebSupport&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>GROUP_ID<span class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>ARTIFACT_ID<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>VERSION<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- type and classifier
can also be specified if needed --&gt;</span></span>
  <span class="code-tag">&lt;/jarWebSupport&gt;</span>
...
<span class="code-tag">&lt;/configuration&gt;</span>
</pre>
</div></div>

<p>For example, to use Pax Web instead of Felix HttpService as the HttpService provider,
use the following:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;configuration&gt;</span>
...
  <span class="code-tag">&lt;jarWebSupport&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.ops4j.pax.web<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>pax-web-service<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>RELEASE<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- type and classifier
can also be specified if needed --&gt;</span></span>
  <span class="code-tag">&lt;/jarWebSupport&gt;</span>
...
<span class="code-tag">&lt;/configuration&gt;</span>
</pre>
</div></div>

<p>In the case of <tt>additionalBundles</tt> and <tt>bundleExclusions</tt>,
these are arrays of definitions, so an intermediate <tt>bundle</tt> element is
necessary:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;configuration&gt;</span>
...
  <span class="code-tag">&lt;additionalBundles&gt;</span>
    <span class="code-tag">&lt;bundle&gt;</span>
      <span class="code-tag">&lt;groupId&gt;</span>GROUP_ID<span class="code-tag">&lt;/groupId&gt;</span>
      <span class="code-tag">&lt;artifactId&gt;</span>ARTIFACT_ID<span
class="code-tag">&lt;/artifactId&gt;</span>
      <span class="code-tag">&lt;version&gt;</span>VERSION<span class="code-tag">&lt;/version&gt;</span>
      <span class="code-tag"><span class="code-comment">&lt;!-- type and classifier
can also be specified if needed --&gt;</span></span>
    <span class="code-tag">&lt;/bundle&gt;</span>
  <span class="code-tag">&lt;/additionalBundles&gt;</span>
...
<span class="code-tag">&lt;/configuration&gt;</span>
</pre>
</div></div>

<p>By default, bundles are added to start level 0. To change, this use the <tt>startLevel</tt>
element within each additional bundle definition.</p>

<h2><a name="MavenLaunchpadPlugin-IntegrationTesting"></a>Integration Testing</h2>

<p>For integration testing examples, see <tt>/samples/inplace-integration-test</tt>
and <tt>launchpad/testing</tt> in the Sling source tree.</p>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Maven+Launchpad+Plugin">View
Online</a>
        |
        <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=13271080&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Maven+Launchpad+Plugin?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message