diff --git a/build.xml b/build.xml
index b8f7a66a48..90d1cdc068 100644
--- a/build.xml
+++ b/build.xml
@@ -1593,6 +1593,14 @@ under the License.
Use ${dist.dir}/multisign.sh to create md5 checksums and GPG signatures
+
+
+
+
+
+
+
+
diff --git a/osgi/pom.xml b/osgi/pom.xml
new file mode 100644
index 0000000000..9b33aa84fd
--- /dev/null
+++ b/osgi/pom.xml
@@ -0,0 +1,226 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache
+ apache
+ 10
+
+
+
+ org.apache.poi
+ poi-bundle
+ bundle
+ Apache POI OSGi bundle
+
+ OSGi bundle that contains Apache POI, and the dependencies.
+
+ http://poi.apache.org/
+ ${poi.version}
+
+
+ 1.6
+ 1.6
+ 4.4.0
+
+
+
+
+ ${project.groupId}
+ poi
+ ${poi.version}
+
+
+ ${project.groupId}
+ poi-scratchpad
+ ${poi.version}
+
+
+ ${project.groupId}
+ poi-ooxml
+ ${poi.version}
+
+
+
+
+ junit
+ junit
+ 4.12
+
+
+ org.ops4j.pax.exam
+ pax-exam-junit4
+ ${pax.exam.version}
+ test
+
+
+ org.ops4j.pax.exam
+ pax-exam-container-native
+ ${pax.exam.version}
+ test
+
+
+ org.apache.felix
+ org.apache.felix.framework
+ 4.6.0
+ test
+
+
+ org.ops4j.pax.exam
+ pax-exam-link-assembly
+ ${pax.exam.version}
+ test
+
+
+ org.ops4j.pax.url
+ pax-url-aether
+ 2.3.0
+ test
+
+
+ javax.inject
+ javax.inject
+ 1
+ test
+
+
+ org.osgi
+ org.osgi.core
+ 5.0.0
+ test
+
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+
+ org.apache.poi.osgi.Activator
+
+
+ poi;inline=true,
+ poi-scratchpad;inline=true,
+ poi-ooxml;inline=true,
+ poi-ooxml-schemas,
+ xmlbeans
+
+ true
+ ${project.url}
+
+ org.apache.poi.*
+
+
+
+
+
+
+ maven-compiler-plugin
+ 3.2
+
+
+ ${maven.compiler.target}
+
+
+
+
+
+
+
+ java6
+
+ [1.6,)
+
+
+
+
+ maven-assembly-plugin
+
+
+ pre-integration-test
+
+ single
+
+
+ test-bundles.xml
+ test
+ false
+
+
+
+
+
+ maven-failsafe-plugin
+ 2.10
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
+ WARN
+
+
+
+
+
+
+
+
+
+
+ The Apache Software Founation
+ http://www.apache.org
+
+
+ http://svn.apache.org/viewvc/poi/trunk/osgi
+ scm:svn:http://svn.apache.org/repos/asf/poi/trunk/osgi
+ scm:svn:https://svn.apache.org/repos/asf/poi/trunk/osgi
+
+
diff --git a/osgi/src/test/java/org/apache/poi/osgi/TestOSGiBundle.java b/osgi/src/test/java/org/apache/poi/osgi/TestOSGiBundle.java
new file mode 100644
index 0000000000..738d96b994
--- /dev/null
+++ b/osgi/src/test/java/org/apache/poi/osgi/TestOSGiBundle.java
@@ -0,0 +1,84 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.osgi;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.options;
+
+import javax.inject.Inject;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Test to ensure that all our main formats can create, write
+ * and read back in, when running under OSGi
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class TestOSGiBundle {
+
+ private final File TARGET = new File("target");
+
+ @Inject
+ private BundleContext bc;
+
+ @Configuration
+ public Option[] configuration() throws IOException, URISyntaxException {
+ File base = new File(TARGET, "test-bundles");
+ return options(
+ junitBundles(),
+ bundle(new File(base, "poi-bundle.jar").toURI().toURL().toString()));
+ }
+
+ @Test
+ public void testHSSF() throws Exception {
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet s = wb.createSheet("OSGi");
+ s.createRow(0).createCell(0).setCellValue("With OSGi");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wb.write(baos);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+ wb = new HSSFWorkbook(bais);
+ assertEquals(1, wb.getNumberOfSheets());
+
+ s = wb.getSheet("OSGi");
+ assertEquals("With OSGi", s.getRow(0).getCell(0).toString());
+ }
+}
diff --git a/osgi/test-bundles.xml b/osgi/test-bundles.xml
new file mode 100644
index 0000000000..11502761e6
--- /dev/null
+++ b/osgi/test-bundles.xml
@@ -0,0 +1,34 @@
+
+
+ bundles
+
+ dir
+
+ false
+
+
+
+ ${artifact.artifactId}.jar
+
+ org.apache.poi:poi-bundle
+
+
+
+