2010/8/25 Hugues Malphettes
<hmalphettes@xxxxxxxxxxx>
Matthias,
It sounds like we face the same situation than you with jetty.
Here is how we do it:
In the root pom:
<build>
<plugins>
<!-- source maven plugin creates the source bundle and adds manifest -->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>process-classes</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifestEntries>
<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-SymbolicName>${bundle-symbolic-name}.source;singleton:=true</Bundle-SymbolicName>
<Bundle-Vendor>Eclipse.org - Jetty</Bundle-Vendor>
<Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
<Eclipse-SourceBundle>${bundle-symbolic-name};version="${parsedVersion.osgiVersion}";roots:="."</Eclipse-SourceBundle>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<!-- Build helper maven plugin sets the
parsedVersion.osgiVersion property -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>set-osgi-version</id>
<phase>validate</phase>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
(...)
For each one of the jars:
<properties>
<bundle-symbolic-name>org.acme.example</bundle-symbolic-name>
</properties>
If your artifactId matches the symbolic name then you could replace
${bundle-symbolic-name} by ${artifactId} and the whole source-bundle
generation would be defined in the root pom.xml alone.
Thanks a lot Hugues, with your great hints and examples we now managed to create
source bundles for jgit and egit :