Automated Build of RCP Artifacts with Maven Tycho - A field report (Part 2)

In my last post of this series, I described how to solve the dependency problem. In this post, I will describe how to build Eclipse Plugin and Eclipse Feature with Maven Tycho and which problems I have.

POM Definition

The procedure for both Eclipse artifacts is similar. In both, you have to insert a pom.xml and fill it with the Maven coordinate (group id, artifact id and version) and the packaging type. But there exists some rules about the content.

The packaging type is depended on what Eclipse artifact should be built:

Eclipse ArtifactPackaging Type
Eclipse Plugineclipse-plugin
Eclipse Featureeclipse-feature

The version specification in the POM is depended on the version specification in the manifest (in case of Eclipse plugin) and by the version specification in the feature.xml (in case of Eclipse feature) respectively:

MANIFEST.MF / feature.xmlpom.xmlDescription
1.5.1.qualifier1.5.1-SNAPSHOTDevelopment version
1.5.11.5.1Release version

The specification of the artifact id in the POM must be equal like the bundle symbolic name in the manifest (in case of Eclipse plugin) and by the specification of the id in the feature.xml (in case of Eclipse feature) respectively. That's all you need to define the pom.xml. Then call only mvn clean install and the Eclipse artifact is built by Maven Tycho.

Troubleshooting

I met two problems during the introduction of Maven Tycho for the building of Eclipse plugins. The first problem was that Maven Tycho sometimes throws a NullPointerException during the read-out of the manifest file. The reason is that a blank must be between the colon, that follows after the manifest header, and the command.

1# Don't
2Import-Package:com.library.*
3# Do
4Import-Package: com.library.*

The second problem was that Maven Tycho throws compiler error although everything is alright in Eclipse. The analyze of the error message shows that the command for the Import-Package in the manifest is not completed. A second analyze shows that package names of used Eclipse RCP artifacts are missing. After adding these missing package names in the manifest, Maven Tycho builds without error. But this also means that Eclipse does not generate the manifest osgi-compliantly.