From 541d9fe3f3566bf2379c03727d442a23af095dcc Mon Sep 17 00:00:00 2001 From: "Frederick G. Oconer" Date: Fri, 4 Aug 2006 07:25:02 +0000 Subject: [PATCH] AMQ-858: create a super pom for tooling projects in activemq so we can create a nightly build of the various maven plugins. Also moved the maven-bundle-plugin and maven-gram-plugin to tooling. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@428653 13f79535-47bb-0310-9956-ffa450edef68 --- maven-bundle-plugin/pom.xml | 69 --------- .../org/apache/activemq/maven/BundleMojo.java | 132 ---------------- maven-gram-plugin/pom.xml | 104 ------------- .../org/apache/activemq/maven/GramMojo.java | 146 ------------------ tooling/pom.xml | 41 +++++ 5 files changed, 41 insertions(+), 451 deletions(-) delete mode 100644 maven-bundle-plugin/pom.xml delete mode 100644 maven-bundle-plugin/src/main/java/org/apache/activemq/maven/BundleMojo.java delete mode 100644 maven-gram-plugin/pom.xml delete mode 100644 maven-gram-plugin/src/main/java/org/apache/activemq/maven/GramMojo.java create mode 100644 tooling/pom.xml diff --git a/maven-bundle-plugin/pom.xml b/maven-bundle-plugin/pom.xml deleted file mode 100644 index eca6af620c..0000000000 --- a/maven-bundle-plugin/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.activemq - activemq-parent - 4.1-incubator-SNAPSHOT - - - maven-bundle-plugin - maven-plugin - Bundle Plugin - - - - org.apache.maven - maven-project - 2.0 - - - org.codehaus.plexus - plexus-archiver - 1.0-alpha-5 - - - org.apache.maven - maven-archiver - 2.0 - - - org.apache.maven - maven-plugin-api - 2.0 - - - org.codehaus.plexus - plexus-utils - 1.1 - - - org.apache.maven - maven-artifact - 2.0 - - - diff --git a/maven-bundle-plugin/src/main/java/org/apache/activemq/maven/BundleMojo.java b/maven-bundle-plugin/src/main/java/org/apache/activemq/maven/BundleMojo.java deleted file mode 100644 index b9b6fd5e62..0000000000 --- a/maven-bundle-plugin/src/main/java/org/apache/activemq/maven/BundleMojo.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.apache.activemq.maven; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.archiver.ArchiverException; -import org.codehaus.plexus.archiver.UnArchiver; -import org.codehaus.plexus.archiver.manager.ArchiverManager; -import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; -import org.codehaus.plexus.util.FileUtils; - -/** - * @goal createbundle - * @description Creates an xfire bundle - */ -public class BundleMojo extends AbstractMojo -{ - /** - * The output directory of the assembled distribution file. - * - * @parameter expression="${project.build.outputDirectory}" - * @required - */ - protected File outputDirectory; - - /** - * Inclusion list - * - * @parameter - */ - String includes = ""; - - /** - * The Maven Project. - * - * @parameter expression="${project}" - * @required - * @readonly - */ - MavenProject project; - - /** - * To look up Archiver/UnArchiver implementations - * - * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}" - * @required - */ - protected ArchiverManager archiverManager; - - public void execute() throws MojoExecutionException - { - String[] include = includes.split(","); - List includeList = Arrays.asList(include); - getLog().info("Inclusions: " + includeList); - getLog().info("OutputDirectory: " + outputDirectory); - outputDirectory.mkdirs(); - - for (Iterator itr = project.getArtifacts().iterator(); itr.hasNext();) - { - Artifact a = (Artifact) itr.next(); - - if (includeList.contains(a.getArtifactId()) && "jar".equals(a.getType()) ) - { - getLog().info("Found " + a.getArtifactId()); - - try - { - unpack( a.getFile(), outputDirectory ); - } - catch (MojoExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (NoSuchArchiverException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - - protected void unpack( File file, File location ) - throws MojoExecutionException, NoSuchArchiverException - { - String archiveExt = FileUtils.getExtension( file.getAbsolutePath() ).toLowerCase(); - - try - { - getLog().info("Extracting: "+file+": to "+location); - UnArchiver unArchiver = this.archiverManager.getUnArchiver( archiveExt ); - unArchiver.setSourceFile( file ); - unArchiver.setDestDirectory( location ); - unArchiver.extract(); - - File metaDir = new File(location, "META-INF"); - File jarMetaDir = new File(metaDir, file.getName()); - FileUtils.mkdir(jarMetaDir.getAbsolutePath()); - - File[] files = metaDir.listFiles(); - for (int i = 0; i < files.length; i++) { - String name = files[i].getName(); - if( - name.toUpperCase().startsWith("MANIFEST.MF") || - name.toUpperCase().startsWith("COPYRIGHT") || - name.toUpperCase().startsWith("LICENSE") || - name.toUpperCase().startsWith("NOTICE") || - name.toUpperCase().startsWith("DISCLAIMER") - ) { - - FileUtils.copyFileToDirectory(files[i], jarMetaDir); - files[i].delete(); - } - } - - } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error unpacking file: " + file + "to: " + location, e ); - } - catch ( ArchiverException e ) - { - throw new MojoExecutionException( "Error unpacking file: " + file + "to: " + location, e ); - } - } -} diff --git a/maven-gram-plugin/pom.xml b/maven-gram-plugin/pom.xml deleted file mode 100644 index 0d7f225318..0000000000 --- a/maven-gram-plugin/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - 4.0.0 - - - org.apache.activemq - activemq-parent - 4.1-incubator-SNAPSHOT - ../pom.xml - - - maven-gram-plugin - maven-plugin - Gram Plugin - - - - org.apache.maven - maven-project - 2.0 - - - org.codehaus.plexus - plexus-archiver - 1.0-alpha-5 - - - org.apache.maven - maven-archiver - 2.0 - - - org.apache.maven - maven-plugin-api - 2.0 - - - org.codehaus.plexus - plexus-utils - 1.1 - - - org.apache.maven - maven-artifact - 2.0 - - - - groovy - groovy-all - 1.0-jsr-03 - - - annogen - annogen - 0.1.0 - - - - - - - default-tools.jar - - - java.vendor - Sun Microsystems Inc. - - - - - com.sun - tools - 1.4.2 - system - ${java.home}/../lib/tools.jar - - - - - - diff --git a/maven-gram-plugin/src/main/java/org/apache/activemq/maven/GramMojo.java b/maven-gram-plugin/src/main/java/org/apache/activemq/maven/GramMojo.java deleted file mode 100644 index 9f3e18bd00..0000000000 --- a/maven-gram-plugin/src/main/java/org/apache/activemq/maven/GramMojo.java +++ /dev/null @@ -1,146 +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.activemq.maven; - -import groovy.lang.GroovyShell; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.codehaus.groovy.control.CompilationFailedException; -import org.codehaus.jam.JamService; -import org.codehaus.jam.JamServiceFactory; -import org.codehaus.jam.JamServiceParams; -import org.codehaus.plexus.archiver.manager.ArchiverManager; - -/** - * Greates a Mojo for Gram. - * - * This module is largly based on the Gram class here: - * http://cvs.groovy.codehaus.org/browse/groovy/groovy/modules/gram/src/main/org/codehaus/gram/Gram.java?r=1.4 - * - * We need to get this moved over the groovy project eventually.. Putting in ActiveMQ for now so we can keep going. - * - * @goal gram - * @description Runs the Gram code generator - */ -public class GramMojo extends AbstractMojo -{ - /** - * Source directories of the project. - * - * @parameter expression="${project.compileSourceRoots}" - * @required - * @readonly - */ - private List sourceDirs; - - - /** - * @parameter - * @required - */ - String scripts = ""; - - /** - * @parameter - */ - Map groovyProperties = Collections.EMPTY_MAP; - - /** - * To look up Archiver/UnArchiver implementations - * - * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}" - * @required - */ - protected ArchiverManager archiverManager; - - public void execute() throws MojoExecutionException - { - - try { - - System.out.println("Parsing source files in: " + sourceDirs); - - JamServiceFactory jamServiceFactory = JamServiceFactory.getInstance(); - JamServiceParams params = jamServiceFactory.createServiceParams(); - - File[] dirs = new File[sourceDirs.size()]; - { - int i=0; - for (Iterator iter = sourceDirs.iterator(); iter.hasNext();) { - dirs[i++] = new File((String) iter.next()); - } - } - - params.includeSourcePattern(dirs, "**/*.java"); - JamService jam = jamServiceFactory.createService(params); - - String[] scriptsArray = scripts.split(":"); - for (int i = 1; i < scriptsArray.length; i++) { - String script = scriptsArray[i].trim(); - if(script.length() > 0 ) { - getLog().info("Evaluating Groovy script: " + script); - execute(jam, script); - } - } - } - catch (Exception e) { - getLog().error("Caught: " + e, e); - } - } - - public void execute(JamService jam, String script) throws CompilationFailedException, IOException { - File file = new File(script); - if (file.isFile()) { - GroovyShell shell = createShell(jam); - shell.evaluate(file); - } - else { - // lets try load the script on the classpath - InputStream in = getClass().getClassLoader().getResourceAsStream(script); - if (in == null) { - in = Thread.currentThread().getContextClassLoader().getResourceAsStream(script); - if (in == null) { - throw new IOException("No script called: " + script + " could be found on the classpath or the file system"); - } - } - GroovyShell shell = createShell(jam); - shell.evaluate(in, script); - } - } - - protected GroovyShell createShell(JamService jam) { - GroovyShell answer = new GroovyShell(); - for (Iterator iter = groovyProperties.entrySet().iterator(); iter.hasNext();) { - Map.Entry entry = (Map.Entry) iter.next(); - answer.setProperty((String) entry.getKey(), entry.getValue()); - } - answer.setProperty("jam", jam); - answer.setProperty("classes", jam.getAllClasses()); - return answer; - } - -} diff --git a/tooling/pom.xml b/tooling/pom.xml new file mode 100644 index 0000000000..3e4613dd57 --- /dev/null +++ b/tooling/pom.xml @@ -0,0 +1,41 @@ + + + + + 4.0.0 + + org.apache.activemq + activemq-parent + 4.1-incubator-SNAPSHOT + + org.apache.activemq.tooling + activemq-tooling + pom + ActiveMQ Tooling + + + maven-activemq-memtest-plugin + maven-activemq-perf-plugin + maven-activemq-plugin + maven-dependency-plugin + maven-bundle-plugin + maven-gram-plugin + + +