Class CheckSignatureMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.animal_sniffer.maven.CheckSignatureMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="check", defaultPhase=PROCESS_TEST_CLASSES, requiresDependencyResolution=TEST, threadSafe=true) public class CheckSignatureMojo extends org.apache.maven.plugin.AbstractMojo
Checks the classes compiled by this module.
  • Field Details

    • outputDirectory

      @Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) protected File outputDirectory
      The directory for compiled classes.
    • testOutputDirectory

      @Parameter(defaultValue="${project.build.testOutputDirectory}", required=true, readonly=true) protected File testOutputDirectory
      The directory for compiled test classes.
      Since:
      1.19
    • checkTestClasses

      @Parameter(property="animal.sniffer.checkTestClasses", defaultValue="false") protected boolean checkTestClasses
      Should test classes be checked.
      Since:
      1.19
    • signature

      @Parameter(required=true, property="animal.sniffer.signature") protected Signature signature
      Signature module to use.
    • ignores

      @Parameter protected String[] ignores
      Class names to ignore signatures for (wildcards accepted).
    • annotations

      @Parameter protected String[] annotations
      Annotation names to consider to ignore annotated methods, classes or fields.

      By default 'org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement' and 'org.jvnet.animal_sniffer.IgnoreJRERequirement' are used.

      See Also:
    • ignoreDependencies

      @Parameter(defaultValue="true") protected boolean ignoreDependencies
      Should dependencies be ignored.
    • includeDependencies

      @Parameter private String[] includeDependencies
      A list of artifact patterns to include. Patterns can include * as a wildcard match for any whole segment, valid patterns are:
      • groupId:artifactId
      • groupId:artifactId:type
      • groupId:artifactId:type:version
      • groupId:artifactId:type:classifier
      • groupId:artifactId:type:classifier:version
      Since:
      1.12
    • excludeDependencies

      @Parameter private String[] excludeDependencies
      A list of artifact patterns to exclude. Patterns can include * as a wildcard match for any whole segment, valid patterns are:
      • groupId:artifactId
      • groupId:artifactId:type
      • groupId:artifactId:type:version
      • groupId:artifactId:type:classifier
      • groupId:artifactId:type:classifier:version
      Since:
      1.12
    • skip

      @Parameter(defaultValue="false", property="animal.sniffer.skip") protected boolean skip
      Should signature checking be skipped?
    • failOnError

      @Parameter(defaultValue="true", property="animal.sniffer.failOnError") protected boolean failOnError
      Should signature check failures throw an error?
    • resolver

      @Component protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
    • project

      @Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
    • localRepository

      @Parameter(defaultValue="${localRepository}", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
    • artifactFactory

      @Component protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
    • classes

      static Map<File,Map<String,Clazz>> classes
  • Constructor Details

    • CheckSignatureMojo

      public CheckSignatureMojo()
  • Method Details

    • setSignature

      public void setSignature(String signatureId)
      Parameters:
      signatureId - A fully-qualified path to a signature jar. This allows users to set a signature for command-line invocations, such as:

      mvn org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:check -Dsignature=org.codehaus.mojo.signature:java17:1.0

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • loadClasses

      private static Map<String,Clazz> loadClasses(File f) throws IOException
      Throws:
      IOException
    • findMatchingDependency

      private static org.apache.maven.model.Dependency findMatchingDependency(Signature signature, List<org.apache.maven.model.Dependency> dependencies)
    • buildPackageList

      private Set<String> buildPackageList() throws IOException
      List of packages defined in the application.
      Throws:
      IOException
    • apply

      private void apply(ClassFileVisitor v) throws IOException
      Throws:
      IOException
    • buildSourcePathList

      private List<File> buildSourcePathList()