Modified <ignorePackage> tag occur inside the <configuration> tag instead
of the <osgiManifest> tag, since this is more intuitive to me, i.e.,
configuration data goes in configuration while actual manifest entries
go in osgiManifest. Currently, it still accepts <ignorePackage> inside
<osgiManifest>, but it will issue a warning if used.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@416025 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
index e91a74e..8f226aa 100644
--- a/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
+++ b/tools/maven2/maven-osgi-plugin/src/main/java/org/apache/felix/tools/maven/plugin/OsgiJarMojo.java
@@ -56,6 +56,13 @@
private List inlinedArtifacts = new ArrayList();
/**
+ * Packages to ignore when generating import-package header.
+ *
+ * @parameter
+ */
+ private String ignorePackage;
+
+ /**
* The Maven project.
*
* @parameter expression="${project}"
@@ -235,8 +242,8 @@
}
// Remove any ignored packages from the referred set.
- Set ignorePackage = parseIgnorePackage();
- referred.removeAll(ignorePackage);
+ Set ignorePackageSet = parseIgnorePackage();
+ referred.removeAll(ignorePackageSet);
// If the POM file contains an import declaration,
// we verify its validity. Otherwise, we generate the
@@ -689,9 +696,14 @@
private Set parseIgnorePackage() {
HashSet result = new HashSet();
- String pkgs = osgiManifest.getIgnorePackage();
- if (pkgs != null) {
- StringTokenizer st = new StringTokenizer(pkgs, ",", false);
+ if ((ignorePackage == null) && (osgiManifest.getIgnorePackage() != null)) {
+ ignorePackage = osgiManifest.getIgnorePackage();
+ getLog().warn("DEPRECATED METADATA! "
+ + "The <ignorePackage> tag should be set inside the <configuration> "
+ + "tag, not in the <osgiManifest> tag.");
+ }
+ if (ignorePackage != null) {
+ StringTokenizer st = new StringTokenizer(ignorePackage, ",", false);
while (st.hasMoreTokens()) {
result.add(st.nextToken().trim());
}