Hi Dave,
I am not sure profiles are a better option for OSGi bundles.
That was what I used to try to build the OSGi bundle and keep it out of the way.
"Profiles are specified using a subset of the elements available in the POM itself (plus one extra section), and are triggered in any of a variety of ways. They modify the POM at build time, and are
meant to be used in complementary sets to give equivalent-but-different parameters for a set of target environments (providing, for example, the path of the appserver root in the development, testing,
and production environments). As such, profiles can easily lead to differing build results from different members of your team. However, used properly, profiles can be used while still preserving
project portability. This will also minimize the use of -f option of maven which allows user to create another POM with different parameters or configuration to build which makes it more maintainable
since it is runnning with one POM only."
-- http://maven.apache.org/guides/introduction/introduction-to-profiles.html
You activate a profile using the -P option
mvn -P profile-1,profile-2 ...
Your idea about using assembly could be a better approach, if possible.
Reto also pointed us at how Clerezza do this (I've not look at the details
yet), we should look at it as well.
Paolo
Dave Reynolds wrote:
Hi Paolo,
On Thu, 2011-04-07 at 02:31 +0100, Paolo Castagna wrote:
Hi Dave,
not being an OSGi expert, this is what I've tried to do at the time in the Jena
pom.xml file:
<profile>
<id>OSGi</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
However, as far as I remember, there wasn't a great deal of feedback about it.
Not being a Maven person I don't understand what the profiles do or how
to invoke them or how that integrates with the rest of the build
process :)
However, presumably it would only create a jena.jar with a default
bundle manifest. I guess that's better than nothing but doesn't really
help that much. Rather than have to load all the Jena dependent jars in
as separate bundles it's more convenient to have a jena bundle that
includes them (or at least the ones that aren't likely to already be
present). Which is what the pom example I showed does, Clerezza's looks
very similar.
Dave