commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Commons Wiki] Update of "CommonsOsgi" by NiallPemberton
Date Thu, 17 Jan 2008 11:11:00 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.

The following page has been changed by NiallPemberton:
http://wiki.apache.org/commons/CommonsOsgi

------------------------------------------------------------------------------
  See [http://commons.markmail.org/message/kdnjlbokvuiigcew this thread] and
  [http://wiki.ops4j.org/dokuwiki/doku.php?id=pax:logging Pax-logging]
  
+ == Configuring OSGi with Maven2 ==
+ There are two ways to do this:
+  * ''Bundle Plugin'' - using the Apache Felix project's bundle Plugin
+  * ''Manually'' - configuring the {{{maven-jar-plugin}}} with OSGi manifest entries
+ 
+ === Felix's Maven2 Bundle Plugin ===
+ To configure the plugin, specify a {{{ <packaging>bundle</packaging> }}} element
in the pom
+ and configure the plugin in the {{{ <build> }}} section, for example for Commons Lang
+ {{{
+       <plugin>
+         <groupId>org.apache.felix</groupId>
+         <artifactId>maven-bundle-plugin</artifactId>
+         <version>1.1.0-SNAPSHOT</version>
+         <extensions>true</extensions>
+         <configuration>
+           <excludeDependencies>true</excludeDependencies>
+           <instructions>
+             <Bundle-SymbolicName>org.apache.commons.lang</Bundle-SymbolicName>
+             <Export-Package>*;version=${pom.version}</Export-Package>
+           </instructions>
+         </configuration>
+       </plugin>
+ }}}
+ 
+ '''Notes:'''
+  * {{{<extensions>true</extensions>}}} needs to be specified otherwise the {{{
<packaging>bundle</packaging> }}} is not recognized and causes an error with the
message ''Cannot find lifecycle mapping for packaging '''bundle'''''
+  * {{{<excludeDependencies>true</excludeDependencies>}}} prevents all the component's
dependencies classes being included in the jar
+  * Other '''''Manifest''''' entries are inherited from the commons-parent pom
+ 
+ === Configuring via the jar plugin ===
+ 
+ {{{
+       <plugin>
+         <artifactId>maven-jar-plugin</artifactId>
+         <configuration>
+           <archive>
+             <manifestEntries>
+               <Bundle-SymbolicName>org.apache.commons.lang</Bundle-SymbolicName>
+               <Bundle-License>http://www.apache.org/licenses/LICENSE-2.0.txt</Bundle-License>
+               <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+               <Bundle-Name>Apache Commons Lang Bundle</Bundle-Name>
+               <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
+               <Bundle-Version>${project.version}</Bundle-Version>
+               <Export-Package>
+ org.apache.commons.lang;version=${project.version},
+ org.apache.commons.lang.builder;version=${project.version},
+ org.apache.commons.lang.enum;version=${project.version},
+ org.apache.commons.lang.enums;version=${project.version},
+ org.apache.commons.lang.exception;version=${project.version},
+ org.apache.commons.lang.math;version=${project.version},
+ org.apache.commons.lang.mutable;version=${project.version},
+ org.apache.commons.lang.text;version=${project.version},
+ org.apache.commons.lang.time;version=${project.version}
+               </Export-Package>
+               <Import-Package>
+ org.apache.commons.lang;version=${project.version},
+ org.apache.commons.lang.builder;version=${project.version},
+ org.apache.commons.lang.enum;version=${project.version},
+ org.apache.commons.lang.enums;version=${project.version},
+ org.apache.commons.lang.exception;version=${project.version},
+ org.apache.commons.lang.math;version=${project.version},
+ org.apache.commons.lang.mutable;version=${project.version},
+ org.apache.commons.lang.text;version=${project.version},
+ org.apache.commons.lang.time;version=${project.version}
+               </Import-Package>
+             </manifestEntries>
+           </archive>
+         </configuration>
+       </plugin>
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message