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.AbstractMojoChecks the classes compiled by this module.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]annotationsAnnotation names to consider to ignore annotated methods, classes or fields.protected booleancheckTestClassesShould test classes be checked.(package private) static java.util.Map<java.io.File,java.util.Map<java.lang.String,Clazz>>classesprivate java.lang.String[]excludeDependenciesA list of artifact patterns to exclude.protected booleanfailOnErrorShould signature check failures throw an error?protected booleanignoreDependenciesShould dependencies be ignored.protected java.lang.String[]ignoresClass names to ignore signatures for (wildcards accepted).private java.lang.String[]includeDependenciesA list of artifact patterns to include.protected java.io.FileoutputDirectoryThe directory for compiled classes.protected org.apache.maven.project.MavenProjectprojectprivate org.eclipse.aether.RepositorySystemrepositorySystemprivate org.eclipse.aether.RepositorySystemSessionrepositorySystemSessionprotected SignaturesignatureSignature module to use.protected booleanskipShould signature checking be skipped?protected java.io.FiletestOutputDirectoryThe directory for compiled test classes.
-
Constructor Summary
Constructors Constructor Description CheckSignatureMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidapply(ClassFileVisitor v)private java.util.Set<java.lang.String>buildPackageList()List of packages defined in the application.private java.util.List<java.io.File>buildSourcePathList()voidexecute()private static org.apache.maven.model.DependencyfindMatchingDependency(Signature signature, java.util.List<org.apache.maven.model.Dependency> dependencies)private static java.util.Map<java.lang.String,Clazz>loadClasses(java.io.File f)private java.io.FileresolveFileForArtifact(org.eclipse.aether.artifact.Artifact artifact)voidsetSignature(java.lang.String signatureId)
-
-
-
Field Detail
-
outputDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) protected java.io.File outputDirectoryThe directory for compiled classes.
-
testOutputDirectory
@Parameter(defaultValue="${project.build.testOutputDirectory}", required=true, readonly=true) protected java.io.File testOutputDirectoryThe directory for compiled test classes.- Since:
- 1.19
-
checkTestClasses
@Parameter(property="animal.sniffer.checkTestClasses", defaultValue="false") protected boolean checkTestClassesShould test classes be checked.- Since:
- 1.19
-
signature
@Parameter(required=true, property="animal.sniffer.signature") protected Signature signatureSignature module to use.
-
ignores
@Parameter protected java.lang.String[] ignores
Class names to ignore signatures for (wildcards accepted).
-
annotations
@Parameter protected java.lang.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.
-
ignoreDependencies
@Parameter(defaultValue="true") protected boolean ignoreDependencies
Should dependencies be ignored.
-
includeDependencies
@Parameter private java.lang.String[] includeDependencies
A list of artifact patterns to include. Patterns can include*as a wildcard match for any whole segment, valid patterns are:groupId:artifactIdgroupId:artifactId:typegroupId:artifactId:type:versiongroupId:artifactId:type:classifiergroupId:artifactId:type:classifier:version
- Since:
- 1.12
-
excludeDependencies
@Parameter private java.lang.String[] excludeDependencies
A list of artifact patterns to exclude. Patterns can include*as a wildcard match for any whole segment, valid patterns are:groupId:artifactIdgroupId:artifactId:typegroupId:artifactId:type:versiongroupId:artifactId:type:classifiergroupId:artifactId:type:classifier:version
- Since:
- 1.12
-
skip
@Parameter(defaultValue="false", property="animal.sniffer.skip") protected boolean skipShould signature checking be skipped?
-
failOnError
@Parameter(defaultValue="true", property="animal.sniffer.failOnError") protected boolean failOnErrorShould signature check failures throw an error?
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
-
repositorySystemSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true) private org.eclipse.aether.RepositorySystemSession repositorySystemSession
-
repositorySystem
@Component private org.eclipse.aether.RepositorySystem repositorySystem
-
classes
static java.util.Map<java.io.File,java.util.Map<java.lang.String,Clazz>> classes
-
-
Method Detail
-
setSignature
public void setSignature(java.lang.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.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
resolveFileForArtifact
private java.io.File resolveFileForArtifact(org.eclipse.aether.artifact.Artifact artifact) throws org.eclipse.aether.resolution.ArtifactResolutionException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionExceptionorg.apache.maven.plugin.MojoExecutionException
-
loadClasses
private static java.util.Map<java.lang.String,Clazz> loadClasses(java.io.File f) throws java.io.IOException
- Throws:
java.io.IOException
-
findMatchingDependency
private static org.apache.maven.model.Dependency findMatchingDependency(Signature signature, java.util.List<org.apache.maven.model.Dependency> dependencies)
-
buildPackageList
private java.util.Set<java.lang.String> buildPackageList() throws java.io.IOExceptionList of packages defined in the application.- Throws:
java.io.IOException
-
apply
private void apply(ClassFileVisitor v) throws java.io.IOException
- Throws:
java.io.IOException
-
buildSourcePathList
private java.util.List<java.io.File> buildSourcePathList()
-
-