Should Maven and Target Platform package versions match?

I’ve come across something which I think is a bug, perhaps in the Maven artifacts.

I’m making an OSGi application, which uses servlets. I created the OSGi project from the Maven archetype for Liberty OSGi-enabled Web 3.1 projects, so it’s using `maven-bundle-plugin` to build the manifest.

My Target Platform in Eclipse (+WDT) is set up to point to my Liberty 16.0.0.4 installation. Equally, my `pom.xml` has a dependency on `net.wasdev.maven.tools.targets:liberty-target:16.0.0.4`.

The IDE does the Maven build of the `pom.xml` into the generated `MANIFEST.MF`. However, there’s a problem. The `MANIFEST.MF` is generated with the following statement:

Import-Package:
javax.servlet;version=”[3.1,4)”,
javax.servlet.annotation;version=”[3.1,4)”,
javax.servlet.http;version=”[3.1,4)”
Note that the imports are at version 3.1 and higher, because that’s the version found in Maven. However, the Target Platform bundle `com.ibm.websphere.javaee.servlet.3.1` exports those packages at version 2.7.

This results in the tooling breaking – I get errors in the `MANIFEST.MF` in the IDE – but worse, of course, the `Import-Package` statements are not available in the runtime, and the application will not start.

Related:

Leave a Reply