@Mojo(name="validate", defaultPhase=TEST, threadSafe=true) public class ValidateMojo extends AbstractXmlMojo
Modifier and Type | Field and Description |
---|---|
private ValidationSet[] |
validationSets
Specifies a set of document types, which are being validated.
|
Constructor and Description |
---|
ValidateMojo() |
Modifier and Type | Method and Description |
---|---|
void |
execute()
Called by Maven for executing the Mojo.
|
private javax.xml.validation.Schema |
getSchema(Resolver pResolver,
ValidationSet pValidationSet)
Reads a validation sets schema.
|
private javax.xml.parsers.SAXParserFactory |
newSAXParserFactory(ValidationSet pValidationSet)
Creates a new instance of
SAXParserFactory . |
private void |
parse(Resolver pResolver,
ValidationSet pValidationSet,
java.io.File pFile)
Called for validating a single file.
|
private void |
validate(Resolver pResolver,
ValidationSet pValidationSet)
Called for validating a set of XML files against a common schema.
|
private void |
validate(Resolver pResolver,
ValidationSet pValidationSet,
javax.xml.validation.Schema pSchema,
java.io.File pFile)
Called for parsing or validating a single file.
|
activateProxy, asAbsoluteFile, asFiles, getBasedir, getExcludes, getFileNames, getFiles, getLocator, getProject, getResolver, getResource, isSkipping, passivateProxy, setCatalogs
@Parameter private ValidationSet[] validationSets
private javax.xml.validation.Schema getSchema(Resolver pResolver, ValidationSet pValidationSet) throws org.apache.maven.plugin.MojoExecutionException
pResolver
- The resolver to use for loading external entities.pValidationSet
- The validation set to configure.org.apache.maven.plugin.MojoExecutionException
- Loading the schema failed.private void validate(Resolver pResolver, ValidationSet pValidationSet, javax.xml.validation.Schema pSchema, java.io.File pFile) throws org.apache.maven.plugin.MojoExecutionException
pResolver
- The resolver to use for loading external entities.pValidationSet
- The parsers or validators configuration.pSchema
- The schema to use.pFile
- The file to parse or validate.org.apache.maven.plugin.MojoExecutionException
- Parsing or validating the file failed.private javax.xml.parsers.SAXParserFactory newSAXParserFactory(ValidationSet pValidationSet)
SAXParserFactory
.pValidationSet
- The parser factories configuration.private void parse(Resolver pResolver, ValidationSet pValidationSet, java.io.File pFile) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
pResolver
- The resolver to use for loading external entities.pValidationSet
- The validators configuration.pFile
- The file to validate.java.io.IOException
- An I/O error occurred.org.xml.sax.SAXException
- Parsing the file failed.javax.xml.parsers.ParserConfigurationException
- Creating an XML parser failed.private void validate(Resolver pResolver, ValidationSet pValidationSet) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
pResolver
- The resolver to use for loading external entities.pValidationSet
- The set of XML files to validate.org.apache.maven.plugin.MojoExecutionException
- Validating the set of files failed.org.apache.maven.plugin.MojoFailureException
- A configuration error was detected.public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
- Running the Mojo failed.org.apache.maven.plugin.MojoFailureException
- A configuration error was detected.