[jboss-svn-commits] JBL Code SVN: r13850 - in labs/jbossbuild/maven-plugins/tags: maven-jboss-retro-plugin-0.9-beta-2 and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 30 11:25:19 EDT 2007


Author: pgier
Date: 2007-07-30 11:25:19 -0400 (Mon, 30 Jul 2007)
New Revision: 13850

Added:
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java
Removed:
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaverMojo.java
Log:
[maven-release-plugin]  copy for tag maven-jboss-retro-plugin-0.9-beta-2

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2 (from rev 12575, labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin)

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml	2007-06-14 11:58:41 UTC (rev 12575)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml	2007-07-30 15:25:19 UTC (rev 13850)
@@ -1,102 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.jboss.maven.plugins</groupId>
-  <artifactId>maven-jboss-retro-plugin</artifactId>
-  <packaging>maven-plugin</packaging>
-  <name>JBoss Retro Maven Plugin</name>
-  <version>0.9-SNAPSHOT</version>
-  <url>http://www.jboss.org</url>
-  <description>Maven plugin for jboss retro</description>
-  <scm>
-    <connection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/trunk/jboss-retro-maven-plugin</connection>
-  </scm>
-  <build>
-    <extensions>
-      <extension>
-	      <groupId>org.apache.maven.wagon</groupId>
-	      <artifactId>wagon-webdav</artifactId>
-	      <version>1.0-beta-2</version>
-      </extension>
-    </extensions>
-    <plugins>
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.0</version>
-        <configuration>
-          <optimize>true</optimize>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-release-plugin</artifactId>
-        <configuration>
-          <tagBase>https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/tags</tagBase>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <repositories>
-    <repository>
-      <snapshots />
-      <id>jboss</id>
-      <name>JBoss Repository</name>
-      <url>http://repository.jboss.com/maven2/</url>
-    </repository>
-  </repositories>
-  <dependencies>
-    <dependency>
-      <groupId>jboss</groupId>
-      <artifactId>jboss-backport-concurrent</artifactId>
-      <version>2.1.0.GA</version>
-    </dependency>
-    <dependency>
-      <groupId>jboss</groupId>
-      <artifactId>javassist</artifactId>
-      <version>3.4.ga</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-retro</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ant</groupId>
-      <artifactId>ant</artifactId>
-      <version>1.7.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
-      <version>2.0.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-archiver</artifactId>
-      <version>2.2</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>1.2</version>
-    </dependency>
-  </dependencies>
-  <distributionManagement>
-    <repository>
-      <!-- Copy the distribution jar file to a local checkout of the maven repository 
-        -  This variable can be set in $MAVEN_HOME/conf/settings.xml -->
-      <id>repository.jboss.org</id>
-      <url>file://${maven.repository.root}</url>
-    </repository>
-    <snapshotRepository>
-      <id>snapshots.jboss.org</id>
-      <name>JBoss Snapshot Repository</name>
-      <url>dav:https://snapshots.jboss.org/maven2</url>
-    </snapshotRepository>
-  </distributionManagement>
-</project>
\ No newline at end of file

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml (from rev 13849, labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/pom.xml	2007-07-30 15:25:19 UTC (rev 13850)
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.maven.plugins</groupId>
+  <artifactId>maven-jboss-retro-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>JBoss Retro Maven Plugin</name>
+  <version>0.9-beta-2</version>
+  <url>http://www.jboss.org</url>
+  <description>Maven plugin for jboss retro</description>
+  <scm>
+    <connection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2</connection>
+  </scm>
+  <build>
+    <extensions>
+      <extension>
+	      <groupId>org.apache.maven.wagon</groupId>
+	      <artifactId>wagon-webdav</artifactId>
+	      <version>1.0-beta-2</version>
+      </extension>
+    </extensions>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <optimize>true</optimize>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <tagBase>https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/tags</tagBase>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-retro</artifactId>
+      <version>[1.1.2-beta, 1.2.0)</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-archiver</artifactId>
+      <version>2.2</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.1</version>
+    </dependency>
+  </dependencies>
+  <distributionManagement>
+    <repository>
+      <!-- Copy the distribution jar file to a local checkout of the maven repository 
+        -  This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+      <id>repository.jboss.org</id>
+      <url>file://${maven.repository.root}</url>
+    </repository>
+    <snapshotRepository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>dav:https://snapshots.jboss.org/maven2</url>
+    </snapshotRepository>
+  </distributionManagement>
+</project>
\ No newline at end of file

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java	2007-06-14 11:58:41 UTC (rev 12575)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java	2007-07-30 15:25:19 UTC (rev 13850)
@@ -1,189 +0,0 @@
-package org.jboss.maven.plugins.retro;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.project.MavenProject;
-import org.jboss.ant.tasks.retrocheck.Checker;
-
-/**
- * Maven wrapper for JBoss Retro.  By default
- * it will bind to the process classes phase, which takes
- * place immediately after the compile phase.
- * NOTE: The retro check functionality is not complete.  Please
- * do not use this part of the plugin in a production environment.
- * 
- * @phase process-classes
- * @goal retro-check
- * 
- */
-public class RetroCheckMojo extends AbstractMojo
-{
-
-   //private static String lSep = System.getProperty("line.separator");
-
-   /**
-    * The Maven Project Object
-    *
-    * @parameter expression="${project}"
-    * @required
-    */
-   protected MavenProject project;
-
-   /**
-    * The Maven Project Helper Object
-    *
-    * @component
-    * @required
-    */
-   protected org.apache.maven.project.MavenProjectHelper projectHelper;
-
-   /**
-    * The Maven Plugin Object
-    *
-    * @parameter expression="${plugin.components}"
-    * @required
-    * @readonly
-    */
-   protected List pluginComponents;
-
-   /**
-    * The plugin dependencies.
-    *
-    * @parameter expression="${plugin.artifacts}"
-    * @required
-    * @readonly
-    */
-   private List pluginArtifacts;
-
-   /**
-    * Project classpath.
-    *
-    * @parameter expression="${project.compileClasspathElements}"
-    * @required
-    * @readonly
-    */
-   private List classpathElements;
-
-   /**
-    * @parameter expression="${project.pluginArtifacts}"
-    * @required
-    * @readonly
-    */
-   //private HashSet pluginArtifacts;
-   /**
-    * The directory for compiled classes.
-    *
-    * @parameter expression="${project.build.outputDirectory}"
-    * @required
-    * @readonly
-    */
-   private File targetClassesDirectory;
-
-   /**
-    * The directory for compiled classes.
-    *
-    * @parameter expression="${project.build.directory}"
-    * @required
-    * @readonly
-    */
-   private File targetDirectory;
-
-   /**
-    * @parameter
-    */
-   private boolean verbose = false;
-
-   /**
-    * @parameter
-    */
-   private boolean suppress = true;
-
-   public void execute()
-   {
-      this.getLog().info("[retro-check] Checking classes for jdk14");
-
-      if (!project.getArtifact().getType().equalsIgnoreCase("jar")) {
-         this.getLog().info("[retro-check] Project " + project.getName() + " is not"
-               + " a jar project.  No retro compile needed.");
-         return;
-      }
-      ArrayList<String> argsList = new ArrayList<String>();
-
-      if (verbose)
-      {
-         argsList.add("-verbose");
-      }
-      if (suppress)
-      {
-         argsList.add("-suppress");
-      }
-      /*argsList.add("-destdir");
-      try
-      {
-         argsList.add(targetDirectory.getCanonicalPath() + "/classes-retro");
-      }
-      catch (Exception e)
-      {
-         this.getLog().error(e);
-      }*/
-      argsList.add("-cp");
-      StringBuilder classpath = new StringBuilder();
-      String pathSeparator = System.getProperty("path.separator");
-      for (Object element : classpathElements)
-      {
-         classpath.append(element);
-         classpath.append(pathSeparator);
-      }
-
-      for (Object artifact : pluginArtifacts)
-      {
-         try
-         {
-            File artifactFile = ((Artifact) artifact).getFile();
-            if (artifactFile != null)
-            {
-               classpath.append(artifactFile.getCanonicalPath());
-               classpath.append(pathSeparator);
-            }
-         }
-         catch (IOException ioe)
-         {
-            this.getLog().warn("Could not get filename");
-         }
-      }
-      
-      argsList.add(classpath.toString());
-
-      try
-      {
-         argsList.add(targetDirectory.getCanonicalPath() + 
-               System.getProperty("file.separator") + "classes-retro");
-      }
-      catch (IOException ioe)
-      {
-         this.getLog().error(ioe.toString());
-      }
-
-      String[] args = new String[argsList.size()];
-      for (int i = 0; i < args.length; ++i)
-      {
-         args[i] = argsList.get(i);
-      }
-
-      Checker checker = new Checker();
-      try
-      {
-         checker.check(args);
-      }
-      catch (Exception e)
-      {
-         this.getLog().error(e);
-      }
-
-   }
-}

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java (from rev 13845, labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java	2007-07-30 15:25:19 UTC (rev 13850)
@@ -0,0 +1,338 @@
+package org.jboss.maven.plugins.retro;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Maven plugin for running the retro check test.  
+ * NOTE: The retro check functionality is not complete.  Please
+ * do not use this part of the plugin in a production environment.
+ * 
+ * @phase test
+ * @goal retro-check
+ * 
+ */
+public class RetroCheckMojo extends AbstractMojo
+{
+
+   public static final String JBOSS_RETRO_ARTIFACTID = "jboss-retro";
+   
+   /**
+    * The Maven Project Object
+    *
+    * @parameter expression="${project}"
+    * @required
+    */
+   protected MavenProject project;
+
+   /**
+    * The Maven Project Helper Object
+    *
+    * @component
+    * @required
+    */
+   protected org.apache.maven.project.MavenProjectHelper projectHelper;
+
+   /**
+    * INTERNAL : Artifact factory, needed to download dependencies
+    *
+    * @component role="org.apache.maven.artifact.factory.ArtifactFactory"
+    * @required
+    * @readonly
+    */
+   protected ArtifactFactory artifactFactory;
+
+   /**
+    * INTERNAL : Artifact resolver, needed to download dependencies
+    *
+    * @component role="org.apache.maven.artifact.resolver.ArtifactResolver"
+    * @required
+    * @readonly
+    */
+   protected ArtifactResolver artifactResolver;
+   
+   /**
+    * INTERNAL : Local maven repository.
+    *
+    * @parameter expression="${localRepository}"
+    * @required
+    * @readonly
+    */
+   protected ArtifactRepository localRepository;
+   
+   /**
+    * Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the
+    * jvm will be the same as the one used to run Maven.
+    * 
+    * @parameter expression="${jvm}"
+    */
+   private String jvm;
+
+   /**
+    * The Maven Plugin Object
+    *
+    * @parameter expression="${plugin.components}"
+    * @required
+    * @readonly
+    */
+   protected List pluginComponents;
+
+   /**
+    * The plugin artifacts.
+    *
+    * @parameter expression="${plugin.artifacts}"
+    * @required
+    * @readonly
+    */
+   private List pluginArtifacts;
+   
+   /**
+    * The path to the classes to be checked, relative to
+    * the build directory.  Defaults to a value of
+    * "classes-weaved" which means that classes in the direcotry
+    * target/classes-weaved will be checked.
+    * @parameter
+    * @required
+    */
+   private String checkDirectory;
+   
+   /**
+    * Enable verbose output
+    * @parameter
+    */
+   private boolean verbose = false;
+
+   /**
+    * Suppress output
+    * @parameter
+    */
+   private boolean suppress = false;
+
+   /**
+    * Location of the retro check jar to include in the classpath
+    */
+   private File jbossRetroCheckJar = null;
+   
+   /**
+    * Location of the retro runtime jar to include in the classpath
+    */
+   private File jbossRetroRtJar = null;
+   
+   /**
+    * Ignore check errors.  If set to true, the build will continue
+    * regardless of whether there are check errors.
+    * Default is false.
+    * 
+    * @parameter
+    * 
+    */
+   private boolean ignoreErrors = false;
+   
+   public void execute() throws MojoExecutionException
+   {
+      // First, make sure checker and runtime available on the classpath
+      this.resolveCheckerLocation();
+      
+      if ( jvm == null || jvm.equals("") )
+      {
+          // use the same JVM as the one used to run Maven (the "java.home" one)
+          jvm = System.getProperty( "java.home" ) + File.separator + "bin" + File.separator + "java";
+          getLog().debug( "Using JVM: " + jvm );
+      }
+
+      this.getLog().info("Checking classes for jdk14");
+      
+      ArrayList<String> argsList = new ArrayList<String>();
+
+      argsList.add("-cp");
+      
+      String classpath = this.createCheckerClasspath();
+      getLog().debug("Using checker classpath: " + classpath);
+      argsList.add(classpath);
+
+      argsList.add("org.jboss.ant.tasks.retrocheck.Checker");
+      
+      if (verbose)
+      {
+         argsList.add("-verbose");
+      }
+      
+      if (suppress)
+      {
+         argsList.add("-suppress");
+      }
+
+      String retroClassesDir = project.getBuild().getDirectory() + File.separator + checkDirectory;
+      argsList.add(retroClassesDir);
+
+      String[] args = new String[argsList.size()];
+      args = argsList.toArray(args);
+
+      Commandline cli = new Commandline();
+   
+      cli.setExecutable( jvm );
+      cli.addArguments(args);
+      
+      StreamConsumer out = new MojoLogStreamConsumer();
+      StreamConsumer err = new MojoLogStreamConsumer();
+
+      try
+      {
+         int returnCode = CommandLineUtils.executeCommandLine( cli, out, err );
+         if ( ( ! ignoreErrors ) && returnCode != 0)
+         {
+            throw new MojoExecutionException("There were errors during the retro check");
+         }
+      }
+      catch ( CommandLineException e )
+      {
+         throw new MojoExecutionException( "Error while executing forked tests.", e );
+      }
+   }
+
+   public String createCheckerClasspath() 
+   {
+      StringBuilder classpath = new StringBuilder();
+
+      String fileSep = System.getProperty("file.separator");
+      String weavedClassesDir = project.getBuild().getDirectory() + fileSep + checkDirectory;
+      classpath.append(weavedClassesDir);
+      classpath.append(File.pathSeparator);
+            
+      for (Object artifactObj : pluginArtifacts)
+      {
+         Artifact artifact = (Artifact)artifactObj;
+         if (artifact.getArtifactId().equals(JBOSS_RETRO_ARTIFACTID) && artifact.getClassifier() == null)
+         {
+            // We don't want to include the jboss-retro dependency for the checks
+            // because the jboss-retro jar is jdk1.5 and we should be running under 1.4
+            // and the checker and rt jars will have everything needed for the checks
+            continue;
+         }
+         try
+         {
+            File artifactFile = artifact.getFile();
+            if (artifactFile != null)
+            {
+               classpath.append(artifactFile.getCanonicalPath());
+               classpath.append(File.pathSeparator);
+            }
+         }
+         catch (IOException ioe)
+         {
+            this.getLog().warn("Could not get filename");
+         }
+      }
+      classpath.append(this.jbossRetroCheckJar.getAbsolutePath());
+      classpath.append(File.pathSeparator);
+      classpath.append(this.jbossRetroRtJar.getAbsolutePath());
+      classpath.append(File.pathSeparator);
+      
+      return classpath.toString();
+   }
+   
+   /** 
+    * Resolve the location of the Checker class, and the retro runtime classes  
+    *
+    */
+   public void resolveCheckerLocation() throws MojoExecutionException
+   {
+      // Figure out which verion of retro should be used
+      String jbossRetroVersion = null;
+      
+      // If we are checking jboss retro itself, we have to do this to make sure 
+      // the local files are used instead of repository files.
+      if (project.getArtifactId().equals(JBOSS_RETRO_ARTIFACTID))
+      {
+         jbossRetroVersion = project.getVersion();
+         
+         // Determine if the checker and runtime are attached to the project 
+         List attachedArtifacts = project.getAttachedArtifacts();
+         for (Object artifactObj : attachedArtifacts) {
+            Artifact artifact = (Artifact)artifactObj;
+            if (artifact.getArtifactId().equals(JBOSS_RETRO_ARTIFACTID))
+            {
+               if (artifact.getClassifier().equals("retrocheck")) 
+               {
+                  this.jbossRetroCheckJar = artifact.getFile();
+               }
+               else if(artifact.getClassifier().equals("rt")) 
+               {
+                  this.jbossRetroRtJar = artifact.getFile();
+               }
+            }
+         }
+      }
+      
+      if (this.jbossRetroCheckJar != null && this.jbossRetroRtJar != null) 
+      {
+         // We found the checker and runtime attached, so just return
+         return;
+      }
+      
+      Iterator iter = this.pluginArtifacts.iterator();
+      while(iter.hasNext() && jbossRetroVersion==null) {
+         Artifact nextArtifact = (Artifact)iter.next();
+         if (nextArtifact.getArtifactId().equals(JBOSS_RETRO_ARTIFACTID) 
+               && nextArtifact.getClassifier() == null)
+         {
+            jbossRetroVersion = nextArtifact.getVersion();          
+         }
+      }
+
+      // Get the checker and runtime from the repository
+      Artifact checkerArtifact = artifactFactory.createArtifactWithClassifier("org.jboss", JBOSS_RETRO_ARTIFACTID, jbossRetroVersion, "jar", "retrocheck");            
+      Artifact runtimeArtifact = artifactFactory.createArtifactWithClassifier("org.jboss", JBOSS_RETRO_ARTIFACTID, jbossRetroVersion, "jar", "rt");            
+      try 
+      {
+         artifactResolver.resolve(checkerArtifact, project.getRemoteArtifactRepositories(), localRepository);
+         artifactResolver.resolve(runtimeArtifact, project.getRemoteArtifactRepositories(), localRepository);
+      }
+      catch (ArtifactResolutionException are) 
+      {
+         throw new MojoExecutionException("Problem resolving artifact: " + are);
+      }
+      catch (ArtifactNotFoundException are) 
+      {
+         throw new MojoExecutionException("Problem resolving artifact: " + are);
+      }
+      
+      this.jbossRetroCheckJar = checkerArtifact.getFile();
+      this.jbossRetroRtJar = runtimeArtifact.getFile();
+   }
+   
+
+   /**
+    * Consume and log command output from the Checker
+    * @author pgier
+    *
+    */
+   public class MojoLogStreamConsumer implements StreamConsumer
+   {
+      public void consumeLine(String line)
+      {
+         getLog().info(line);
+      }
+   }
+
+}
+
+
+

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java (from rev 13845, labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java	2007-07-30 15:25:19 UTC (rev 13850)
@@ -0,0 +1,343 @@
+package org.jboss.maven.plugins.retro;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.Deflater;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.NameFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.jboss.weaver.WeaveRunner;
+import org.jboss.weaver.Weaver;
+
+/**
+ * Maven plugin for JBoss Retro Weaver.  This can be used to 
+ * do byte code weaving on classes in jars and directories.
+ * By default the weaver will weave the main classes
+ * and output the result to a jar with the specified classifier.
+ * 
+ * @phase process-classes
+ * @goal weave
+ * 
+ */
+public class WeaveMojo extends AbstractMojo
+{
+   public static final String JBOSS_RETRO_ARTIFACTID = "jboss-retro";
+   
+   protected final String fileSep = System.getProperty("file.separator");
+
+   protected final String pathSep = System.getProperty("path.separator");
+
+   /**
+    * List of the jar file entries
+    */
+   private ArrayList<JarFileEntry> fileEntries = new ArrayList<JarFileEntry>();
+
+   /**
+    * The Maven Project Object
+    *
+    * @parameter expression="${project}"
+    * @required
+    * @readonly
+    */
+   protected MavenProject project;
+
+   /**
+    * The Maven Project Helper Object
+    *
+    * @component
+    * @required
+    * @readonly
+    */
+   protected org.apache.maven.project.MavenProjectHelper projectHelper;
+
+   /**
+    * The plugin dependencies.
+    *
+    * @parameter expression="${plugin.artifacts}"
+    * @required
+    * @readonly
+    */
+   protected List pluginArtifacts;
+
+   /**
+    * Project classpath.
+    *
+    * @parameter expression="${project.compileClasspathElements}"
+    * @required
+    * @readonly
+    */
+   protected List classpathElements;
+   
+   /**
+    * The directory for compiled classes.
+    *
+    * @parameter expression="${project.build.outputDirectory}"
+    * @required
+    */
+   protected File classesDirectory;
+
+   /**
+    * Include verbose output.
+    * @parameter
+    */
+   protected boolean verbose = false;
+
+   /**
+    * The Weaver class to use for weaving the classes.
+    * Defaults to org.jboss.weaver.Weaver
+    * Any subclass of org.jboss.weaver.Weaver can be used
+    * 
+    * @parameter
+    */
+   protected String weaverClass = "org.jboss.weaver.Weaver";
+
+   /**
+    * The jar file or directory where the weaved classes
+    * should be written.  The path is relative to the project
+    * output directory (target).
+    * Defaults to "target/classes-weaved"
+    * @parameter
+    */
+   protected String weaverOutputPath;
+   
+   /**
+    * Create weaved jar.
+    * @parameter
+    */
+   protected boolean createJar = true;
+   
+   /**
+    * Classifier to append to the weaved output file.
+    * Defaults to "weaved".
+    * @parameter
+    */
+   protected String weaveClassifier = "weaved";
+   
+   /**
+    * Suppress output information.
+    * @parameter
+    */
+   protected boolean suppress = true;
+
+   /**
+    * Main plugin execution method
+    */   
+   public void execute() throws MojoFailureException
+   {
+      this.getLog().info("Weaving classes in: " + this.getClassesDirecotry());
+      long start = System.currentTimeMillis();
+      
+      weaveClasses();
+      
+      long end = System.currentTimeMillis();
+      this.getLog().info("Weaving complete: " + (end - start) + "ms");
+   }
+   
+   protected void weaveClasses() throws MojoFailureException {
+      // Initialize the WeaveRunner using plugin params
+      Weaver weaver = createWeaver();
+      weaver.setClasspath(this.buildClasspath());
+      weaver.init();
+      WeaveRunner weaveRunner = new WeaveRunner(weaver);
+
+      weaveRunner.setVerbose(verbose);
+      weaveRunner.setSuppress(suppress);
+      weaveRunner.setUsingSystemClasspath(false);
+      
+      weaveRunner.setOutputPath(getOutputPath()); 
+      
+      try
+      {
+         weaveRunner.addSourcePath(this.getClassesDirecotry().getAbsolutePath());
+         weaveRunner.weave();
+      }
+      catch (Exception e)
+      {
+         this.getLog().error(e);
+         e.printStackTrace();
+      }
+   }
+   
+   /**
+    * Generates a classpath string based on the compile class path
+    * and the plugin dependencies.
+    * @return
+    */
+   protected String buildClasspath() {
+      StringBuilder classpath = new StringBuilder();
+
+      List cpElements = this.getClasspathElements();
+      for (Object element : cpElements)
+      {
+         classpath.append(element);
+         classpath.append(pathSep);
+      }
+      
+      // If the weaver classes can be found in the source directory 
+      // (i.e. we are weaving jboss retro), then we don't want the 
+      // retro jar from the plugin dependency to be pulled in from the repo.
+      boolean useRetroDep = true;
+      NameFileFilter nameFilter = new NameFileFilter("Weaver.class");
+      Collection weaverClassFiles = FileUtils.listFiles(this.getClassesDirecotry(), nameFilter, TrueFileFilter.INSTANCE);
+      if (weaverClassFiles.size() > 0)
+      {
+         useRetroDep = false;
+      }
+      
+      for (Object artifactObj : pluginArtifacts)
+      {
+         try
+         {
+            Artifact artifact = (Artifact) artifactObj;
+            if (artifact.getFile() != null)
+            {
+               if ( useRetroDep || ( ! artifact.getArtifactId().equals(JBOSS_RETRO_ARTIFACTID)))
+               {
+                  classpath.append(artifact.getFile().getCanonicalPath());
+                  classpath.append(pathSep);
+               }
+            }
+         }
+         catch (IOException ioe)
+         {
+            this.getLog().warn("Could not get filename");
+         }
+      }
+      return classpath.toString();
+   }
+      
+   /**
+    * This method creates the weaver instance.  Subclass mojos
+    * can use this class to override the default weaver configuration.
+    * @return The weaver instance
+    */
+   protected Weaver createWeaver() throws MojoFailureException {
+      // We have to set the classpath first because the initialization
+      // may require access to the classpath.
+      Weaver weaver = null;
+
+      try {
+         weaver = (Weaver)Class.forName(weaverClass).newInstance();
+      } catch (Exception e) {
+         getLog().error("Unable to instantiate weaver class: " + this.weaverClass);
+         getLog().error(e.getMessage());
+         throw new MojoFailureException(e.getMessage());
+      }
+      
+      return weaver;
+   }
+
+   private void createJarEntries(File retroClassesDir)
+   {
+      try
+      {
+         this.getLog().info("DEBUG: " + retroClassesDir.getAbsolutePath());
+         Collection retroClasses = FileUtils.listFiles(retroClassesDir, null, true);
+         for (Object classFile : retroClasses)
+         {
+            String relativePath = classFile.toString().replace(retroClassesDir.getAbsolutePath() + "/", "");
+            byte[] content = FileUtils.readFileToByteArray((File) classFile);
+            fileEntries.add(new JarFileEntry(relativePath, content));
+         }
+      }
+      catch (IOException ioe)
+      {
+         this.getLog().error("error reading class file: " + ioe);
+      }
+   }
+
+   private void createRetroJarFile(File retroJarFile)
+   {
+      try
+      {
+         Manifest manifest = new Manifest();
+         Attributes attributes = manifest.getMainAttributes();
+         attributes.putValue("Manifest-Version", "1.0");
+         attributes.putValue("Created-By", System.getProperty("java.vm.version") + " ("
+               + System.getProperty("java.vm.vendor") + ")");
+         JarOutputStream stream = new JarOutputStream(new FileOutputStream(retroJarFile), manifest);
+         stream.setLevel(Deflater.BEST_COMPRESSION);
+         for (JarFileEntry fileEntry : fileEntries)
+         {
+            JarEntry jarEntry = new JarEntry(fileEntry.getName());
+            stream.putNextEntry(jarEntry);
+            stream.write(fileEntry.getContent());
+         }
+         stream.close();
+      }
+      catch (IOException ioe)
+      {
+         this.getLog().error("Unable to write retro jar: " + ioe);
+      }
+   }
+
+   protected static class JarFileEntry
+   {
+
+      private byte[] content;
+
+      private String name;
+
+      public JarFileEntry(String name, byte[] content)
+      {
+         this.name = name;
+         this.content = content;
+      }
+
+      public byte[] getContent()
+      {
+         return content;
+      }
+
+      public String getName()
+      {
+         return name;
+      }
+
+      public void setName(String name)
+      {
+         this.name = name;
+      }
+   }
+   
+   protected String getOutputPath() 
+   {
+      if (this.weaverOutputPath == null) {
+         String classesDirString = getClassesDirecotry().getAbsolutePath();
+         if(classesDirString.endsWith(this.fileSep)) {
+            classesDirString = classesDirString.substring(0, (classesDirString.length() - 2));
+         }
+         return (classesDirectory + "-" + this.weaveClassifier);
+      }
+      else 
+      {
+         String buildDirectory = project.getBuild().getDirectory();
+         if (!buildDirectory.endsWith(fileSep)) {
+            buildDirectory += fileSep;
+         }
+         return buildDirectory + this.fileSep + this.weaverOutputPath;
+      }
+   }
+   
+   public List getClasspathElements() {
+      return this.classpathElements;
+   }
+   
+   public File getClassesDirecotry() {
+      return this.classesDirectory;
+   }
+   
+}

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java (from rev 13845, labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java	2007-07-30 15:25:19 UTC (rev 13850)
@@ -0,0 +1,81 @@
+package org.jboss.maven.plugins.retro;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Maven plugin for JBoss Retro Weaver.  This mojo is set up
+ * to weave the test classes and optionally generate a jar of
+ * the weaved classes.
+ * 
+ * @phase process-test-classes
+ * @goal weave-tests
+ * 
+ */
+public class WeaveTestsMojo extends WeaveMojo
+{
+
+   /**
+    * Project classpath.
+    *
+    * @parameter expression="${project.testClasspathElements}"
+    * @required
+    * @readonly
+    */
+   protected List classpathElements;
+      
+   /**
+    * The directory containing the classes to be weaved.
+    *
+    * @parameter expression="${project.build.testOutputDirectory}"
+    * @required
+    * @readonly
+    */
+   protected File classesDirectory;
+
+   /**
+    * The jar file or directory where the weaved classes
+    * should be written. Defaults to "target/test-classes-weaved"
+    * 
+    * @parameter
+    */
+   protected String outputPath;
+      
+   /**
+    * Suppress output information.
+    * @parameter
+    */
+   protected boolean suppress = true;
+   
+   public List getClasspathElements() 
+   {
+      return this.classpathElements;
+   }
+   
+   public File getClassesDirecotry() 
+   {
+      return this.classesDirectory;
+   }
+   
+   protected String getOutputPath() 
+   {
+      if (this.weaverOutputPath == null) {
+         String classesDirString = getClassesDirecotry().getAbsolutePath();
+         if(classesDirString.endsWith(this.fileSep)) {
+            classesDirString = classesDirString.substring(0, (classesDirString.length() - 2));
+         }
+         return (classesDirectory + "-" + this.weaveClassifier);
+      }
+      else 
+      {
+         String buildDirectory = project.getBuild().getDirectory();
+         if (!buildDirectory.endsWith(fileSep)) {
+            buildDirectory += fileSep;
+         }
+         return buildDirectory + this.fileSep + this.weaverOutputPath;
+      }
+   }
+   
+}

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaverMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaverMojo.java	2007-06-14 11:58:41 UTC (rev 12575)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-retro-plugin-0.9-beta-2/src/main/java/org/jboss/maven/plugins/retro/WeaverMojo.java	2007-07-30 15:25:19 UTC (rev 13850)
@@ -1,411 +0,0 @@
-package org.jboss.maven.plugins.retro;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.Deflater;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.jboss.weaver.WeaveRunner;
-import org.jboss.weaver.Weaver;
-
-/**
- * Maven plugin for JBoss Retro Weaver.  This can be used to 
- * do byte code weaving on classes in jars and directories.
- * By default the weaver will weave the main classes
- * and output the result to a jar with the specified classifier.
- * 
- * @phase process-classes
- * @goal weave
- * 
- */
-public class WeaverMojo extends AbstractMojo
-{
-   private final String fileSep = System.getProperty("file.separator");
-
-   private final String pathSep = System.getProperty("path.separator");
-
-   /**
-    * List of the jar file entries
-    */
-   private ArrayList<JarFileEntry> fileEntries = new ArrayList<JarFileEntry>();
-
-   /**
-    * The Maven Project Object
-    *
-    * @parameter expression="${project}"
-    * @required
-    * @readonly
-    */
-   protected MavenProject project;
-
-   /**
-    * The Maven Project Helper Object
-    *
-    * @component
-    * @required
-    */
-   protected org.apache.maven.project.MavenProjectHelper projectHelper;
-
-   /**
-    * The Maven Plugin Object
-    *
-    * @parameter expression="${plugin.components}"
-    * @required
-    * @readonly
-    */
-   protected List pluginComponents;
-
-   /**
-    * The plugin dependencies.
-    *
-    * @parameter expression="${plugin.artifacts}"
-    * @required
-    * @readonly
-    */
-   protected List pluginArtifacts;
-
-   /**
-    * Project classpath.
-    *
-    * @parameter expression="${project.compileClasspathElements}"
-    * @required
-    * @readonly
-    */
-   protected List classpathElements;
-   
-   /**
-    * Project classpath.
-    *
-    * @parameter expression="${project.testClasspathElements}"
-    * @required
-    * @readonly
-    */
-   protected List testClasspathElements;
-   
-   /**
-    * The directory for compiled classes.
-    *
-    * @parameter expression="${project.build.outputDirectory}"
-    * @required
-    * @readonly
-    */
-   //protected File targetClassesDirectory;
-
-   /**
-    * The directory for build output.
-    *
-    * @parameter expression="${project.build.directory}"
-    * @required
-    * @readonly
-    */
-   //protected File targetDirectory;
-
-   /**
-    * Include verbose output.
-    * @parameter
-    */
-   protected boolean verbose = false;
-
-   /**
-    * @parameter
-    */
-   protected String weaverClass = "org.jboss.weaver.Weaver";
-
-   /**
-    * The jar file or directory where the weaved classes
-    * should be written.
-    * @parameter
-    */
-   private String outputPath;
-
-
-   /**
-    * Determine whether to weave the project classes.
-    * Defaults to true.
-    * @parameter
-    */
-   private boolean weaveClasses = true;
-
-   /**
-    * If set to true, the test classes will be weaved.
-    * Note that when this is set to true, the plugin
-    * should be attached to the test-compile phase
-    * Defaults to false.
-    * @parameter
-    */
-   private boolean weaveTestClasses = false;
-
-   
-   /**
-    * Classifier to append to the weaved output file.
-    * Defaults to "weaved".
-    * @parameter
-    */
-   protected String weaveClassifier = "weaved";
-   
-   /**
-    * Suppress output information.
-    * @parameter
-    */
-   protected boolean suppress = true;
-
-   /**
-    * The weave runner that will be used to weave classes
-    */
-   //private WeaveRunner weaveRunner;
-   
-   public void execute() throws MojoFailureException
-   {
-      this.getLog().info("[retro] Compiling classes for jdk14");
-      
-      if (weaveClasses) {
-         weaveClasses();
-      }
-      if (weaveTestClasses) {
-         weaveTestClasses();
-      }
-   }
-   
-   protected void weaveClasses() throws MojoFailureException {
-      // Initialize the WeaveRunner with plugin params
-      Weaver weaver = createWeaver();
-      weaver.setClasspath(this.buildCompileClasspath());
-      weaver.init();
-      WeaveRunner weaveRunner = new WeaveRunner(weaver);
-
-      weaveRunner.setVerbose(verbose);
-      weaveRunner.setSuppress(suppress);
-      //weaveRunner.setOutputToJar(outputToJar);
-      String targetDirectory = project.getBuild().getDirectory();
-      String targetClassesDirectory = project.getBuild().getOutputDirectory();
-      
-      if (outputPath == null) {
-         outputPath = targetDirectory + fileSep + "classes-" + weaveClassifier + fileSep;
-      } else {
-         outputPath = targetDirectory + fileSep + outputPath;
-      }
-      weaveRunner.setOutputPath(outputPath); 
-      
-      try
-      {
-         weaveRunner.addSourcePath(targetClassesDirectory);
-         System.out.println("added source path: " + targetClassesDirectory);
-
-         weaveRunner.weave();
-      }
-      catch (Exception e)
-      {
-         this.getLog().error(e);
-         e.printStackTrace();
-      }
-   }
-   
-   protected void weaveTestClasses() throws MojoFailureException {
-      // Initialize the WeaveRunner with plugin params
-      String targetDirectory = project.getBuild().getDirectory();
-      String targetTestClassesDirectory = project.getBuild().getTestOutputDirectory();
-      
-      Weaver weaver = createWeaver();
-      weaver.setClasspath(this.buildTestCompileClasspath());
-      weaver.init();
-      WeaveRunner weaveRunner = new WeaveRunner(weaver);
-
-      weaveRunner.setVerbose(verbose);
-      weaveRunner.setSuppress(suppress);
-      
-      if (outputPath == null) {
-         outputPath = targetDirectory + fileSep + "test-classes-" + weaveClassifier + fileSep;
-      } else {
-         outputPath = targetDirectory + fileSep + outputPath;
-      }
-      weaveRunner.setOutputPath(outputPath); 
-      
-      try
-      {
-         weaveRunner.addSourcePath(targetTestClassesDirectory);
-         System.out.println("added source path: " + targetTestClassesDirectory);
-
-         weaveRunner.weave();
-      }
-      catch (Exception e)
-      {
-         this.getLog().error(e);
-         e.printStackTrace();
-      }
-      
-   }
-   
-   /**
-    * Generates a classpath string based on the compile class path
-    * and the plugin dependencies.
-    * @return
-    */
-   protected String buildCompileClasspath() {
-      // Create the classpath first, so that we can create the Weaver object.
-      StringBuilder classpath = new StringBuilder();
-      for (Object element : classpathElements)
-      {
-         classpath.append(element);
-         classpath.append(pathSep);
-      }
-      
-      for (Object artifact : pluginArtifacts)
-      {
-         try
-         {
-            File artifactFile = ((Artifact) artifact).getFile();
-            if (artifactFile != null)
-            {
-               classpath.append(artifactFile.getCanonicalPath());
-               classpath.append(pathSep);
-            }
-         }
-         catch (IOException ioe)
-         {
-            this.getLog().warn("Could not get filename");
-         }
-      }
-      return classpath.toString();
-   }
-   
-   /**
-    * Generates a classpath string based on the compile class path
-    * and the plugin dependencies.
-    * @return
-    */
-   protected String buildTestCompileClasspath() {
-      // Create the classpath first, so that we can create the Weaver object.
-      StringBuilder testClasspath = new StringBuilder();
-      
-      for (Object element : testClasspathElements)
-      {
-         testClasspath.append(element);
-         testClasspath.append(pathSep);
-      }
-      
-      for (Object artifact : pluginArtifacts)
-      {
-         try
-         {
-            File artifactFile = ((Artifact) artifact).getFile();
-            if (artifactFile != null)
-            {
-               testClasspath.append(artifactFile.getCanonicalPath());
-               testClasspath.append(pathSep);
-            }
-         }
-         catch (IOException ioe)
-         {
-            this.getLog().warn("Could not get filename");
-         }
-      }
-      testClasspath.append(project.getBuild().getTestOutputDirectory());
-      return testClasspath.toString();
-   }
-   
-   /**
-    * This method creates the weaver instance.  Subclass mojos
-    * can use this class to override the default weaver configuration.
-    * @return The weaver instance
-    */
-   protected Weaver createWeaver() throws MojoFailureException {
-      // We have to set the classpath first because the initialization
-      // may require access to the classpath.
-      Weaver weaver = null;
-
-      try {
-         weaver = (Weaver)Class.forName(weaverClass).newInstance();
-      } catch (Exception e) {
-         getLog().error("Unable to instantiate weaver class: " + this.weaverClass);
-         getLog().error(e.getMessage());
-         throw new MojoFailureException(e.getMessage());
-      }
-      
-      return weaver;
-   }
-
-   private void createJarEntries(File retroClassesDir)
-   {
-      try
-      {
-         this.getLog().info("DEBUG: " + retroClassesDir.getAbsolutePath());
-         Collection retroClasses = FileUtils.listFiles(retroClassesDir, null, true);
-         for (Object classFile : retroClasses)
-         {
-            String relativePath = classFile.toString().replace(retroClassesDir.getAbsolutePath() + "/", "");
-            byte[] content = FileUtils.readFileToByteArray((File) classFile);
-            fileEntries.add(new JarFileEntry(relativePath, content));
-         }
-      }
-      catch (IOException ioe)
-      {
-         this.getLog().error("error reading class file: " + ioe);
-      }
-   }
-
-   private void createRetroJarFile(File retroJarFile)
-   {
-      try
-      {
-         Manifest manifest = new Manifest();
-         Attributes attributes = manifest.getMainAttributes();
-         attributes.putValue("Manifest-Version", "1.0");
-         attributes.putValue("Created-By", System.getProperty("java.vm.version") + " ("
-               + System.getProperty("java.vm.vendor") + ")");
-         JarOutputStream stream = new JarOutputStream(new FileOutputStream(retroJarFile), manifest);
-         stream.setLevel(Deflater.BEST_COMPRESSION);
-         for (JarFileEntry fileEntry : fileEntries)
-         {
-            JarEntry jarEntry = new JarEntry(fileEntry.getName());
-            stream.putNextEntry(jarEntry);
-            stream.write(fileEntry.getContent());
-         }
-         stream.close();
-      }
-      catch (IOException ioe)
-      {
-         this.getLog().error("Unable to write retro jar: " + ioe);
-      }
-   }
-
-   private static class JarFileEntry
-   {
-
-      private byte[] content;
-
-      private String name;
-
-      public JarFileEntry(String name, byte[] content)
-      {
-         this.name = name;
-         this.content = content;
-      }
-
-      public byte[] getContent()
-      {
-         return content;
-      }
-
-      public String getName()
-      {
-         return name;
-      }
-
-      public void setName(String name)
-      {
-         this.name = name;
-      }
-   }
-}




More information about the jboss-svn-commits mailing list