Package org.apache.maven.plugin.verifier
Class VerifierMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.verifier.VerifierMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="verify",
defaultPhase=INTEGRATION_TEST)
public class VerifierMojo
extends org.apache.maven.plugin.AbstractMojo
Verifies the existence or non-existence of files/directories and optionally checks file content against a regular
expression.
- Version:
- $Id: VerifierMojo.java 1672699 2015-04-10 16:45:27Z khmarbaise $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileProject base directory (prepended to relative file paths).private booleanWhether the build will fail on verification errors.private VerificationResultPrinterprivate FileThe file containing the verifications to perform.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()protected FilegetAbsoluteFileToCheck(File file) voidsetBaseDir(File theBasedir) voidsetFailOnError(boolean failOnError) voidsetVerificationFile(File file) voidprivate VerificationResultverify()private booleanverifyFile(File fileCheck, VerificationResult results) private booleanverifyFileContent(File fileCheck, VerificationResult results) private booleanverifyFileExistence(File fileCheck, VerificationResult results) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
basedir
Project base directory (prepended to relative file paths). -
verificationFile
@Parameter(property="verifier.verificationFile", defaultValue="${basedir}/src/test/verifier/verifications.xml", required=true) private File verificationFileThe file containing the verifications to perform. -
failOnError
@Parameter(property="verifier.failOnError", defaultValue="true", required=true) private boolean failOnErrorWhether the build will fail on verification errors. -
resultPrinter
-
-
Constructor Details
-
VerifierMojo
public VerifierMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getAbsoluteFileToCheck
- Parameters:
file- the file path of the file to check (can be relative or absolute). If relative the project's basedir will be prefixed.- Returns:
- the absolute file path of the file to check
-
verify
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
verifyFile
- Throws:
IOException
-
verifyFileContent
- Throws:
IOException
-
verifyFileExistence
-
setBaseDir
- Parameters:
theBasedir- Set the base directory.
-
setVerificationFile
- Parameters:
file- Set the file for verification.
-
setVerificationResultPrinter
- Parameters:
printer- The verification result printer.
-
setFailOnError
public void setFailOnError(boolean failOnError) - Parameters:
failOnError- true to fail on error false otherwise.
-