diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 00:31:57 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 00:31:57 +0000 |
commit | 0a4872e0a9def162e6ce1ecf379b1ffce0d53f8e (patch) | |
tree | 6d0ed6d30240888a2d5884c07041bb2c8acac552 | |
parent | 0491f669ce7f70b5b45476d311bdfe018d6bea24 (diff) |
Added comments to maven bundle plugin. Removed obsolete plugin.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@707234 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 5 insertions, 120 deletions
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 45135b4748..bcbd6ed7b3 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 @@ -35,15 +35,18 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; /** + * A Maven plugin that builds an OSGi bundle for the project's third-party dependencies. + * * @version $Rev$ $Date$ * @goal assemble-thirdparty-bundle * @phase generate-resources * @requiresDependencyResolution test - * @description Build an OSGi bundle for third party dependencies + * @description Build an OSGi bundle for the project's third party dependencies */ public class ThirdPartyBundleBuildMojo extends AbstractMojo { + /** - * The project to create a build for. + * The project to build the bundle for. * * @parameter expression="${project}" * @required @@ -61,10 +64,6 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Log log = getLog(); - if (project.getPackaging().equals("pom")) { - return; - } - String projectGroupId = project.getGroupId(); Set<File> jarFiles = new HashSet<File>(); for (Object o : project.getArtifacts()) { 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 deleted file mode 100644 index 4eab9a82ec..0000000000 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.tools.bundle.plugin; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.Writer; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.project.MavenProject; - -/** - * @version $Rev$ $Date$ - * @goal generate-pde-classpath - * @phase process-resources - * @requiresDependencyResolution test - * @description Adjust third party bundle classpath - */ -public class ThirdPartyBundleClasspathGeneratorMojo extends AbstractMojo { - /** - * The project to create a build for. - * - * @parameter expression="${project}" - * @required - * @readonly - */ - private MavenProject project; - - /** - * The basedir of the project. - * - * @parameter expression="${basedir}" - * @required @readonly - */ - private File basedir; - - public void execute() throws MojoExecutionException { - Log log = getLog(); - - if (project.getPackaging().equals("pom")) { - return; - } - - 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); - for (;;) { - String line = reader.readLine(); - if (line == null) { - break; - } - if(line.contains("kind=\"lib\"") || line.contains("kind=\"var\"")) { - // Skip kind="lib", kind="var" - continue; - } - if (line.contains("</classpath>")) { - log.info("Adding lib classpath entries ..."); - // Generate the lib classpath entries before the </classpath> - generateLibClasspathEntries(printer); - } - printer.println(line); - } - reader.close(); - Writer writer = new OutputStreamWriter(new FileOutputStream(classpath)); - writer.write(buffer.toString()); - writer.close(); - - } catch (Exception e) { - throw new MojoExecutionException(e.getMessage(), e); - } - - } - - 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() + "\"/>"); - } - } - -} |