try {
servletDescriptor = getClass().getResourceAsStream("SimpleServlet.xml");
</BUG>
project.createOrUpdateFile(Path.fromPortableString("src/OSGI-INF/SimpleServlet.xml"), servletDescriptor);
<BUG>} finally {
IOUtils.closeQuietly(servletDescriptor);
}</BUG>
OsgiBundleManifest manifest = OsgiBundleManifest.symbolicName("test.bundle001").version("1.0.0.SNAPSHOT")
.name("Test bundle").serviceComponent("OSGI-INF/SimpleServlet.xml")
.importPackage("javax.servlet,org.apache.sling.api,org.apache.sling.api.servlets");

MavenDependency slingApiDep = new MavenDependency().groupId("org.apache.sling")
.artifactId("org.apache.sling.api").version("2.2.0");
MavenDependency servletApiDep = new MavenDependency().groupId("javax.servlet").artifactId("servlet-api")
.version("2.4");
project.configureAsJavaProject(slingApiDep, servletApiDep);
InputStream simpleServlet = getClass().getResourceAsStream("SimpleServlet.java.v1.txt");
project.createOrUpdateFile(Path.fromPortableString("src/example/SimpleServlet.java"), simpleServlet);
InputStream servletDescriptor = getClass().getResourceAsStream("SimpleServlet.xml");
project.createOrUpdateFile(Path.fromPortableString("src/OSGI-INF/SimpleServlet.xml"), servletDescriptor);
OsgiBundleManifest manifest = OsgiBundleManifest.symbolicName("test.bundle001").version("1.0.0.SNAPSHOT")
.name("Test bundle").serviceComponent("OSGI-INF/SimpleServlet.xml")
.importPackage("javax.servlet,org.apache.sling.api,org.apache.sling.api.servlets");
