diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-18 20:44:41 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-18 20:44:41 +0000 |
commit | a0a6a865e02dc43ef5e02a6e6fa4c906c60fd9a9 (patch) | |
tree | f75976ab8a02419f80744f3ffd5dfe4cdaffc346 /maven-plugins/trunk/maven-bundle-plugin | |
parent | 87caebc51228207698fb483260bd0482a347ba0d (diff) |
Add the support to override 3rd party bundles as plain jars
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@786257 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'maven-plugins/trunk/maven-bundle-plugin')
-rw-r--r-- | maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java | 24 |
1 files changed, 24 insertions, 0 deletions
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 a13734e316..7e9d0faea0 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 @@ -20,6 +20,7 @@ package org.apache.tuscany.maven.bundle.plugin; import static org.apache.tuscany.maven.bundle.plugin.BundleUtil.write; import static org.osgi.framework.Constants.BUNDLE_CLASSPATH; +import static org.osgi.framework.Constants.BUNDLE_VERSION; import java.io.File; import java.io.FileInputStream; @@ -323,6 +324,28 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { is.close(); getLog().info("MANIFEST.MF found for " + artifact + " (" + mf + ")"); return manifest; + } else { + getLog().info("Overriding the manifest for "+artifact); + Manifest manifest = BundleUtil.getManifest(artifact.getFile()); + Set<File> jarFiles = new HashSet<File>(); + jarFiles.add(artifact.getFile()); + String symbolicName = BundleUtil.getBundleSymbolicName(manifest); + if (symbolicName == null) { + // Not a bundle + continue; + } + String version = manifest.getMainAttributes().getValue(BUNDLE_VERSION); + manifest = + BundleUtil.libraryManifest(jarFiles, + symbolicName, + symbolicName, + version, + null, + this.eclipseBuddyPolicy, + this.executionEnvironment); + // Remove it as it will be added later on + manifest.getMainAttributes().remove(new Attributes.Name(BUNDLE_CLASSPATH)); + return manifest; } } } @@ -761,6 +784,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } ps.print(" "); ps.print(f); + // FIXME: We should not add @start for fragments if (generateBundleStart) { ps.print("@:start"); } |