Class AbstractValidateMojo

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

    public abstract class AbstractValidateMojo
    extends org.apache.maven.plugin.AbstractMojo
    Common ancestor for all validation related mojos
    • Field Detail

      • project

        @Parameter(property="project",
                   readonly=true,
                   required=false)
        protected org.apache.maven.project.MavenProject project
        The Maven project (might be null)
      • mojoExecution

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

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

        @Parameter(property="vault.failOnValidationWarning",
                   defaultValue="false")
        protected boolean failOnValidationWarnings
        If set to true will lead to all validation errors or warnings failing the build, otherwise only validation errors lead to a build failure
      • dependencies

        @Parameter(property="vault.dependencies")
        protected Collection<MavenBasedPackageDependency> dependencies
        Defines the list of dependencies A dependency is declared as a <dependency> element of a list style <dependencies> element:
         <dependency>
             <group>theGroup</group>
             <name>theName</name>
             <version>1.5</version>
         </dependency>
         

        The dependency can also reference a maven project dependency, this is preferred as it yields to more robust builds.

         <dependency>
             <groupId>theGroup</groupId>
             <artifactId>theName</artifactId>
         </dependency>
         

        The versionRange may be indicated as a single version, in which case the version range has no upper bound and defines the minimal version accepted. Otherwise, the version range defines a lower and upper bound of accepted versions, where the bounds are either included using parentheses () or excluded using brackets []

      • repositoryStructurePackages

        @Parameter(property="vault.repository.structure.packages")
        protected Collection<MavenBasedPackageDependency> repositoryStructurePackages
        Defines the packages that define the repository structure. For the format description look at dependencies.

        The repository-init feature of sling-start can define initial content that will be available in the repository before the first package is installed. Packages that depend on those nodes have no way to reference any dependency package that provides these nodes. A "real" package that would creates those nodes cannot be installed in the repository, because it would void the repository init structure. On the other hand would filevault complain, if the package was listed as dependency but not installed in the repository. So therefore this repository-structure packages serve as indicator packages that helps satisfy the structural dependencies, but are not added as real dependencies to the package.

      • mapPackageDependencyToMavenGa

        @Parameter(property="vault.package.dependency.to.maven.ga")
        protected Collection<String> mapPackageDependencyToMavenGa
        Mapping of package dependencies given via group and name to Maven identifiers for enhanced validation. Each entry must have the format <group>:<name>=<groupId>:<artifactId>. To disable lookup (e.g. because referenced artifact is not available in a Maven repository) use <group>:<name>=ignore. This will also prevent the WARNING which would be otherwise be emitted.
      • csvReportFile

        @Parameter(property="vault.validation.csvReportFile")
        protected File csvReportFile
        The file where to write a report of all found validation violations (warnings and errors) in CSV format as defined in RFC 4180. The generated file is using UTF-8 character encoding. No CSV report is written if this parameter is not set (default).
      • repositorySystem

        @Component
        protected org.apache.maven.repository.RepositorySystem repositorySystem
      • resolutionErrorHandler

        @Component
        protected org.apache.maven.artifact.resolver.ResolutionErrorHandler resolutionErrorHandler
      • buildContext

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

        protected final org.apache.jackrabbit.vault.validation.ValidationExecutorFactory validationExecutorFactory
      • IGNORE_ARTIFACT

        public static final org.apache.maven.artifact.Artifact IGNORE_ARTIFACT
        Artificial Maven artifact which indicates that it should not be considered for further lookup!
    • Constructor Detail

      • AbstractValidateMojo

        public AbstractValidateMojo()
    • Method Detail

      • getProjectRelativeFilePath

        protected String getProjectRelativeFilePath​(File file)
      • shouldSkip

        protected boolean shouldSkip()
        Returns:
        true to skip execution of the mojo. Default is false.
      • 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
      • disableChecksOnlyWorkingForPackages

        protected void disableChecksOnlyWorkingForPackages()
                                                    throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • doExecute

        public abstract void doExecute​(ValidationHelper validationHelper)
                                throws org.apache.maven.plugin.MojoExecutionException,
                                       org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • getValidatorSettingsForPackage

        protected Map<String,​ValidatorSettings> getValidatorSettingsForPackage​(org.apache.jackrabbit.vault.packaging.PackageId packageId,
                                                                                     boolean isSubPackage)