[jboss-svn-commits] JBL Code SVN: r13939 - in labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin: src/main/java/org/jboss/maven/plugins/retro and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 1 16:05:30 EDT 2007


Author: pgier
Date: 2007-08-01 16:05:30 -0400 (Wed, 01 Aug 2007)
New Revision: 13939

Modified:
   labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml
   labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/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/WeaveMojo.java
   labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java
Log:
Added some configuration to pom.  Fixed option for generating attached weaved build artifacts.

Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml	2007-08-01 16:08:54 UTC (rev 13938)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/pom.xml	2007-08-01 20:05:30 UTC (rev 13939)
@@ -1,15 +1,44 @@
 <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>
+  <url>http://labs.jboss.com/maven-jboss-retro-plugin</url>
   <description>Maven plugin for jboss retro</description>
+  <inceptionYear>2007</inceptionYear>
+  
   <scm>
-    <connection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/trunk/jboss-retro-maven-plugin</connection>
+    <connection>scm:svn:http://anonsvn.labs.jboss.org/labs/jbossbuild/maven-plugins/trunk/jboss-retro-maven-plugin</connection>
+    <developerConnection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/maven-plugins/trunk/jboss-retro-maven-plugin</developerConnection>
   </scm>
+  
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.jboss.com/jira/browse/JBBUILD</url>
+  </issueManagement>
+  
+  <licenses>
+    <license>
+      <name>GNU Lesser General Public License</name>
+      <url>http://www.gnu.org/copyleft/lesser.html</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <developers>
+    <developer>
+      <id>pgier</id>
+      <name>Paul Gier</name>
+      <organization>JBoss, a division of Red Hat, Inc</organization>
+      <organizationUrl>http://www.jboss.org</organizationUrl>
+      <timezone>-5</timezone>
+    </developer>
+  </developers>
+  
   <build>
     <extensions>
       <extension>
@@ -35,6 +64,28 @@
       </plugin>
     </plugins>
   </build>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <minmemory>128m</minmemory>
+          <maxmemory>512</maxmemory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+
   <dependencies>
     <dependency>
       <groupId>org.jboss</groupId>
@@ -77,6 +128,7 @@
       <version>1.4.1</version>
     </dependency>
   </dependencies>
+  
   <distributionManagement>
     <repository>
       <!-- Copy the distribution jar file to a local checkout of the maven repository 
@@ -89,5 +141,12 @@
       <name>JBoss Snapshot Repository</name>
       <url>dav:https://snapshots.jboss.org/maven2</url>
     </snapshotRepository>
+    <site>
+      <id>www.jboss.org</id>
+      <name>www.jboss.org</name>
+      <!-- This should be set to a local checkout of the jboss.org/jbossretro freezone. -->
+      <url>file://${maven.jboss.retro.plugin.site.root}</url>
+    </site>
   </distributionManagement>
+  
 </project>
\ No newline at end of file

Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/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-08-01 16:08:54 UTC (rev 13938)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/RetroCheckMojo.java	2007-08-01 20:05:30 UTC (rev 13939)
@@ -21,9 +21,12 @@
 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.
+ * Mojo for running the retro check test.  
+ * NOTE: The retro check functionality is meant to be used with
+ * the jdk1.5 to 1.4 conversion.  Other types of class weaving do
+ * not need to use this mojo.  This mojo should be run using 
+ * a java1.4 jvm, which can be set using the jvm configuration 
+ * parameter.
  * 
  * @phase test
  * @goal retro-check
@@ -81,12 +84,13 @@
     * 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}"
+    * @parameter
+    * @required
     */
    private String jvm;
 
    /**
-    * The Maven Plugin Object
+    * The Maven Plugin components
     *
     * @parameter expression="${plugin.components}"
     * @required

Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java	2007-08-01 16:08:54 UTC (rev 13938)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java	2007-08-01 20:05:30 UTC (rev 13939)
@@ -36,14 +36,14 @@
 {
    public static final String JBOSS_RETRO_ARTIFACTID = "jboss-retro";
    
-   protected final String fileSep = System.getProperty("file.separator");
+   protected final String fileSep = File.separator;
 
-   protected final String pathSep = System.getProperty("path.separator");
+   protected final String pathSep = File.pathSeparator;
 
    /**
     * List of the jar file entries
     */
-   private ArrayList<JarFileEntry> fileEntries = new ArrayList<JarFileEntry>();
+   //private ArrayList<JarFileEntry> fileEntries = new ArrayList<JarFileEntry>();
 
    /**
     * The Maven Project Object
@@ -114,10 +114,11 @@
    protected String weaverOutputPath;
    
    /**
-    * Create weaved jar.
+    * Attach a jar of the weaved classes to the build lifecycle.  This will
+    * allow the weaved jar to be deployed with the other build components.
     * @parameter
     */
-   protected boolean createJar = true;
+   protected boolean attachJar = true;
    
    /**
     * Classifier to append to the weaved output file.
@@ -141,6 +142,13 @@
       long start = System.currentTimeMillis();
       
       weaveClasses();
+      if (this.attachJar) 
+      {
+         String jarFilePath = project.getBuild().getDirectory()
+            + File.separator + project.getArtifactId() + "-" + this.getJarClassifier() + ".jar";
+         File jarFile = this.createJarFile(jarFilePath);
+         projectHelper.attachArtifact(project, jarFile, this.getJarClassifier());
+      }
       
       long end = System.currentTimeMillis();
       this.getLog().info("Weaving complete: " + (end - start) + "ms");
@@ -240,16 +248,17 @@
       return weaver;
    }
 
-   private void createJarEntries(File retroClassesDir)
+   private ArrayList <JarFileEntry> createJarEntries(File directory)
    {
+      ArrayList <JarFileEntry> fileEntries = new ArrayList <JarFileEntry> ();
       try
       {
-         this.getLog().info("DEBUG: " + retroClassesDir.getAbsolutePath());
-         Collection retroClasses = FileUtils.listFiles(retroClassesDir, null, true);
-         for (Object classFile : retroClasses)
+         this.getLog().info("DEBUG: " + directory.getAbsolutePath());
+         Collection files = FileUtils.listFiles(new File(this.getOutputPath()), null, true);
+         for (Object fileObj : files)
          {
-            String relativePath = classFile.toString().replace(retroClassesDir.getAbsolutePath() + "/", "");
-            byte[] content = FileUtils.readFileToByteArray((File) classFile);
+            String relativePath = fileObj.toString().replace(directory.getAbsolutePath() + "/", "");
+            byte[] content = FileUtils.readFileToByteArray((File) fileObj);
             fileEntries.add(new JarFileEntry(relativePath, content));
          }
       }
@@ -257,10 +266,13 @@
       {
          this.getLog().error("error reading class file: " + ioe);
       }
+      return fileEntries;
    }
 
-   private void createRetroJarFile(File retroJarFile)
+   private File createJarFile(String jarFilePath)
    {
+      File outputDir = new File(this.getOutputPath());
+      ArrayList <JarFileEntry> fileEntries = createJarEntries(outputDir);
       try
       {
          Manifest manifest = new Manifest();
@@ -268,7 +280,7 @@
          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);
+         JarOutputStream stream = new JarOutputStream(new FileOutputStream(jarFilePath), manifest);
          stream.setLevel(Deflater.BEST_COMPRESSION);
          for (JarFileEntry fileEntry : fileEntries)
          {
@@ -282,6 +294,7 @@
       {
          this.getLog().error("Unable to write retro jar: " + ioe);
       }
+      return new File(jarFilePath);
    }
 
    protected static class JarFileEntry
@@ -320,7 +333,7 @@
          if(classesDirString.endsWith(this.fileSep)) {
             classesDirString = classesDirString.substring(0, (classesDirString.length() - 2));
          }
-         return (classesDirectory + "-" + this.weaveClassifier);
+         return (classesDirString + "-" + this.weaveClassifier);
       }
       else 
       {
@@ -340,4 +353,8 @@
       return this.classesDirectory;
    }
    
+   protected String getJarClassifier() {
+      return this.weaveClassifier;
+   }
+   
 }

Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java	2007-08-01 16:08:54 UTC (rev 13938)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java	2007-08-01 20:05:30 UTC (rev 13939)
@@ -3,12 +3,10 @@
 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.
+ * the weaved classes. 
  * 
  * @phase process-test-classes
  * @goal weave-tests
@@ -78,4 +76,8 @@
       }
    }
    
+   protected String getJarClassifier() {
+      return "tests-" + this.weaveClassifier;
+   }
+   
 }




More information about the jboss-svn-commits mailing list