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 Details

    • includeJavaHome

      @Parameter(property="includeJavaHome", defaultValue="true") private boolean includeJavaHome
      Should the signatures from java home be included.
      Since:
      1.3
    • skipIfNoJavaHome

      @Parameter(property="skipIfNoJavaHome", defaultValue="false") private boolean skipIfNoJavaHome
      Should no signatures be generated if no java home is available.
      Since:
      1.3
    • includeModuleClasses

      @Parameter(property="includeJavaHome", defaultValue="true") private boolean includeModuleClasses
      Should the signatures from this module's classes be included..
      Since:
      1.3
    • includeClasses

      @Parameter private String[] includeClasses
      Classes to generate signatures of.
      Since:
      1.3
    • excludeClasses

      @Parameter private String[] excludeClasses
      Classes to exclude from generating signatures of.
      Since:
      1.3
    • 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.3
    • 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.3
    • javaHome

      @Parameter(property="javaHome") private String javaHome
      The java home to generate the signatures of, if not specified only the signatures of dependencies will be included. This parameter is overridden by javaHomeClassPath. This parameter overrides jdk and any java home specified by maven-toolchains-plugin.
      Since:
      1.3
    • javaHomeClassPath

      @Parameter private File[] javaHomeClassPath
      Use this configuration option only if the automatic boot classpath detection does not work for the specific javaHome or jdk. For example, the automatic boot classpath detection does not work with Sun Java 1.1. This parameter overrides javaHome, jdk and the maven-toolchains-plugin.
      Since:
      1.3
    • outputDirectory

      @Parameter(defaultValue="${project.build.directory}", required=true) private File outputDirectory
      Where to put the generated signatures.
      Since:
      1.3
    • classesDirectory

      @Parameter(defaultValue="${project.build.outputDirectory}", required=true) private File classesDirectory
      Where to find this modules classes.
      Since:
      1.3
    • signaturesName

      @Parameter(defaultValue="${project.build.finalName}", required=true) private String signaturesName
      The name of the generated signatures.
      Since:
      1.3
    • classifier

      @Parameter private String 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 project
      The 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 session
      The current build session instance. This is used for toolchain manager API calls.
    • jdk

      @Parameter private JdkToolchain jdk
      The JDK Toolchain to use. This parameter can be overridden by javaHome or javaHomeClassPath. 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

      @Parameter(defaultValue="${plugin.groupId}") private String jbcpdGroupId
      The groupId of the Java Boot Classpath Detector to use. The plugin's dependencies will be searched for a dependency of type jar with this groupId and the artifactId specified in jbcpdArtifactId. The dependency should be a standalone executable jar file which outputs the java boot classpath as a single line separated using File.pathSeparatorChar or else exits with a non-zero return code if it cannot determine the java boot classpath.
      Since:
      1.3
    • jbcpdArtifactId

      @Parameter(defaultValue="java-boot-classpath-detector") private String jbcpdArtifactId
      The artifactId of the Java Boot Classpath Detector to use. The plugin's dependencies will be searched for a dependency of type jar with this artifactId and the groupId specified in jbcpdGroupId. The dependency should be a standalone executable jar file which outputs the java boot classpath as a single line separated using File.pathSeparatorChar or 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.MojoExecutionException
      org.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.MojoFailureException
      org.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.CommandLineException
      org.apache.maven.plugin.MojoFailureException
    • displayJavaBootClasspath

      private void displayJavaBootClasspath()
    • processModuleDependencies

      private void processModuleDependencies(SignatureBuilder builder) throws IOException
      Throws:
      IOException
    • processModuleClasses

      private void processModuleClasses(SignatureBuilder builder) throws IOException
      Throws:
      IOException
    • processJavaBootClasspath

      private void processJavaBootClasspath(SignatureBuilder builder) throws IOException
      Throws:
      IOException
    • getBaseSignatures

      private InputStream[] getBaseSignatures() throws FileNotFoundException
      Throws:
      FileNotFoundException
    • getJdkToolchain

      private org.apache.maven.toolchain.Toolchain getJdkToolchain() throws org.apache.maven.plugin.MojoExecutionException
      Gets the jdk toolchain to use.
      Returns:
      the jdk toolchain to use or null if 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 null if there is no such toolchain.
    • getJdkToolchainFromConfiguration

      private org.apache.maven.toolchain.Toolchain getJdkToolchainFromConfiguration() throws org.apache.maven.plugin.MojoExecutionException
      Gets the jdk toolchain from this plugin's configuration.
      Returns:
      the toolchain from this plugin's configuration, or null if no matching toolchain can be found.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if the toolchains are configured incorrectly.
    • artifactId

      static String artifactId(org.apache.maven.artifact.Artifact artifact)
    • 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.MojoExecutionException
      org.apache.maven.toolchain.MisconfiguredToolchainException
    • getTargetFile

      private static File getTargetFile(File basedir, String finalName, String classifier, String type)