Class AbstractValidateMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.jackrabbit.filevault.maven.packaging.mojo.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 Summary
Fields Modifier and Type Field Description protected org.sonatype.plexus.build.incremental.BuildContext
buildContext
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.protected Collection<MavenBasedPackageDependency>
dependencies
Defines the list of dependencies.protected boolean
failOnValidationWarnings
If set totrue
will lead to all validation errors or warnings failing the build, otherwise only validation errors lead to a build failurestatic org.eclipse.aether.artifact.Artifact
IGNORE_ARTIFACT
Artificial Maven artifact which indicates that it should not be considered for further lookup!static String
IGNORE_GAV
protected Collection<String>
mapPackageDependencyToMavenGa
Mapping of package dependencies given via group and name to Maven coordinates for enhanced validation.protected org.apache.maven.plugin.MojoExecution
mojoExecution
protected org.apache.maven.project.MavenProject
project
The Maven project (nevernull
, but might be dummy project returningnull
for all methods if running outside apom.xml
context)protected Collection<MavenBasedPackageDependency>
repositoryStructurePackages
Defines the packages that define the repository structure.protected org.eclipse.aether.RepositorySystem
repositorySystem
protected DependencyResolver
resolver
protected org.apache.maven.execution.MavenSession
session
protected org.apache.jackrabbit.vault.validation.ValidationExecutorFactory
validationExecutorFactory
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractValidateMojo(org.eclipse.aether.RepositorySystem repositorySystem, org.sonatype.plexus.build.incremental.BuildContext buildContext)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
doExecute(ValidationMessagePrinter validationHelper)
void
execute()
protected static Map<String,ValidatorSettings>
getEffectiveValidatorSettingsForPackage(Map<String,ValidatorSettings> validatorsSettings, org.apache.jackrabbit.vault.packaging.PackageId packageId, boolean isSubPackage)
protected Map<String,ValidatorSettings>
getEffectiveValidatorSettingsForPackage(org.apache.jackrabbit.vault.packaging.PackageId packageId, boolean isSubPackage)
protected String
getProjectRelativeFilePath(Path path)
static String
getRelativeFilePath(@NotNull Path path, @Nullable Path baseDir)
protected boolean
shouldSkip()
-
-
-
Field Detail
-
IGNORE_GAV
public static final String IGNORE_GAV
- See Also:
- Constant Field Values
-
project
@Parameter(defaultValue="${project}", readonly=true, required=false) protected org.apache.maven.project.MavenProject project
The Maven project (nevernull
, but might be dummy project returningnull
for all methods if running outside apom.xml
context)
-
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 totrue
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. They are sharing the same format as the elements used independencies
.The repoinit feature of Sling 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 a regular 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 repoinit structure. On the other hand FileVault would complain, if the package was listed as dependency but not installed in the repository. Therefore these repository-structure packages serve as build-time only dependency that help satisfy the structural dependencies, but are not added as real (i.e. run-time) dependencies to the package. Repository-structure packages are only evaluated for their contained filter rules' root attributes. Currently these packages are only used to define the
validRoots
of the validatorjackrabbit-filter
.
-
mapPackageDependencyToMavenGa
@Parameter(property="vault.package.dependency.to.maven.ga") protected Collection<String> mapPackageDependencyToMavenGa
Mapping of package dependencies given via group and name to Maven coordinates for enhanced validation. Each entry must have the format<group>:<name>=<groupId>:<artifactId>[:<extension>[:<classifier>]]
. The extension is always implicitly assumed to bezip
(no matter what is given). The version always determined from the package dependency and must not be given. 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).
-
validationExecutorFactory
protected final org.apache.jackrabbit.vault.validation.ValidationExecutorFactory validationExecutorFactory
-
resolver
protected DependencyResolver resolver
-
repositorySystem
protected final org.eclipse.aether.RepositorySystem repositorySystem
-
buildContext
protected final org.sonatype.plexus.build.incremental.BuildContext buildContext
-
IGNORE_ARTIFACT
public static final org.eclipse.aether.artifact.Artifact IGNORE_ARTIFACT
Artificial Maven artifact which indicates that it should not be considered for further lookup!
-
-
Method Detail
-
getRelativeFilePath
public static String getRelativeFilePath(@NotNull @NotNull Path path, @Nullable @Nullable Path baseDir)
-
shouldSkip
protected boolean shouldSkip()
- Returns:
true
to skip execution of the mojo. Default isfalse
.
-
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
-
doExecute
public abstract void doExecute(ValidationMessagePrinter validationHelper) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getEffectiveValidatorSettingsForPackage
protected Map<String,ValidatorSettings> getEffectiveValidatorSettingsForPackage(org.apache.jackrabbit.vault.packaging.PackageId packageId, boolean isSubPackage) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getEffectiveValidatorSettingsForPackage
protected static Map<String,ValidatorSettings> getEffectiveValidatorSettingsForPackage(Map<String,ValidatorSettings> validatorsSettings, org.apache.jackrabbit.vault.packaging.PackageId packageId, boolean isSubPackage)
-
-