Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Component

Last Release

First OSGi release

Notes / Comments

attributes

2.2

 

No m2 build

beanutils

1.8.0-BETA

 

 

betwixt

0.8

 

 

chain

1.1

 

 

cli

1.1

 

 

codec

1.3

 

 

collections

3.2

 

 

configuration

1.5

 

 

daemon

1.0.1

 

 

dbcp

1.2.2

 

 

dbutils

1.1

 

 

digester

1.8

 

 

discovery

0.4

 

 

el

1.0

 

 

email

1.1

 

 

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="61e742afe39c9d15-3d815463-45ae4847-9be98457-15ca21ec98453f7e3fb9084e"><ac:plain-text-body><![CDATA[

fileupload

1.2

1.2.1 m2,manual,pending

[http://felix.markmail.org/message/tgm45au3rpmpmfnf javax.portlet]

]]></ac:plain-text-body></ac:structured-macro>

io

1.3.2

1.4 m2,manual,pending

 

jci

1.0

 

 

jelly

1.0

 

No m2 build

jexl

1.1

 

 

jxpath

1.2

 

 

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ac140c7b6c20d3e9-17fd869e-45f64cfd-bdfa9b6b-1f3b2d5d5797d4e6b389914d"><ac:plain-text-body><![CDATA[

lang

2.3

 

Lang 2.4 looks imminent, see [https://issues.apache.org/jira/browse/LANG-402 LANG-402]

]]></ac:plain-text-body></ac:structured-macro>

launcher

1.1

 

 

logging

1.1.1

 

OSGi is N/A; See Below

math

1.1

 

 

modeler

2.0.1

 

 

net

1.4.1

 

 

pool

1.3

1.4 (m1, manual)

 

primitives

1.0

 

 

proxy

No yet released

 

 

scxml

0.7

 

 

transaction

1.2

 

 

validator

1.3.1

 

 

vfs

1.0

 

 

...

Wiki Markup
The things that commons-logging does with classloaders in order to try and work in various servlet engine configurations are not compatible with the classloaders that OSGi environments set up. Therefore adding OSGi attributes to commons-logging is not useful, as commons-logging is not usable in an OSGi environment. 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

No Format
 <packaging>bundle</packaging> 

element in the pom and configure the plugin in the

No Format
 <build> 

section, for example for Commons Lang

No Format

      <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
    No Format
     <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

No Format

      <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>