public abstract class AbstractXsdGeneratorMojo extends AbstractJaxbMojo
Abstract superclass for Mojos that generate XSD files from annotated Java Sources.
This Mojo delegates execution to the schemagen
tool to perform the XSD file
generation. Moreover, the AbstractXsdGeneratorMojo provides an augmented processing
pipeline by optionally letting a set of NodeProcessors improve the 'vanilla' XSD files.
Modifier and Type | Field and Description |
---|---|
static List<Filter<File>> |
CLASS_INCLUDE_FILTERS
Filter list containing a PatternFileFilter including ".class" files.
|
protected boolean |
clearOutputDir
Removes all files from the output directory before running SchemaGenerator.
|
protected boolean |
createJavaDocAnnotations
If
true , Elements or Attributes in the generated XSD files will be annotated with any
JavaDoc found for their respective properties. |
protected boolean |
generateEpisode
Corresponding SchemaGen parameter:
episode . |
protected JavaDocRenderer |
javaDocRenderer
A renderer used to create XML annotation text from JavaDoc comments found within the source code.
|
static Pattern |
SCHEMAGEN_EMITTED_FILENAME
Pattern matching the names of files emitted by the JAXB/JDK SchemaGenerator.
|
static List<Filter<File>> |
STANDARD_BYTECODE_EXCLUDE_FILTERS
Default exclude file name suffixes for testSources, used unless overridden by an
explicit configuration in the
testSourceExcludeSuffixes parameter. |
static JavaDocRenderer |
STANDARD_JAVADOC_RENDERER
The default JavaDocRenderer used unless another JavaDocRenderer should be used.
|
static List<String> |
SYSTEM_TOOLS_CLASSLOADER_PACKAGES
Specification for packages which must be loaded using the SystemToolClassLoader (and not in the plugin's
ThreadContext ClassLoader).
|
CONTAINS_WHITESPACE, extraFacets, locale, NEWLINE, PACKAGE_INFO_FILENAME, staleFileDirectory, STANDARD_EPISODE_FILENAME, STANDARD_EXCLUDE_FILTERS
Constructor and Description |
---|
AbstractXsdGeneratorMojo() |
Modifier and Type | Method and Description |
---|---|
protected abstract List<URL> |
getCompiledClassNames()
Finds a List containing URLs to compiled bytecode files within this Compilation Unit.
|
protected abstract List<URL> |
getSources()
Override this method to acquire a List holding all URLs to the SchemaGen Java sources for which this
AbstractXsdGeneratorMojo should generate Xml Schema Descriptor files.
|
protected abstract File |
getWorkDirectory() |
protected boolean |
isReGenerationRequired() |
protected boolean |
performExecution()
Implement this method to perform this Mojo's execution.
|
protected boolean |
shouldExecutionBeSkipped()
XSD schema files are not generated from POM projects or if no includes have been supplied.
|
execute, getBuildContext, getClasspath, getEncoding, getEpisodeFile, getExecution, getOutputDirectory, getProject, getStaleFile, getStaleFileName, logAndReturnToolArguments, logSystemPropertiesAndBasedir, warnAboutIncorrectPluginConfiguration
public static final Pattern SCHEMAGEN_EMITTED_FILENAME
Pattern matching the names of files emitted by the JAXB/JDK SchemaGenerator. According to the JAXB Schema Generator documentation:
There is no way to control the name of the generated schema files at this time.
public static final JavaDocRenderer STANDARD_JAVADOC_RENDERER
The default JavaDocRenderer used unless another JavaDocRenderer should be used.
javaDocRenderer
public static final List<Filter<File>> STANDARD_BYTECODE_EXCLUDE_FILTERS
testSourceExcludeSuffixes
parameter.public static final List<Filter<File>> CLASS_INCLUDE_FILTERS
public static final List<String> SYSTEM_TOOLS_CLASSLOADER_PACKAGES
tools.jar
archive, in particular its exception types used to signal JAXB annotation Exceptions.ToolProvider.getSystemToolClassLoader()
@Parameter(defaultValue="true") protected boolean generateEpisode
Corresponding SchemaGen parameter: episode
.
Generate an episode file from this XSD generation, so that other schemas that rely on this schema can be compiled later and rely on classes that are generated from this compilation. The generated episode file is really just a JAXB customization file (but with vendor extensions.)
If this parameter is true
, the episode file generated is called META-INF/sun-jaxb.episode
,
and included in the artifact.
AbstractJaxbMojo.STANDARD_EPISODE_FILENAME
@Parameter(defaultValue="true") protected boolean createJavaDocAnnotations
If true
, Elements or Attributes in the generated XSD files will be annotated with any
JavaDoc found for their respective properties. If false
, no XML documentation annotations will be
generated in post-processing any results from the JAXB SchemaGenerator.
@Parameter protected JavaDocRenderer javaDocRenderer
A renderer used to create XML annotation text from JavaDoc comments found within the source code. Unless another implementation is provided, the standard JavaDocRenderer used is DefaultJavaDocRenderer.
DefaultJavaDocRenderer
@Parameter(defaultValue="true") protected boolean clearOutputDir
Removes all files from the output directory before running SchemaGenerator.
protected boolean shouldExecutionBeSkipped()
XSD schema files are not generated from POM projects or if no includes have been supplied.
Implement this method to check if this AbstractJaxbMojo should skip executing altogether.shouldExecutionBeSkipped
in class AbstractJaxbMojo
true
to indicate that this AbstractJaxbMojo should bail out of its execute method.protected boolean isReGenerationRequired()
isReGenerationRequired
in class AbstractJaxbMojo
true
to indicate that this AbstractJaxbMojo should be run since its generated files were
either stale or not present, and false
otherwise.protected boolean performExecution() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Implement this method to perform this Mojo's execution.
This method will only be called if !shouldExecutionBeSkipped() && isReGenerationRequired()
.
performExecution
in class AbstractJaxbMojo
true
if the timestamp of the stale file should be updated.org.apache.maven.plugin.MojoExecutionException
- if an unexpected problem occurs.
Throwing this exception causes a "BUILD ERROR" message to be displayed.org.apache.maven.plugin.MojoFailureException
- if an expected problem (such as a compilation failure) occurs.
Throwing this exception causes a "BUILD FAILURE" message to be displayed.protected abstract File getWorkDirectory()
protected abstract List<URL> getCompiledClassNames()
protected abstract List<URL> getSources()
getSources
in class AbstractJaxbMojo
Copyright © 2005–2015 MojoHaus. All rights reserved.