In my last post of this serie, 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.
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 by what Eclipse artifact should be built:
|Eclipse Artifact||Packaging Type|
The version specification in the POM is depended by 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.xml||pom.xml||Description|
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.
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.
# Don't Import-Package:com.library.* # Do Import-Package: com.library.*
The second problem was that Maven Tycho throws compiler error althought everything is alright in Eclipse. The analyse of the error message shows that the command for the Import-Package in the manifest is not completed. A second analyse 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.