You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Lets collect tips on osgi conversion here

jars with xmlbeans compilation

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:

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <!--packages containing "impl" or "internal" are excluded by default -->
                        <Import-Package>org.apache.xmlbeans.impl.schema;version="2.4",*</Import-Package>
                        <!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
                    </instructions>
                </configuration>
            </plugin>

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

Non-bundle interference

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

mvn dependency:tree

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.

Assemble a server to make sure each set of plugins starts.

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:

  1. run
    mvn archetype:create \
       -DarchetypeGroupId=org.apache.geronimo.buildsupport \
       -DarchetypeArtifactId=geronimo-assembly-archetype \
       -DarchetypeVersion=3.0-SNAPSHOT \
       -DgroupId=org.apache.geronimo.plugins \
       -DartifactId=geronimo-<foo>-server
    
    where <foo> is your set of plugins
  2. add it to svn
  3. add the plugins you want to test as depedendencies
  4. add this to start the server when run with -Pit
    in plugin management:
                    <plugin>
                        <groupId>org.apache.geronimo.buildsupport</groupId>
                        <artifactId>geronimo-maven-plugin</artifactId>
                        <version>${version}</version>
    
                        <configuration>
                           <assemblyArchive>${project.build.directory}/${pom.artifactId}-${pom.version}-bin.zip</assemblyArchive>
                            <optionSets>
                                <optionSet>
                                    <id>morememory</id>
                                    <options>
                                        <option>-Xmx512m</option>
                                        <option>-XX:MaxPermSize=128m</option>
                                    </options>
                                </optionSet>
    
                                <optionSet>
                                    <id>debug</id>
                                    <options>
                                        <option>-Xdebug</option>
                                        <option>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</option>
                                    </options>
                                </optionSet>
                            </optionSets>
                        </configuration>
                        <executions>
                             <execution>
                                 <id>start</id>
                                 <phase>pre-integration-test</phase>
                                 <goals>
                                     <goal>start-server</goal>
                                 </goals>
                                 <configuration>
                                     <assemblyId>${it-server}</assemblyId>
                                     <logOutput>true</logOutput>
                                     <background>true</background>
                                     <verifyTimeout>300</verifyTimeout>
                                     <refresh>true</refresh>
                                     <optionSets>
                                         <optionSet>
                                             <id>default</id>
                                             <options>
                                                <option>-XX:MaxPermSize=128m</option>
                                             </options>
                                         </optionSet>
    
                                         <optionSet>
                                              <id>morememory</id>
                                              <options>
                                                  <option>-Xmx512m</option>
                                                  <option>-XX:MaxPermSize=128m</option>
                                              </options>
                                          </optionSet>
    
                                          <optionSet>
                                              <id>debug</id>
                                              <options>
                                                  <option>-Xdebug</option>
                                                  <option>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</option>
                                              </options>
                                          </optionSet>
                                     </optionSets>
                                 </configuration>
                             </execution>
                             <execution>
                                 <id>stop</id>
                                 <phase>install</phase>
                                 <goals>
                                     <goal>stop-server</goal>
                                 </goals>
                             </execution>
                         </executions>
                    </plugin>
    
    and a profile
        <profiles>
            <profile>
                <id>it</id>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.geronimo.buildsupport</groupId>
                            <artifactId>geronimo-maven-plugin</artifactId>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    

Note that at the moment the -Pit doesn't actually work, you have to try to start the server by hand

  • No labels