Class AbstractBaselinePlugin

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    BaselinePlugin, BaselineReport

    abstract class AbstractBaselinePlugin
    extends org.apache.maven.plugin.AbstractMojo
    Abstract BND Baseline check between two bundles.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.sonatype.plexus.build.incremental.BuildContext buildContext  
      private java.io.File buildDirectory  
      protected java.lang.String comparisonArtifactId
      Artifact to compare the current code against.
      protected java.lang.String comparisonClassifier
      Classifier for the artifact to compare the current code against.
      protected java.lang.String comparisonGroupId
      Group id to compare the current code against.
      protected java.lang.String comparisonPackaging
      Artifact to compare the current code against.
      protected java.lang.String comparisonVersion
      Version to compare the current code against.
      protected org.apache.maven.artifact.factory.ArtifactFactory factory  
      protected boolean failOnError
      Whether to fail on errors.
      protected boolean failOnWarning
      Whether to fail on warnings.
      private java.lang.String[] filters
      A list of packages filter, if empty the whole bundle will be traversed.
      private java.lang.String finalName  
      private org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource  
      protected org.apache.maven.project.MavenProject project  
      protected org.apache.maven.artifact.resolver.ArtifactResolver resolver  
      protected org.apache.maven.execution.MavenSession session  
      protected boolean skip
      Flag to easily skip execution.
      protected java.util.List<java.lang.String> supportedProjectTypes
      Project types which this plugin supports.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void close​(java.lang.Object context)  
      private static void closeJars​(aQute.bnd.osgi.Jar... jars)  
      private void doDiff​(java.lang.Object context, aQute.bnd.service.diff.Diff diff, int depth)  
      private void doPackageDiff​(java.lang.Object context, aQute.bnd.service.diff.Diff diff)  
      protected abstract void endBaseline​(java.lang.Object context)  
      protected abstract void endDiff​(java.lang.Object context, int depth)  
      protected abstract void endPackage​(java.lang.Object context)  
      void execute()  
      protected void execute​(java.lang.Object context)  
      private void filterSnapshots​(java.util.List<org.apache.maven.artifact.versioning.ArtifactVersion> versions)  
      private java.lang.String getBundleName()  
      private aQute.bnd.osgi.Jar getCurrentBundle()  
      private org.apache.maven.artifact.Artifact getPreviousArtifact()  
      private static java.lang.String getShortDelta​(aQute.bnd.service.diff.Delta delta)  
      protected abstract java.lang.Object init​(java.lang.Object initialContext)  
      private static aQute.bnd.osgi.Jar openJar​(java.io.File file)  
      protected abstract void startBaseline​(java.lang.Object context, java.lang.String generationDate, java.lang.String bundleName, java.lang.String currentVersion, java.lang.String previousVersion)  
      protected abstract void startDiff​(java.lang.Object context, int depth, java.lang.String type, java.lang.String name, java.lang.String delta, java.lang.String shortDelta)  
      protected abstract void startPackage​(java.lang.Object context, boolean mismatch, java.lang.String name, java.lang.String shortDelta, java.lang.String delta, aQute.bnd.version.Version newerVersion, aQute.bnd.version.Version olderVersion, aQute.bnd.version.Version suggestedVersion, DiffMessage diffMessage, java.util.Map<java.lang.String,​java.lang.String> attributes)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • skip

        @Parameter(property="baseline.skip",
                   defaultValue="false")
        protected boolean skip
        Flag to easily skip execution.
      • failOnError

        @Parameter(property="baseline.failOnError",
                   defaultValue="true")
        protected boolean failOnError
        Whether to fail on errors.
      • failOnWarning

        @Parameter(property="baseline.failOnWarning",
                   defaultValue="false")
        protected boolean failOnWarning
        Whether to fail on warnings.
      • project

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

        @Parameter(defaultValue="${session}",
                   readonly=true,
                   required=true)
        protected org.apache.maven.execution.MavenSession session
      • buildDirectory

        @Parameter(defaultValue="${project.build.directory}",
                   readonly=true,
                   required=true)
        private java.io.File buildDirectory
      • finalName

        @Parameter(defaultValue="${project.build.finalName}",
                   readonly=true,
                   required=true)
        private java.lang.String finalName
      • resolver

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

        @Component
        protected org.apache.maven.artifact.factory.ArtifactFactory factory
      • metadataSource

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

        @Parameter(defaultValue="${project.groupId}",
                   property="comparisonGroupId")
        protected java.lang.String comparisonGroupId
        Group id to compare the current code against.
      • comparisonArtifactId

        @Parameter(defaultValue="${project.artifactId}",
                   property="comparisonArtifactId")
        protected java.lang.String comparisonArtifactId
        Artifact to compare the current code against.
      • comparisonVersion

        @Parameter(defaultValue="(,${project.version})",
                   property="comparisonVersion")
        protected java.lang.String comparisonVersion
        Version to compare the current code against.
      • comparisonPackaging

        @Parameter(defaultValue="${project.packaging}",
                   property="comparisonPackaging")
        protected java.lang.String comparisonPackaging
        Artifact to compare the current code against.
      • comparisonClassifier

        @Parameter(property="comparisonClassifier")
        protected java.lang.String comparisonClassifier
        Classifier for the artifact to compare the current code against.
      • filters

        @Parameter
        private java.lang.String[] filters
        A list of packages filter, if empty the whole bundle will be traversed. Values are specified in OSGi package instructions notation, e.g. !org.apache.felix.bundleplugin.
      • supportedProjectTypes

        @Parameter
        protected java.util.List<java.lang.String> supportedProjectTypes
        Project types which this plugin supports.
      • buildContext

        @Component
        protected org.sonatype.plexus.build.incremental.BuildContext buildContext
    • Constructor Detail

      • AbstractBaselinePlugin

        AbstractBaselinePlugin()
    • Method Detail

      • execute

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

        protected void execute​(java.lang.Object context)
                        throws org.apache.maven.plugin.MojoExecutionException,
                               org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • doPackageDiff

        private void doPackageDiff​(java.lang.Object context,
                                   aQute.bnd.service.diff.Diff diff)
      • doDiff

        private void doDiff​(java.lang.Object context,
                            aQute.bnd.service.diff.Diff diff,
                            int depth)
      • init

        protected abstract java.lang.Object init​(java.lang.Object initialContext)
      • close

        protected abstract void close​(java.lang.Object context)
      • startBaseline

        protected abstract void startBaseline​(java.lang.Object context,
                                              java.lang.String generationDate,
                                              java.lang.String bundleName,
                                              java.lang.String currentVersion,
                                              java.lang.String previousVersion)
      • startPackage

        protected abstract void startPackage​(java.lang.Object context,
                                             boolean mismatch,
                                             java.lang.String name,
                                             java.lang.String shortDelta,
                                             java.lang.String delta,
                                             aQute.bnd.version.Version newerVersion,
                                             aQute.bnd.version.Version olderVersion,
                                             aQute.bnd.version.Version suggestedVersion,
                                             DiffMessage diffMessage,
                                             java.util.Map<java.lang.String,​java.lang.String> attributes)
      • startDiff

        protected abstract void startDiff​(java.lang.Object context,
                                          int depth,
                                          java.lang.String type,
                                          java.lang.String name,
                                          java.lang.String delta,
                                          java.lang.String shortDelta)
      • endDiff

        protected abstract void endDiff​(java.lang.Object context,
                                        int depth)
      • endPackage

        protected abstract void endPackage​(java.lang.Object context)
      • endBaseline

        protected abstract void endBaseline​(java.lang.Object context)
      • getCurrentBundle

        private aQute.bnd.osgi.Jar getCurrentBundle()
                                             throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getPreviousArtifact

        private org.apache.maven.artifact.Artifact getPreviousArtifact()
                                                                throws org.apache.maven.plugin.MojoFailureException,
                                                                       org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoFailureException
        org.apache.maven.plugin.MojoExecutionException
      • filterSnapshots

        private void filterSnapshots​(java.util.List<org.apache.maven.artifact.versioning.ArtifactVersion> versions)
      • openJar

        private static aQute.bnd.osgi.Jar openJar​(java.io.File file)
                                           throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • closeJars

        private static void closeJars​(aQute.bnd.osgi.Jar... jars)
      • getBundleName

        private java.lang.String getBundleName()
      • getShortDelta

        private static java.lang.String getShortDelta​(aQute.bnd.service.diff.Delta delta)