Class BuildSignaturesMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.animal_sniffer.maven.BuildSignaturesMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="build",
configurator="override",
requiresDependencyResolution=COMPILE,
threadSafe=true)
public class BuildSignaturesMojo
extends org.apache.maven.plugin.AbstractMojo
Generates an API Signature from at least one of: the java runtime, the
module dependencies and the module classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileWhere to find this modules classes.private StringThe classifier to add to the generated signatures.private String[]Classes to exclude from generating signatures of.private String[]A list of artifact patterns to exclude.private String[]Classes to generate signatures of.private String[]A list of artifact patterns to include.private booleanShould the signatures from java home be included.private booleanShould the signatures from this module's classes be included..private StringThe java home to generate the signatures of, if not specified only the signatures of dependencies will be included.private File[]private StringThe artifactId of the Java Boot Classpath Detector to use.private StringThe groupId of the Java Boot Classpath Detector to use.private JdkToolchainThe JDK Toolchain to use.private FileWhere to put the generated signatures.private List<org.apache.maven.artifact.Artifact>private org.apache.maven.project.MavenProjectThe maven project.private org.apache.maven.project.MavenProjectHelperprivate org.apache.maven.execution.MavenSessionThe current build session instance.private StringThe name of the generated signatures.private booleanShould no signatures be generated if no java home is available.private org.apache.maven.toolchain.ToolchainManagerprivate org.apache.maven.toolchain.ToolchainManagerPrivateFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringartifactId(org.apache.maven.artifact.Artifact artifact) private booleandetectJavaBootClasspath(String javaExecutable) private booleandetectJavaClasspath(org.apache.maven.artifact.Artifact javaBootClasspathDetector, String javaExecutable) private voidvoidexecute()private InputStream[]private org.apache.maven.toolchain.ToolchainGets thejdktoolchain to use.private org.apache.maven.toolchain.ToolchainGets thejdktoolchain from this plugin's configuration.private org.apache.maven.toolchain.ToolchainGets the toolchain specified for the current context, e.g.private static FilegetTargetFile(File basedir, String finalName, String classifier, String type) private org.apache.maven.toolchain.ToolchainPrivate[]getToolchains(String type) private voidprocessJavaBootClasspath(SignatureBuilder builder) private voidprocessModuleClasses(SignatureBuilder builder) private voidMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
includeJavaHome
@Parameter(property="includeJavaHome", defaultValue="true") private boolean includeJavaHomeShould the signatures from java home be included.- Since:
- 1.3
-
skipIfNoJavaHome
@Parameter(property="skipIfNoJavaHome", defaultValue="false") private boolean skipIfNoJavaHomeShould no signatures be generated if no java home is available.- Since:
- 1.3
-
includeModuleClasses
@Parameter(property="includeJavaHome", defaultValue="true") private boolean includeModuleClassesShould the signatures from this module's classes be included..- Since:
- 1.3
-
includeClasses
Classes to generate signatures of.- Since:
- 1.3
-
excludeClasses
Classes to exclude from generating signatures of.- Since:
- 1.3
-
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.3
-
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.3
-
javaHome
The java home to generate the signatures of, if not specified only the signatures of dependencies will be included. This parameter is overridden byjavaHomeClassPath. This parameter overridesjdkand any java home specified by maven-toolchains-plugin.- Since:
- 1.3
-
javaHomeClassPath
Use this configuration option only if the automatic boot classpath detection does not work for the specificjavaHomeorjdk. For example, the automatic boot classpath detection does not work with Sun Java 1.1. This parameter overridesjavaHome,jdkand the maven-toolchains-plugin.- Since:
- 1.3
-
outputDirectory
Where to put the generated signatures.- Since:
- 1.3
-
classesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true) private File classesDirectoryWhere to find this modules classes.- Since:
- 1.3
-
signaturesName
The name of the generated signatures.- Since:
- 1.3
-
classifier
The classifier to add to the generated signatures.- Since:
- 1.3
-
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelper -
project
@Parameter(defaultValue="${project}", required=true, readonly=true) private org.apache.maven.project.MavenProject projectThe maven project. -
toolchainManager
@Component private org.apache.maven.toolchain.ToolchainManager toolchainManager -
toolchainManagerPrivate
@Component private org.apache.maven.toolchain.ToolchainManagerPrivate toolchainManagerPrivate -
session
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession sessionThe current build session instance. This is used for toolchain manager API calls. -
jdk
The JDK Toolchain to use. This parameter can be overridden byjavaHomeorjavaHomeClassPath. This parameter overrides any toolchain specified with maven-toolchains-plugin.- Since:
- 1.3
-
pluginArtifacts
@Parameter(defaultValue="${plugin.artifacts}", required=true, readonly=true) private List<org.apache.maven.artifact.Artifact> pluginArtifacts -
jbcpdGroupId
The groupId of the Java Boot Classpath Detector to use. The plugin's dependencies will be searched for a dependency of typejarwith this groupId and the artifactId specified injbcpdArtifactId. The dependency should be a standalone executable jar file which outputs the java boot classpath as a single line separated usingFile.pathSeparatorCharor else exits with a non-zero return code if it cannot determine the java boot classpath.- Since:
- 1.3
-
jbcpdArtifactId
The artifactId of the Java Boot Classpath Detector to use. The plugin's dependencies will be searched for a dependency of typejarwith this artifactId and the groupId specified injbcpdGroupId. The dependency should be a standalone executable jar file which outputs the java boot classpath as a single line separated usingFile.pathSeparatorCharor else exits with a non-zero return code if it cannot determine the java boot classpath.- Since:
- 1.3
-
-
Constructor Details
-
BuildSignaturesMojo
public BuildSignaturesMojo()
-
-
Method Details
-
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
-
detectJavaBootClasspath
private boolean detectJavaBootClasspath(String javaExecutable) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionException
-
detectJavaClasspath
private boolean detectJavaClasspath(org.apache.maven.artifact.Artifact javaBootClasspathDetector, String javaExecutable) throws org.codehaus.plexus.util.cli.CommandLineException, org.apache.maven.plugin.MojoFailureException - Throws:
org.codehaus.plexus.util.cli.CommandLineExceptionorg.apache.maven.plugin.MojoFailureException
-
displayJavaBootClasspath
private void displayJavaBootClasspath() -
processModuleDependencies
- Throws:
IOException
-
processModuleClasses
- Throws:
IOException
-
processJavaBootClasspath
- Throws:
IOException
-
getBaseSignatures
- Throws:
FileNotFoundException
-
getJdkToolchain
private org.apache.maven.toolchain.Toolchain getJdkToolchain() throws org.apache.maven.plugin.MojoExecutionExceptionGets thejdktoolchain to use.- Returns:
- the
jdktoolchain to use ornullif no toolchain is configured or if no toolchain can be found. - Throws:
org.apache.maven.plugin.MojoExecutionException- if toolchains are misconfigured.
-
getJdkToolchainFromContext
private org.apache.maven.toolchain.Toolchain getJdkToolchainFromContext()Gets the toolchain specified for the current context, e.g. specified via the maven-toolchain-plugin- Returns:
- the toolchain from the context or
nullif there is no such toolchain.
-
getJdkToolchainFromConfiguration
private org.apache.maven.toolchain.Toolchain getJdkToolchainFromConfiguration() throws org.apache.maven.plugin.MojoExecutionExceptionGets thejdktoolchain from this plugin's configuration.- Returns:
- the toolchain from this plugin's configuration, or
nullif no matching toolchain can be found. - Throws:
org.apache.maven.plugin.MojoExecutionException- if the toolchains are configured incorrectly.
-
artifactId
-
getToolchains
private org.apache.maven.toolchain.ToolchainPrivate[] getToolchains(String type) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.toolchain.MisconfiguredToolchainException - Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.toolchain.MisconfiguredToolchainException
-
getTargetFile
-