All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.maven.plugins.retro.WeaveTestsMojo Maven / Gradle / Ivy

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;
      }
   }
   
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy