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
Fields Modifier and Type Field Description private java.io.File
basedir
Project base directory (prepended to relative file paths).private boolean
failOnError
Whether the build will fail on verification errors.private VerificationResultPrinter
resultPrinter
private java.io.File
verificationFile
The file containing the verifications to perform.
-
Constructor Summary
Constructors Constructor Description VerifierMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
protected java.io.File
getAbsoluteFileToCheck(java.io.File file)
void
setBaseDir(java.io.File theBasedir)
void
setFailOnError(boolean failOnError)
void
setVerificationFile(java.io.File file)
void
setVerificationResultPrinter(VerificationResultPrinter printer)
private VerificationResult
verify()
private boolean
verifyFile(File fileCheck, VerificationResult results)
private boolean
verifyFileContent(File fileCheck, VerificationResult results)
private boolean
verifyFileExistence(File fileCheck, VerificationResult results)
-
-
-
Field Detail
-
basedir
@Parameter(property="basedir", required=true) private java.io.File basedir
Project base directory (prepended to relative file paths).
-
verificationFile
@Parameter(property="verifier.verificationFile", defaultValue="${basedir}/src/test/verifier/verifications.xml", required=true) private java.io.File verificationFile
The file containing the verifications to perform.
-
failOnError
@Parameter(property="verifier.failOnError", defaultValue="true", required=true) private boolean failOnError
Whether the build will fail on verification errors.
-
resultPrinter
private VerificationResultPrinter resultPrinter
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getAbsoluteFileToCheck
protected java.io.File getAbsoluteFileToCheck(java.io.File file)
- 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
private VerificationResult verify() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
verifyFile
private boolean verifyFile(File fileCheck, VerificationResult results) throws java.io.IOException
- Throws:
java.io.IOException
-
verifyFileContent
private boolean verifyFileContent(File fileCheck, VerificationResult results) throws java.io.IOException
- Throws:
java.io.IOException
-
verifyFileExistence
private boolean verifyFileExistence(File fileCheck, VerificationResult results)
-
setBaseDir
public void setBaseDir(java.io.File theBasedir)
- Parameters:
theBasedir
- Set the base directory.
-
setVerificationFile
public void setVerificationFile(java.io.File file)
- Parameters:
file
- Set the file for verification.
-
setVerificationResultPrinter
public void setVerificationResultPrinter(VerificationResultPrinter printer)
- Parameters:
printer
- The verification result printer.
-
setFailOnError
public void setFailOnError(boolean failOnError)
- Parameters:
failOnError
- true to fail on error false otherwise.
-
-