5.4. Creating a new web bundle

Most development tasks are straight forward, plain Eclipse PDE development. However, due to the fact that the Jetty setup with JSP is a bit tricky, creating a new bundle which provided a new web controller requires a few extra steps.

First create a plain new OSGi project (Plug-in Project) and then convert the project to the faceted form using Convert to Faceted Form… in the sub-menu Configure of the context menu of this project. Select to have only the Java and Dynamic web project facet active. Be sure that you enable Java 8 for both the Plugin project settings and the Java Facet. You can delete the WebContent directory which was created. It is not used.

[Note]WEB-INF directory

There will be a second WEB-INF directory created under WebContent. Do not use this directory. Jetty will ignore it. If you need a WEB-INF directory, then it must be in the root of the bundle.

Next edit the MANIFEST.MF and add the following attributes:

Eclipse-BundleShape: dir

This will tell Maven Tycho to tell P2 to unpack the bundle when installing. This is required so that Jetty can find the JSP pages later on.