[jboss-svn-commits] JBL Code SVN: r14119 - labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 9 10:23:19 EDT 2007


Author: pgier
Date: 2007-08-09 10:23:18 -0400 (Thu, 09 Aug 2007)
New Revision: 14119

Modified:
   labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveDependenciesMojo.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:
Adding ability to configure local repository path when translating dependencies.
Some minor configuration and error handling improvments.

Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveDependenciesMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveDependenciesMojo.java	2007-08-09 13:13:29 UTC (rev 14118)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveDependenciesMojo.java	2007-08-09 14:23:18 UTC (rev 14119)
@@ -2,6 +2,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -18,6 +19,7 @@
 import org.apache.maven.artifact.metadata.ResolutionGroup;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@@ -29,6 +31,7 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.artifact.ProjectArtifactMetadata;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
 import org.jboss.weaver.WeaveRunner;
 import org.jboss.weaver.Weaver;
 
@@ -93,6 +96,21 @@
    protected ArtifactRepository localRepository;
    
    /**
+    * The path for a specific local repository directory. It will wrap into an <code>ArtifactRepository</code>
+    * with <code>localRepoId</code> as <code>id</code> and with default <code>repositoryLayout</code>
+    *
+    * @parameter expression="${localRepositoryPath}"
+    */
+   private File localRepositoryPath;
+
+   /**
+    * The <code>id</code> for the <code>localRepo</code>
+    *
+    * @parameter expression="${localRepositoryId}"
+    */
+   private String localRepositoryId;
+
+   /**
     * Map that contains the layouts
     *
     * @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
@@ -214,6 +232,25 @@
     */   
    public void execute() throws MojoFailureException, MojoExecutionException
    {
+      // Override the default local repository
+      if ( StringUtils.isNotEmpty( localRepositoryId ) && ( localRepositoryPath != null ) )
+      {
+          try
+          {
+              ArtifactRepositoryLayout layout;
+
+              layout = ( ArtifactRepositoryLayout ) repositoryLayouts.get( repositoryLayout );
+              
+              getLog().info("Layout: " + layout.getClass());
+              localRepository = new DefaultArtifactRepository( localRepositoryId, localRepositoryPath.toURL()
+                  .toString(), layout );
+          }
+          catch ( MalformedURLException e )
+          {
+              throw new MojoExecutionException( "MalformedURLException: " + e.getMessage(), e );
+          }
+      }
+      
       this.getLog().info("Weaving dependencies");
       
       long start = System.currentTimeMillis();

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-09 13:13:29 UTC (rev 14118)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveMojo.java	2007-08-09 14:23:18 UTC (rev 14119)
@@ -132,6 +132,13 @@
     */   
    public void execute() throws MojoFailureException
    {
+      if ( ( ! this.getClassesDirecotry().exists()) 
+            || ( ! this.getClassesDirecotry().isDirectory()))
+      {
+         getLog().info("No classes found to weave.");
+         return;
+      }
+      
       this.getLog().info("Weaving classes in: " + this.getClassesDirecotry());
       long start = System.currentTimeMillis();
       

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-09 13:13:29 UTC (rev 14118)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-retro-plugin/src/main/java/org/jboss/maven/plugins/retro/WeaveTestsMojo.java	2007-08-09 14:23:18 UTC (rev 14119)
@@ -39,7 +39,7 @@
     * 
     * @parameter expression="${project.build.directory}/test-classes-weaved"
     */
-   protected File testOutputDirectory;
+   protected File outputDirectory;
       
    /**
     * Suppress output information.
@@ -59,7 +59,7 @@
    
    protected String getOutputPath() 
    {
-      return this.testOutputDirectory.getAbsolutePath();
+      return this.outputDirectory.getAbsolutePath();
    }
    
    protected String getJarClassifier() {




More information about the jboss-svn-commits mailing list