diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-12 22:52:23 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-12 22:52:23 +0000 |
commit | 8a2a5bb4dfbb51f3f9fbee65f47842b9c6fbdcd0 (patch) | |
tree | 6f8af35d7996308884cafdeb431d657263be4359 /branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca | |
parent | e6f73af13606745960a681ed702f4e05a86f19d7 (diff) |
Changed maven bundle plugin to generate classpath off the list of JARs in the third-party bundle's lib directory. It now generates a correct .classpath that makes the PDE happy.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703895 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java (renamed from branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleFixupClasspathMojo.java) | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleFixupClasspathMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java index 5f5bd030a4..7f4ba1a284 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleFixupClasspathMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java @@ -47,12 +47,12 @@ import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; /** * @version $Rev$ $Date$ - * @goal fixup-pde-classpath + * @goal generate-pde-classpath * @phase process-resources * @requiresDependencyResolution test * @description Adjust third party bundle classpath */ -public class ThirdPartyBundleFixupClasspathMojo extends AbstractMojo { +public class ThirdPartyBundleClasspathGeneratorMojo extends AbstractMojo { /** * The project to create a build for. * @@ -82,26 +82,19 @@ public class ThirdPartyBundleFixupClasspathMojo extends AbstractMojo { File classpath = new File(basedir, ".classpath"); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(classpath))); StringWriter buffer = new StringWriter(); - PrintWriter printer = new PrintWriter(buffer); + PrintWriter printer = new PrintWriter(buffer); + boolean generatedLib = false; for (;;) { String line = reader.readLine(); if (line == null) { break; } - int i = line.indexOf("kind=\"var\""); - if (i != -1) { - line = line.substring(0, i) + "kind=\"lib\" exported=\"true\"" + line.substring(i+10); - - i = line.indexOf("path=\""); - if (i != -1) { - int e = line.indexOf("\"", i+6); - String path = line.substring(i + 6, e); - int s = path.lastIndexOf("/"); - if (s != -1) { - path = "lib" + path.substring(s); - line = line.substring(0, i) + "path=\"" + path + line.substring(e); - } + if (line.contains("kind=\"var\"")) { + if (!generatedLib) { + generateLibClasspathEntries(printer); + generatedLib = true; } + continue; } printer.println(line); } @@ -116,4 +109,14 @@ public class ThirdPartyBundleFixupClasspathMojo extends AbstractMojo { } + private void generateLibClasspathEntries(PrintWriter printer) { + File lib = new File(basedir, "lib"); + for (File jar: lib.listFiles()) { + if (!jar.getPath().endsWith(".jar")) { + continue; + } + printer.println(" <classpathentry exported=\"true\" kind=\"lib\" path=\"lib/" + jar.getName() + "\"/>"); + } + } + } |