org.codehaus.mojo.clirr
Class AbstractClirrMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.clirr.AbstractClirrMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
AbstractClirrCheckMojo, ClirrArbitraryCheckMojo, ClirrReport

public abstract class AbstractClirrMojo
extends AbstractMojo

Base parameters for Clirr check and report.

Author:
Brett Porter
Requires the dependencies in this specified scope:
compile

Field Summary
protected  File classesDirectory
          The classes of this project to compare the last release against.
protected  ArtifactSpecification[] comparisonArtifacts
          List of artifacts to compare the current code against.
protected  String comparisonVersion
          Version to compare the current code against.
protected  String[] excludes
          A list of classes to exclude.
protected  ArtifactFactory factory
           
protected  String[] includes
          A list of classes to include.
protected  ArtifactRepository localRepository
           
protected  boolean logResults
          Whether to log the results to the console or not.
protected  String minSeverity
          Show only messages of this severity or higher.
protected  MavenProject project
           
protected  ArtifactResolver resolver
           
protected  boolean skip
          Flag to easily skip execution.
protected  File textOutputFile
          A text output file to render to.
protected  File xmlOutputFile
          An XML file to render to.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractClirrMojo()
           
 
Method Summary
protected  boolean canGenerate()
           
protected static net.sf.clirr.core.Severity convertSeverity(String minSeverity)
           
protected static ClassLoader createClassLoader(Collection artifacts, Set previousArtifacts)
          Create a ClassLoader, which includes the artifacts in artifacts, but excludes the artifacts in previousArtifacts.
static net.sf.clirr.core.spi.JavaType[] createClassSet(File classes, ClassLoader thirdPartyClasses, net.sf.clirr.core.ClassFilter classFilter)
           
protected abstract  void doExecute()
           
 void execute()
           
 ClirrDiffListener executeClirr()
           
protected  ClirrDiffListener executeClirr(net.sf.clirr.core.Severity minSeverity)
           
protected  List getTransitiveDependencies(Set previousArtifacts)
           
protected  Set resolveArtifacts(ArtifactSpecification[] artifacts)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

skip

protected boolean skip
Flag to easily skip execution.

Is defined by:
expression:
${clirr.skip}
default-value:
false

project

protected MavenProject project
Is defined by:
expression:
${project}
Is required.
Is readonly.

resolver

protected ArtifactResolver resolver
Is a Plexus component defined by:

factory

protected ArtifactFactory factory
Is a Plexus component defined by:

localRepository

protected ArtifactRepository localRepository
Is defined by:
default-value:
${localRepository}
Is required.
Is readonly.

classesDirectory

protected File classesDirectory
The classes of this project to compare the last release against.

Is defined by:
default-value:
${project.build.outputDirectory}

comparisonVersion

protected String comparisonVersion
Version to compare the current code against.

Is defined by:
expression:
${comparisonVersion}
default-value:
(,${project.version})

comparisonArtifacts

protected ArtifactSpecification[] comparisonArtifacts
List of artifacts to compare the current code against. This overrides comparisonVersion, if present. Each comparisonArtifact is made of a groupId, an artifactId and a version number. Optionally it may have a classifier (default null) and a type (default "jar").

Is defined by:

minSeverity

protected String minSeverity
Show only messages of this severity or higher. Valid values are info, warning and error.

Is defined by:
expression:
${minSeverity}
default-value:
warning

textOutputFile

protected File textOutputFile
A text output file to render to. If omitted, no output is rendered to a text file.

Is defined by:
expression:
${textOutputFile}

xmlOutputFile

protected File xmlOutputFile
An XML file to render to. If omitted, no output is rendered to an XML file.

Is defined by:
expression:
${xmlOutputFile}

includes

protected String[] includes
A list of classes to include. Anything not included is excluded. If omitted, all are assumed to be included. Values are specified in path pattern notation, e.g. org/codehaus/mojo/**.

Is defined by:

excludes

protected String[] excludes
A list of classes to exclude. These classes are excluded from the list of classes that are included. Values are specified in path pattern notation, e.g. org/codehaus/mojo/**.

Is defined by:

logResults

protected boolean logResults
Whether to log the results to the console or not.

Is defined by:
expression:
${logResults}
default-value:
false
Constructor Detail

AbstractClirrMojo

public AbstractClirrMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

doExecute

protected abstract void doExecute()
                           throws MojoExecutionException,
                                  MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

executeClirr

public ClirrDiffListener executeClirr()
                               throws MojoExecutionException,
                                      MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

executeClirr

protected ClirrDiffListener executeClirr(net.sf.clirr.core.Severity minSeverity)
                                  throws MojoExecutionException,
                                         MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

getTransitiveDependencies

protected List getTransitiveDependencies(Set previousArtifacts)
                                  throws ProjectBuildingException,
                                         InvalidDependencyVersionException,
                                         ArtifactResolutionException,
                                         ArtifactNotFoundException
Throws:
ProjectBuildingException
InvalidDependencyVersionException
ArtifactResolutionException
ArtifactNotFoundException

resolveArtifacts

protected Set resolveArtifacts(ArtifactSpecification[] artifacts)
                        throws MojoFailureException,
                               MojoExecutionException
Throws:
MojoFailureException
MojoExecutionException

createClassSet

public static net.sf.clirr.core.spi.JavaType[] createClassSet(File classes,
                                                              ClassLoader thirdPartyClasses,
                                                              net.sf.clirr.core.ClassFilter classFilter)
                                                       throws MalformedURLException
Throws:
MalformedURLException

createClassLoader

protected static ClassLoader createClassLoader(Collection artifacts,
                                               Set previousArtifacts)
                                        throws MalformedURLException
Create a ClassLoader, which includes the artifacts in artifacts, but excludes the artifacts in previousArtifacts. The intention is, that we let BCEL inspect the artifacts in the latter set, using a ClassLoader, which contains the dependencies. However, the ClassLoader must not contain the jar files, which are being inspected.

Parameters:
artifacts - The artifacts, from which to build a ClassLoader.
previousArtifacts - The artifacts being inspected, or null, if te returned ClassLoader should contain all the elements of artifacts.
Returns:
A ClassLoader which may be used to inspect the classes in previousArtifacts.
Throws:
MalformedURLException - Failed to convert a file to an URL.

convertSeverity

protected static net.sf.clirr.core.Severity convertSeverity(String minSeverity)

canGenerate

protected boolean canGenerate()
                       throws MojoFailureException,
                              MojoExecutionException
Throws:
MojoFailureException
MojoExecutionException


Copyright © 2006-2012 Codehaus. All Rights Reserved.