diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-03 07:42:24 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-03 07:42:24 +0000 |
commit | d9f9744d20d014b53e44b38935e13be68820bcce (patch) | |
tree | 37efe79b0b6fcecb83e24a4f6e74a71dcbcf22af /maven-plugins/trunk/maven-bundle-plugin | |
parent | 424717567fba5e86d4ab307d4e0b73e59a1fa84e (diff) |
TUSCANY-2873: Apply patch from Hasan Ceylan for Wrapping of non-OSGi components creates versions that may makes no-sense
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@749551 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'maven-plugins/trunk/maven-bundle-plugin')
2 files changed, 28 insertions, 2 deletions
diff --git a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java index 446e407523..7394550604 100644 --- a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java +++ b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java @@ -101,6 +101,22 @@ final class BundleUtil { * @throws IllegalStateException */ static Manifest libraryManifest(Set<File> jarFiles, String name, String symbolicName, String version, String dir) + throws IllegalStateException { + return libraryManifest(jarFiles, name, symbolicName, version, dir, null); + } + /** + * Generate a Bundle manifest for a set of JAR files. + * + * @param jarFiles + * @param name + * @param symbolicName + * @param version + * @param dir + * @param buddyPolicy + * @return + * @throws IllegalStateException + */ + static Manifest libraryManifest(Set<File> jarFiles, String name, String symbolicName, String version, String dir, String buddyPolicy) throws IllegalStateException { try { @@ -143,6 +159,9 @@ final class BundleUtil { attributes.putValue(BUNDLE_NAME, name); attributes.putValue(BUNDLE_VERSION, version); attributes.putValue(DYNAMICIMPORT_PACKAGE, "*"); + if (buddyPolicy != null && buddyPolicy.length() > 0){ + attributes.putValue("Eclipse-BuddyPolicy", buddyPolicy); + } if (exports.length() > 1) { attributes.putValue(EXPORT_PACKAGE, exports.substring(0, exports.length() - 1)); } @@ -178,6 +197,7 @@ final class BundleUtil { write(attributes, BUNDLE_CLASSPATH, dos); write(attributes, IMPORT_PACKAGE, dos); write(attributes, EXPORT_PACKAGE, dos); + write(attributes, "Eclipse-BuddyPolicy", dos); dos.flush(); } diff --git a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java index d2f2b1a9d1..f7eff045a8 100644 --- a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java +++ b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java @@ -232,6 +232,12 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { */ private ArtifactAggregation[] artifactAggregations; + /** + * Inserts a generic Eclipse-BuddyPolicy header into generated artifacts manifests + * @parameter default-value="dependent" + */ + private String genericBuddyPolicy = "dependent"; + private static final String XML_PI = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; private static final String ASL_HEADER = "<!--" @@ -462,7 +468,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { Set<File> jarFiles = new HashSet<File>(); jarFiles.add(artifactFile); String symbolicName = (artifact.getGroupId() + "." + artifact.getArtifactId()); - Manifest mf = BundleUtil.libraryManifest(jarFiles, symbolicName, symbolicName, version, null); + Manifest mf = BundleUtil.libraryManifest(jarFiles, symbolicName, symbolicName, version, null, this.genericBuddyPolicy); File file = new File(dir, "META-INF"); file.mkdirs(); file = new File(file, "MANIFEST.MF"); @@ -495,7 +501,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { copyFile(a.getFile(), dir); jarNames.add(a, symbolicName + "-" + version + "/" + a.getFile().getName()); } - Manifest mf = BundleUtil.libraryManifest(jarFiles, symbolicName, symbolicName, version, null); + Manifest mf = BundleUtil.libraryManifest(jarFiles, symbolicName, symbolicName, version, null, this.genericBuddyPolicy); File file = new File(dir, "META-INF"); file.mkdirs(); file = new File(file, "MANIFEST.MF"); |