Reputation: 4695
I have some Java/OSGi projects that I wish to build and package as a single Deployment Package.
I'm using Tycho to compile the sources for a particular target-platform, all dependencies are in a local p2 repository.
If I set <packaging>eclipse-plugin</packaging>
in my pom.xml the build goes fine but I get a .jar as output.
When I use maven-bundle-plugin and set <packaging>bundle</packaging>
the build breaks, because it compiles with the standard maven-compiler-plugin instead of Tycho.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>
javax.net;resolution:=optional,
javax.net.ssl;resolution:=optional
</Import-Package>
<Export-Package>my.project.package</Export-Package>
</instructions>
</configuration>
</plugin>
How do I force the compilation with Tycho? Or is there any other way to do what I need?
Upvotes: 0
Views: 1172
Reputation: 534
That answer may come a bit late, but I recently created a Maven plugin "de.dentrassi.maven:osgi-dp" which can create those "DP"s.
See: https://ctron.github.io/osgi-dp/plugin-info.html
You can either create a specialized "dp" packaging or re-use Eclipse Tycho's feature metadata:
<plugin>
<groupId>de.dentrassi.maven</groupId>
<artifactId>osgi-dp</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
For a full example of using Tycho for compiling and "osgi-dp" for creating the deployment package see the integration test at GitHub.
Upvotes: 2