Package japicmp.maven

Class JApiCmpMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
japicmp.maven.JApiCmpMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="cmp", requiresDependencyResolution=COMPILE, defaultPhase=VERIFY, threadSafe=true) public class JApiCmpMojo extends org.apache.maven.plugin.AbstractMojo
  • Field Details

    • oldVersion

      @Parameter(required=false) private Version oldVersion
    • oldVersions

      @Parameter(required=false) private List<DependencyDescriptor> oldVersions
    • newVersion

      @Parameter(required=false) private Version newVersion
    • newVersions

      @Parameter(required=false) private List<DependencyDescriptor> newVersions
    • parameter

      @Parameter(required=false) private Parameter parameter
    • dependencies

      @Parameter(required=false) private List<Dependency> dependencies
    • oldClassPathDependencies

      @Parameter(required=false) private List<Dependency> oldClassPathDependencies
    • newClassPathDependencies

      @Parameter(required=false) private List<Dependency> newClassPathDependencies
    • skip

      @Parameter(property="japicmp.skip", required=false) private boolean skip
    • skipXmlReport

      @Parameter(property="japicmp.skipXmlReport", required=false) private boolean skipXmlReport
    • skipHtmlReport

      @Parameter(property="japicmp.skipHtmlReport", required=false) private boolean skipHtmlReport
    • breakBuildOnModifications

      @Parameter(property="japicmp.breakBuildOnModifications", required=false) private boolean breakBuildOnModifications
    • breakBuildOnBinaryIncompatibleModifications

      @Parameter(property="japicmp.breakBuildOnBinaryIncompatibleModifications", required=false) private boolean breakBuildOnBinaryIncompatibleModifications
    • breakBuildOnSourceIncompatibleModifications

      @Parameter(property="japicmp.breakBuildOnSourceIncompatibleModifications", required=false) private boolean breakBuildOnSourceIncompatibleModifications
    • breakBuildBasedOnSemanticVersioning

      @Parameter(property="japicmp.breakBuildBasedOnSemanticVersioning", required=false) private boolean breakBuildBasedOnSemanticVersioning
    • breakBuildBasedOnSemanticVersioningForMajorVersionZero

      @Parameter(property="japicmp.breakBuildBasedOnSemanticVersioningForMajorVersionZero", required=false) private boolean breakBuildBasedOnSemanticVersioningForMajorVersionZero
    • projectBuildDir

      @Parameter(property="project.build.directory", required=true) private File projectBuildDir
    • artifactFactory

      @Component private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
    • repoSystem

      @Component private org.eclipse.aether.RepositorySystem repoSystem
    • repoSession

      @Parameter(defaultValue="${repositorySystemSession}", readonly=true) private org.eclipse.aether.RepositorySystemSession repoSession
    • remoteRepos

      @Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true) private List<org.eclipse.aether.repository.RemoteRepository> remoteRepos
    • localRepository

      @Parameter(defaultValue="${localRepository}") private org.apache.maven.artifact.repository.ArtifactRepository localRepository
    • artifactRepositories

      @Parameter(defaultValue="${project.remoteArtifactRepositories}") private List<org.apache.maven.artifact.repository.ArtifactRepository> artifactRepositories
    • mavenProject

      @Parameter(defaultValue="${project}") private org.apache.maven.project.MavenProject mavenProject
    • mojoExecution

      @Parameter(defaultValue="${mojoExecution}", readonly=true) private org.apache.maven.plugin.MojoExecution mojoExecution
    • versionRangeWithProjectVersion

      @Parameter(defaultValue="(,${project.version})", readonly=true) private String versionRangeWithProjectVersion
    • metadataSource

      @Component private org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource
    • options

      private Options options
  • Constructor Details

    • JApiCmpMojo

      public JApiCmpMojo()
  • 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
    • executeWithParameters

      Optional<XmlOutput> executeWithParameters(PluginParameters pluginParameters, MavenParameters mavenParameters) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoFailureException
      org.apache.maven.plugin.MojoExecutionException
    • setUpOverrideCompatibilityChanges

      private void setUpOverrideCompatibilityChanges(JarArchiveComparatorOptions comparatorOptions, PluginParameters pluginParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • skipModule

      private boolean skipModule(PluginParameters pluginParameters, MavenParameters mavenParameters)
    • getComparisonArtifact

      private org.eclipse.aether.artifact.Artifact getComparisonArtifact(MavenParameters mavenParameters, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoFailureException
      org.apache.maven.plugin.MojoExecutionException
    • processArtifacResult

      private void processArtifacResult(org.eclipse.aether.artifact.DefaultArtifact artifactVersion, org.eclipse.aether.resolution.ArtifactResult artifactResult, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • filterVersionPattern

      private void filterVersionPattern(List<org.eclipse.aether.version.Version> availableVersions, PluginParameters pluginParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • filterSnapshots

      private void filterSnapshots(List<org.eclipse.aether.version.Version> versions)
    • populateArchivesListsFromParameters

      private void populateArchivesListsFromParameters(PluginParameters pluginParameters, MavenParameters mavenParameters, List<JApiCmpArchive> oldArchives, List<JApiCmpArchive> newArchives) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • breakBuildIfNecessary

      void breakBuildIfNecessary(List<JApiClass> jApiClasses, Parameter parameterParam, Options options, JarArchiveComparator jarArchiveComparator) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoFailureException
      org.apache.maven.plugin.MojoExecutionException
    • breakBuildBasedOnSemanticVersioningForMajorVersionZero

      private boolean breakBuildBasedOnSemanticVersioningForMajorVersionZero(Parameter parameterParam)
    • getOptions

      Options getOptions(PluginParameters pluginParameters, MavenParameters mavenParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • breakBuildOnModificationsParameter

      private boolean breakBuildOnModificationsParameter(Parameter parameterParam)
    • breakBuildOnBinaryIncompatibleModifications

      private boolean breakBuildOnBinaryIncompatibleModifications(Parameter parameterParam)
    • breakBuildOnSourceIncompatibleModifications

      private boolean breakBuildOnSourceIncompatibleModifications(Parameter parameter)
    • breakBuildBasedOnSemanticVersioning

      private boolean breakBuildBasedOnSemanticVersioning(Parameter parameter)
    • createJapiCmpBaseDir

      private File createJapiCmpBaseDir(PluginParameters pluginParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • generateDiffOutput

      private void generateDiffOutput(MavenParameters mavenParameters, PluginParameters pluginParameters, Options options, List<JApiClass> jApiClasses, File jApiCmpBuildDir) throws IOException, org.apache.maven.plugin.MojoFailureException
      Throws:
      IOException
      org.apache.maven.plugin.MojoFailureException
    • generateXmlOutput

      private XmlOutput generateXmlOutput(List<JApiClass> jApiClasses, File jApiCmpBuildDir, Options options, MavenParameters mavenParameters, PluginParameters pluginParameters) throws IOException
      Throws:
      IOException
    • skipHtmlReport

      private boolean skipHtmlReport(PluginParameters pluginParameters)
    • skipXmlReport

      private boolean skipXmlReport(PluginParameters pluginParameters)
    • createFilename

      private String createFilename(MavenParameters mavenParameters)
    • setUpClassPath

      private void setUpClassPath(JarArchiveComparatorOptions comparatorOptions, PluginParameters pluginParameters, MavenParameters mavenParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • setUpClassPathUsingMavenProject

      private void setUpClassPathUsingMavenProject(JarArchiveComparatorOptions comparatorOptions, MavenParameters mavenParameters, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • mapPackaging

      private String mapPackaging(String packaging, boolean condition, String mappedPackaging)
    • handleMissingArtifactFile

      private void handleMissingArtifactFile(PluginParameters pluginParameters, org.eclipse.aether.artifact.Artifact artifact)
    • toDescriptor

      private String toDescriptor(org.eclipse.aether.artifact.Artifact artifact)
    • retrieveFileFromConfiguration

      private List<JApiCmpArchive> retrieveFileFromConfiguration(DependencyDescriptor dependencyDescriptor, String parameterName, MavenParameters mavenParameters, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • retrieveFileFromConfiguration

      private List<JApiCmpArchive> retrieveFileFromConfiguration(Version version, String parameterName, MavenParameters mavenParameters, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • resolveConfigurationFileToFile

      private List<JApiCmpArchive> resolveConfigurationFileToFile(String parameterName, ConfigurationFile configurationFile, JApiCmpMojo.ConfigurationVersion configurationVersion, PluginParameters pluginParameters) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • resolveDependencyToFile

      private List<JApiCmpArchive> resolveDependencyToFile(String parameterName, Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • guessVersion

      private String guessVersion(File file)
    • ignoreMissingArtifact

      private boolean ignoreMissingArtifact(PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion)
    • ignoreNonResolvableArtifacts

      private boolean ignoreNonResolvableArtifacts(PluginParameters pluginParameters)
    • ignoreMissingOldVersion

      private boolean ignoreMissingOldVersion(PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion)
    • ignoreMissingNewVersion

      private boolean ignoreMissingNewVersion(PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion)
    • ignoreMissingOldVersion

      private boolean ignoreMissingOldVersion(PluginParameters pluginParameters)
    • ignoreMissingNewVersion

      private boolean ignoreMissingNewVersion(PluginParameters pluginParameters)
    • writeToFile

      private void writeToFile(String output, File outputfile) throws org.apache.maven.plugin.MojoFailureException, IOException
      Throws:
      org.apache.maven.plugin.MojoFailureException
      IOException
    • resolveArtifact

      private Set<org.eclipse.aether.artifact.Artifact> resolveArtifact(Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • resolveArtifact

      private Set<org.eclipse.aether.artifact.Artifact> resolveArtifact(org.eclipse.aether.artifact.Artifact artifact, MavenParameters mavenParameters, PluginParameters pluginParameters, JApiCmpMojo.ConfigurationVersion configurationVersion) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • isPomModuleNeedingSkip

      private boolean isPomModuleNeedingSkip(PluginParameters pluginParameters, MavenParameters mavenParameters)
    • notNull

      private static <T> T notNull(T value, String msg) throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException