From 9e9ea93f12c82796d24df2c24817a8a43e355e0f Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Wed, 15 Oct 2008 01:56:22 +0000 Subject: Added a parameter to the bundle plugin to allow configuration of the bundle symbolic name. Use that parameter in thirdparty-library/pom.xml. Ignore .classpath file if it doesn't exist yet. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@704767 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-equinox/modules/thirdparty-library/pom.xml | 3 +++ .../org/apache/tuscany/sca/tools/bundle/plugin/BundleUtil.java | 4 ++-- .../sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java | 9 ++++++++- .../bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) (limited to 'branches') diff --git a/branches/sca-equinox/modules/thirdparty-library/pom.xml b/branches/sca-equinox/modules/thirdparty-library/pom.xml index e99e73c0d5..63893af9d5 100644 --- a/branches/sca-equinox/modules/thirdparty-library/pom.xml +++ b/branches/sca-equinox/modules/thirdparty-library/pom.xml @@ -63,6 +63,9 @@ assemble-thirdparty-bundle + + org.apache.tuscany.sca.thirdparty.library + diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/BundleUtil.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/BundleUtil.java index a93b6b29fe..ea9a206436 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/BundleUtil.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/BundleUtil.java @@ -124,7 +124,7 @@ final class BundleUtil { } } - static Manifest libraryManifest(Set jarFiles, String name, String version) + static Manifest libraryManifest(Set jarFiles, String name, String symbolicName, String version) throws IllegalStateException { try { @@ -162,7 +162,7 @@ final class BundleUtil { Attributes attributes = manifest.getMainAttributes(); attributes.putValue("Manifest-Version", "1.0"); attributes.putValue(BUNDLE_MANIFESTVERSION, "2"); - attributes.putValue(BUNDLE_SYMBOLICNAME, name); + attributes.putValue(BUNDLE_SYMBOLICNAME, symbolicName); attributes.putValue(BUNDLE_NAME, name); attributes.putValue(BUNDLE_VERSION, version); attributes.putValue(DYNAMICIMPORT_PACKAGE, "*"); diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java index 3837a5a902..ccd29e4cd6 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java @@ -153,6 +153,13 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { */ private ArtifactResolver artifactResolver; + /** + * The bundle symbolic name + * + * @parameter + */ + private String symbolicName; + public void execute() throws MojoExecutionException { Log log = getLog(); @@ -232,7 +239,7 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { version = version.substring(0, version.length() - Artifact.SNAPSHOT_VERSION.length() - 1); } - Manifest mf = BundleUtil.libraryManifest(jarFiles, project.getName(), version); + Manifest mf = BundleUtil.libraryManifest(jarFiles, project.getName(), symbolicName, version); File file = new File(project.getBasedir(), "META-INF"); file.mkdir(); file= new File(file, "MANIFEST.MF"); diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java index 7f4ba1a284..159949242d 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java @@ -80,6 +80,9 @@ public class ThirdPartyBundleClasspathGeneratorMojo extends AbstractMojo { try { // Adjust .classpath, make all classpath entries point to the lib directory File classpath = new File(basedir, ".classpath"); + if (!classpath.exists()) { + return; + } BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(classpath))); StringWriter buffer = new StringWriter(); PrintWriter printer = new PrintWriter(buffer); -- cgit v1.2.3