Generate an enhanced manifest for OSGi support (#394)
* Generate an enhanced manifest for OSGi support
Fixes #390
* Move bnd-maven-plugin version to parent pom
diff --git a/javaparser-core/bnd.bnd b/javaparser-core/bnd.bnd
new file mode 100644
index 0000000..23ffe85
--- /dev/null
+++ b/javaparser-core/bnd.bnd
@@ -0,0 +1,17 @@
+# Make the Bundle-SymbolicName fully qualified, not just the artifact id
+Bundle-SymbolicName: com.github.javaparser.javaparser-core
+
+# Export all packages except impl
+-exportcontents: \
+ com.github.javaparser, \
+ com.github.javaparser.ast, \
+ com.github.javaparser.ast.body, \
+ com.github.javaparser.ast.comments, \
+ com.github.javaparser.ast.expr, \
+ com.github.javaparser.ast.stmt, \
+ com.github.javaparser.ast.type, \
+ com.github.javaparser.ast.visitor
+
+# Don't use the project's version for the packages
+# We prefer not setting a version as we don't follow OSGi version semantics
+-nodefaultversion: true
diff --git a/javaparser-core/pom.xml b/javaparser-core/pom.xml
index 59e8a6c..ef49417 100644
--- a/javaparser-core/pom.xml
+++ b/javaparser-core/pom.xml
@@ -107,7 +107,31 @@
</dependency>
</dependencies>
</plugin>
+ <!-- Generate an OSGi-enabled MANIFEST during the build -->
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-maven-plugin</artifactId>
+ <version>${bnd-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>bnd-process</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Make sure the bnd-generated manifest is picked up, see MJAR-193 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>${maven-jar-plugin.version}</version>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/pom.xml b/pom.xml
index ffa0730..7a45f1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,6 +126,7 @@
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
<maven-jacoco-plugin.version>0.7.7.201606060606</maven-jacoco-plugin.version>
<maven-coveralls-plugin.version>4.2.0</maven-coveralls-plugin.version>
+ <bnd-maven-plugin.version>3.2.0</bnd-maven-plugin.version>
</properties>
<scm>