Tim Moloney wrote:
I've written a pom.xml file that bundles commons-logging and all of
its dependencies into a Felix bundle (see below). I'm about to start
bundling other library-type jar files that I'll need so I'm looking
for any comments/critiques.
I'm still quite the newbie with Felix (and Maven) so I have a few
questions.
- I'm still fuzzy on what exact values I should use for groupId and
artifactId.
If you are just using this internally, then it probably doesn't matter,
you can use whatever you want. If the intent is for broader
distribution, then it is trickier. If the libraries you are bundling are
built with maven to begin with, then you can use their artifactId, but
you might want to change the groupId to be your own reverse domain. I
don't think there is any single answer here.
- Am I doing this the hard (or wrong) way?
For me, it is hard to judge. You could bundle the dependencies as JARs,
for example, but this it not necessarily better in all circumstances.
You could inline the JARs instead of embedding them so that the
resulting JAR is usable on the class path.
- Is there a way to automate this?
The maven-osgi-plugin automates some of it...no way to get it all
automated until we get it into the default maven build, but even then it
is likely that people will still repackage libs for specific purposes.
- Am I missing anything in my "bundling"?
- Are there any "best practices" issues that I should be aware of?
These are still evolving...maybe we will have better ideas once we get
Felix Commons off the ground...just talked with Enrique about this and
it sounds like he might be getting the time soon to get it going.
-> richard
Thanks,
Tim Moloney
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.commons.logging</groupId>
<artifactId>org.apache.commons.logging</artifactId>
<packaging>osgi-bundle</packaging>
<version>1.1</version>
<name>org.apache.commons.logging OSGi Bundle</name>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
<version>1.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix.plugins</groupId>
<artifactId>maven-osgi-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<osgiManifest>
<bundleName>${pom.name}</bundleName>
<bundleVendor>${pom.groupId}</bundleVendor>
<exportPackage>${pom.artifactId}</exportPackage>
<bundleDescription>${pom.name}</bundleDescription>
</osgiManifest>
</configuration>
</plugin>
</plugins>
</build>
</project>