geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo Development > OSGI conversion tips
Date Sat, 24 Oct 2009 17:53:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDEV&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/GMOxDEV/OSGI+conversion+tips">OSGI
conversion tips</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~djencks">David
Jencks</a>
    </h4>
     Add instructions on assembling a test server
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     Add instructions on assembling a test server<br />
     </div>
          <br/>
     <div class="notificationGreySide">
         <h2><a name="OSGIconversiontips-Letscollecttipsonosgiconversionhere"></a>Lets
collect tips on osgi conversion here</h2>

<h3><a name="OSGIconversiontips-jarswithxmlbeanscompilation"></a>jars with
xmlbeans compilation</h3>
<p>To use xmlbeans generated code you need access to the SchemaTypeSystemImpl, which
is not imported by the maven-bundle-plugin.  So you need to add something like this to the
pom:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
                &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
                &lt;configuration&gt;
                    &lt;instructions&gt;
                        &lt;!--packages containing <span class="code-quote">"impl"</span>
or <span class="code-quote">"internal"</span> are excluded by <span class="code-keyword">default</span>
--&gt;
                        &lt;Import-Package&gt;org.apache.xmlbeans.impl.schema;version=<span
class="code-quote">"2.4"</span>,*&lt;/Import-Package&gt;
                        &lt;!--&lt;_versionpolicy&gt;[$(version;==;$(@)),$(version;+;$(@)))&lt;/_versionpolicy&gt;--&gt;
                    &lt;/instructions&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
</pre>
</div></div>

<p>Also, any package we may have with "impl" or "internal" needs to be explicitly listed
in the Export-Packages.</p>

<h3><a name="OSGIconversiontips-Nonbundleinterference"></a>Non-bundle interference</h3>
<p>Many problems with building plugins are caused by non-bundle dependencies getting
installed in felix rather than bundleized equivalents.  Unfortuneately it looks like felix
only says "non-framework bundles cannot be started" without telling us the location of the
non-bundle.  Running</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn dependency:tree
</pre>
</div></div>
<p>helps to find the bad dependencies.  On a related note, generally you have to exclude
original jars from the dependencyManagement dependency entry of a bundleized repackaging.
 This seems like a serious defect in maven-bundle-plugin.</p>

<h3><a name="OSGIconversiontips-Assembleaservertomakesureeachsetofpluginsstarts."></a>Assemble
a server to make sure each set of plugins starts.</h3>
<p>I think it's a good idea to assemble a server for each set of plugins to make sure
they at least start.  Here's how:</p>

<ol>
	<li>run
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn archetype:create \
   -DarchetypeGroupId=org.apache.geronimo.buildsupport \
   -DarchetypeArtifactId=geronimo-assembly-archetype \
   -DarchetypeVersion=3.0-SNAPSHOT \
   -DgroupId=org.apache.geronimo.plugins \
   -DartifactId=geronimo-&lt;foo&gt;-server
</pre>
</div></div> 
<p>where &lt;foo&gt; is your set of plugins</p></li>
	<li>add it to svn</li>
	<li>add the plugins you want to test as depedendencies</li>
	<li>add this to start the server when run with -Pit<br/>
in plugin management:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.geronimo.buildsupport&lt;/groupId&gt;
                    &lt;artifactId&gt;geronimo-maven-plugin&lt;/artifactId&gt;
                    &lt;version&gt;${version}&lt;/version&gt;

                    &lt;configuration&gt;
                       &lt;assemblyArchive&gt;${project.build.directory}/${pom.artifactId}-${pom.version}-bin.zip&lt;/assemblyArchive&gt;
                        &lt;optionSets&gt;
                            &lt;optionSet&gt;
                                &lt;id&gt;morememory&lt;/id&gt;
                                &lt;options&gt;
                                    &lt;option&gt;-Xmx512m&lt;/option&gt;
                                    &lt;option&gt;-XX:MaxPermSize=128m&lt;/option&gt;
                                &lt;/options&gt;
                            &lt;/optionSet&gt;

                            &lt;optionSet&gt;
                                &lt;id&gt;debug&lt;/id&gt;
                                &lt;options&gt;
                                    &lt;option&gt;-Xdebug&lt;/option&gt;
                                    &lt;option&gt;-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n&lt;/option&gt;
                                &lt;/options&gt;
                            &lt;/optionSet&gt;
                        &lt;/optionSets&gt;
                    &lt;/configuration&gt;
                    &lt;executions&gt;
                         &lt;execution&gt;
                             &lt;id&gt;start&lt;/id&gt;
                             &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                             &lt;goals&gt;
                                 &lt;goal&gt;start-server&lt;/goal&gt;
                             &lt;/goals&gt;
                             &lt;configuration&gt;
                                 &lt;assemblyId&gt;${it-server}&lt;/assemblyId&gt;
                                 &lt;logOutput&gt;<span class="code-keyword">true</span>&lt;/logOutput&gt;
                                 &lt;background&gt;<span class="code-keyword">true</span>&lt;/background&gt;
                                 &lt;verifyTimeout&gt;300&lt;/verifyTimeout&gt;
                                 &lt;refresh&gt;<span class="code-keyword">true</span>&lt;/refresh&gt;
                                 &lt;optionSets&gt;
                                     &lt;optionSet&gt;
                                         &lt;id&gt;<span class="code-keyword">default</span>&lt;/id&gt;
                                         &lt;options&gt;
                                            &lt;option&gt;-XX:MaxPermSize=128m&lt;/option&gt;
                                         &lt;/options&gt;
                                     &lt;/optionSet&gt;

                                     &lt;optionSet&gt;
                                          &lt;id&gt;morememory&lt;/id&gt;
                                          &lt;options&gt;
                                              &lt;option&gt;-Xmx512m&lt;/option&gt;
                                              &lt;option&gt;-XX:MaxPermSize=128m&lt;/option&gt;
                                          &lt;/options&gt;
                                      &lt;/optionSet&gt;

                                      &lt;optionSet&gt;
                                          &lt;id&gt;debug&lt;/id&gt;
                                          &lt;options&gt;
                                              &lt;option&gt;-Xdebug&lt;/option&gt;
                                              &lt;option&gt;-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n&lt;/option&gt;
                                          &lt;/options&gt;
                                      &lt;/optionSet&gt;
                                 &lt;/optionSets&gt;
                             &lt;/configuration&gt;
                         &lt;/execution&gt;
                         &lt;execution&gt;
                             &lt;id&gt;stop&lt;/id&gt;
                             &lt;phase&gt;install&lt;/phase&gt;
                             &lt;goals&gt;
                                 &lt;goal&gt;stop-server&lt;/goal&gt;
                             &lt;/goals&gt;
                         &lt;/execution&gt;
                     &lt;/executions&gt;
                &lt;/plugin&gt;
</pre>
</div></div>
<p>and a profile</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    &lt;profiles&gt;
        &lt;profile&gt;
            &lt;id&gt;it&lt;/id&gt;
            &lt;build&gt;
                &lt;plugins&gt;
                    &lt;plugin&gt;
                        &lt;groupId&gt;org.apache.geronimo.buildsupport&lt;/groupId&gt;
                        &lt;artifactId&gt;geronimo-maven-plugin&lt;/artifactId&gt;
                    &lt;/plugin&gt;
                &lt;/plugins&gt;
            &lt;/build&gt;
        &lt;/profile&gt;
    &lt;/profiles&gt;
</pre>
</div></div></li>
</ol>


<p>Note that at the moment the -Pit doesn't actually work, you have to try to start
the server by hand</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/GMOxDEV/OSGI+conversion+tips">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=5603340&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/GMOxDEV/OSGI+conversion+tips?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message