commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Sanchez" <car...@apache.org>
Subject Re: Support for OSGi
Date Fri, 28 Dec 2007 14:39:04 GMT
Two things:

- if the bundle plugin could be released, it'd be great, if not
projects won't be able to make a release

- my approach to add an osgified manifest to the current project is
different in order not to change the packaging to bundle. bundle
packaging only needs to be used to osgify 3rd party libraries. The
manifest goal of the bundle plugin will generate the OSGi manifest for
any maven project.

          <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <configuration>
              <instructions>
                <Export-Package>*;version=${pom.version}</Export-Package>
              </instructions>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>manifest</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Needed for including the manifest, see MJAR-71 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.1</version>
            <configuration>
              <archive>

<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
              </archive>
            </configuration>
          </plugin>


On Dec 28, 2007 1:35 PM, Carsten Ziegeler <cziegeler@apache.org> wrote:
> Hi,
>
> in the meantime Stuart fixed the problem with the maven bundleplugin, so
> I think we can give it a test drive :)
>
> Attached is a patch for the parent pom of commons and one to demonstrate
> how to add support for OSGi to commons-lang.
>
> The changes to the parent pom are minimal: it just adds the maven
> bundleplugin from the Apache Felix project. We currently need to use a
> snapshot version, but a release is comming soon.
> Besides adding the plugin, the patch also configures the bundle symbolic
> name for all modules. The symbolic name is the unique identifier which
> should follow java package naming. The best value is to use something
> like "org.apache.commons.{artifactId}" where artifact id is commons-lang
> or commons-collections etc.
>
> The patch to commons lang is also very simple. It changes the parent pom
> to the current snapshot (which includes the changes from above) and sets
> the packaging to bundle - this ensures that the bundleplugin runs and
> creates the resulting jar file. So the bundleplugin replaces the maven
> jar plugin. If you leave the packaging as "jar" the bundleplugin will
> not run.
> The last part of the patch adds the configuration to the bundleplugin.
> The export "*" exports all packages definied in this module for other
> bundles, so all classes are public. All packages are marked with the
> current version which allows to run different versions in parallel.
> The imports are not specified as they are calculated automatically by
> the bundleplugin.
>
> And that's it :)
>
> The changes to the other projects should be similar.
>
>
> Carsten
>
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>
> Index: /Users/cziegeler/Developer/workspaces/default/commons-proper/commons-parent/pom.xml
> ===================================================================
> --- /Users/cziegeler/Developer/workspaces/default/commons-proper/commons-parent/pom.xml
(revision 605909)
> +++ /Users/cziegeler/Developer/workspaces/default/commons-proper/commons-parent/pom.xml
(working copy)
> @@ -159,6 +159,12 @@
>            <artifactId>maven-release-plugin</artifactId>
>            <version>2.0-beta-7</version>
>          </plugin>
> +        <plugin>
> +          <groupId>org.apache.felix</groupId>
> +          <artifactId>maven-bundle-plugin</artifactId>
> +          <version>1.1.0-SNAPSHOT</version>
> +          <inherited>true</inherited>
> +        </plugin>
>        </plugins>
>      </pluginManagement>
>      <plugins>
> @@ -194,6 +200,15 @@
>            <jdkLevel>${maven.compile.source}</jdkLevel>
>          </configuration>
>        </plugin>
> +      <plugin>
> +        <groupId>org.apache.felix</groupId>
> +        <artifactId>maven-bundle-plugin</artifactId>
> +        <configuration>
> +          <instructions>
> +            <Bundle-SymbolicName>org.apache.commons.${pom.artifactId}</Bundle-SymbolicName>
> +          </instructions>
> +        </configuration>
> +      </plugin>
>      </plugins>
>    </build>
>
>
> Index: /Users/cziegeler/Developer/workspaces/default/commons-proper/lang/pom.xml
> ===================================================================
> --- /Users/cziegeler/Developer/workspaces/default/commons-proper/lang/pom.xml   (revision
605909)
> +++ /Users/cziegeler/Developer/workspaces/default/commons-proper/lang/pom.xml   (working
copy)
> @@ -22,13 +22,14 @@
>    <parent>
>      <groupId>org.apache.commons</groupId>
>      <artifactId>commons-parent</artifactId>
> -    <version>5</version>
> +    <version>6-SNAPSHOT</version>
>    </parent>
>    <modelVersion>4.0.0</modelVersion>
>    <groupId>commons-lang</groupId>
>    <artifactId>commons-lang</artifactId>
>    <version>2.4-SNAPSHOT</version>
>    <name>Commons Lang</name>
> +  <packaging>bundle</packaging>
>
>    <inceptionYear>2001</inceptionYear>
>      <description>
> @@ -401,6 +402,16 @@
>            <tarLongFileMode>gnu</tarLongFileMode>
>          </configuration>
>        </plugin>
> +      <plugin>
> +        <groupId>org.apache.felix</groupId>
> +        <artifactId>maven-bundle-plugin</artifactId>
> +        <extensions>true</extensions>
> +        <configuration>
> +          <instructions>
> +            <Export-Package>*;version=${pom.version}</Export-Package>
> +          </instructions>
> +        </configuration>
> +      </plugin>
>      </plugins>
>    </build>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>



-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

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


Mime
View raw message