|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
org.jvnet.jaxb2.maven2.XJC2Mojo
public class XJC2Mojo
JAXB 2.x Mojo.
Nested Class Summary | |
---|---|
protected class |
XJC2Mojo.JaxbErrorReceiver4Mvn
|
Field Summary | |
---|---|
protected java.util.List |
bindingFiles
For checking timestamps. |
protected java.util.List |
schemaFiles
For checking timestamps. |
Fields inherited from interface org.apache.maven.plugin.Mojo |
---|
ROLE |
Constructor Summary | |
---|---|
XJC2Mojo()
|
Method Summary | |
---|---|
protected void |
configureCatalogResolver(com.sun.tools.xjc.Options options)
|
void |
execute()
Execute the maven2 mojo to invoke the xjc2 compiler based on any configuration settings. |
protected long |
findLastModified(java.util.List files,
boolean oldest)
|
protected void |
gatherDependsFiles(java.util.List inputFiles)
|
protected java.util.List |
gatherFiles(java.io.File baseDir,
java.lang.String[] includesPattern,
java.lang.String[] excludesPattern)
|
protected void |
gatherProducesFiles(java.util.List destFiles)
|
static java.lang.String |
getAllExMsgs(java.lang.Throwable ex,
boolean includeExName)
|
static java.lang.String |
getAllExStackTraces(java.lang.Throwable ex)
|
java.util.List<java.lang.String> |
getArgs()
A list of extra XJC's command-line arguments (items must include the dash '-'). |
org.apache.maven.artifact.factory.ArtifactFactory |
getArtifactFactory()
Used internally to resolve plugins to their jar files. |
protected java.util.Collection<java.io.File> |
getArtifactFiles(Artifact[] artifacts,
boolean resolveDependencies)
|
org.apache.maven.artifact.resolver.ArtifactResolver |
getArtifactResolver()
|
java.io.File |
getBindingDirectory()
The source directory containing the *.xjb binding files. |
java.lang.String[] |
getBindingExcludes()
A list of regular expression file search patterns to specify the binding files to be excluded from the bindingIncludes . |
java.lang.String[] |
getBindingIncludes()
A list of regular expression file search patterns to specify the binding files to be processed. |
java.io.File |
getCatalog()
Specify the catalog file to resolve external entity references (xjc's -catalog option) |
java.lang.String |
getCatalogResolver()
Provides the class name of the catalog resolver. |
java.util.List |
getClasspathElements()
Project classpath. |
boolean |
getDebug()
If 'true', the XJC compiler is set to debug mode (xjc's -debug option)and the 'com.sun.tools.xjc.Options.findServices' property is set, to print any add-on instanciation messages. |
boolean |
getDisableDefaultExcludes()
If 'true', maven's default exludes are NOT added to all the excludes lists. |
boolean |
getEpisode()
|
java.io.File |
getEpisodeFile()
|
java.util.Collection<java.io.File> |
getEpisodeFiles()
|
Artifact[] |
getEpisodes()
|
protected java.util.List |
getExcludes(java.util.List origExcludes)
Modifies input list by adding plexus tools default excludes. |
protected java.lang.String[] |
getExcludes(java.lang.String[] origExcludes)
|
boolean |
getExtension()
If 'true', the XJC binding compiler will run in the extension mode (xjc's -extension option). |
boolean |
getForceRegenerate()
If 'true', no up-to-date check is performed and the XJC always re-generates the sources. |
java.io.File |
getGenerateDirectory()
Generated code will be written under this directory. |
java.lang.String |
getGeneratePackage()
The generated classes will all be placed under this Java package (xjc's -p option), unless otherwise specified in the schemas. |
protected static org.xml.sax.InputSource |
getInputSource(java.io.File f)
Converts a File object to an InputSource. |
org.apache.maven.artifact.repository.ArtifactRepository |
getLocalRepository()
|
org.apache.maven.project.MavenProjectBuilder |
getMavenProjectBuilder()
Artifact factory, needed to download source jars. |
java.lang.String[] |
getOtherDepends()
A list of of input files or URLs to consider during the up-to-date. |
Artifact[] |
getPlugins()
XJC plugins to be made available to XJC. |
java.util.Collection<java.net.URL> |
getPluginURLs()
|
org.apache.maven.project.MavenProject |
getProject()
|
boolean |
getReadOnly()
If 'true', the generated Java source files are set as read-only (xjc's -readOnly option). |
boolean |
getRemoveOldOutput()
If 'true', the [generateDirectory] dir will be deleted before the XJC binding compiler recompiles the source files. |
java.io.File |
getSchemaDirectory()
The source directory containing *.xsd schema files. |
java.lang.String[] |
getSchemaExcludes()
A list of regular expression file search patterns to specify the schemas to be excluded from the schemaIncludes list. |
java.lang.String[] |
getSchemaIncludes()
A list of regular expression file search patterns to specify the schemas to be processed. |
java.lang.String |
getSchemaLanguage()
Type of input schema language. |
boolean |
getStrict()
If 'true', Perform strict validation of the input schema (xjc's -nv option). |
boolean |
getVerbose()
If 'true', the plugin and the XJC compiler are both set to verbose mode (xjc's -verbose option). |
protected java.lang.String |
getVersionFromDependencies(Artifact artifact,
java.util.Set<org.apache.maven.artifact.Artifact> dependencies)
Returns the version of the artifact as inherited from the dependencies. |
boolean |
getWriteCode()
If 'false', the plugin will not write the generated code to disk. |
protected static boolean |
isDefined(java.lang.Object setting,
int minimumLength)
A generic setting validator. |
protected boolean |
isUpdToDate()
|
protected void |
logCalcSettings(java.lang.StringBuffer sb)
Logs options calculated by mojo parameters. |
protected void |
logSettings()
Log the configuration settings. |
protected void |
logUserSettings(java.lang.StringBuffer sb)
Logs options defined directly as mojo parameters. |
protected static java.lang.String |
recursiveToString(java.lang.Object setting)
A generic approach to turning the values inside arrays and collections into toString values. |
protected java.util.Set<org.apache.maven.artifact.Artifact> |
resolveArtifactDependencies(org.apache.maven.artifact.Artifact artifact)
This method resolves all transitive dependencies of an artifact. |
protected java.util.Set<org.apache.maven.artifact.Artifact> |
resolveDependencyArtifacts(org.apache.maven.project.MavenProject theProject)
This method resolves the dependency artifacts from the project. |
protected void |
runXJC(com.sun.tools.xjc.Options xjcOpts)
|
void |
setArgs(java.util.List<java.lang.String> args)
|
void |
setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
|
void |
setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)
|
void |
setBindingDirectory(java.io.File bindingDirectory)
|
void |
setBindingExcludes(java.lang.String[] bindingExcludes)
|
void |
setBindingIncludes(java.lang.String[] bindingIncludes)
|
void |
setCatalog(java.io.File catalog)
|
void |
setCatalogResolver(java.lang.String catalogResolver)
|
void |
setClasspathElements(java.util.List classpathElements)
|
void |
setDebug(boolean debug)
|
void |
setDisableDefaultExcludes(boolean disableDefaultExcludes)
|
void |
setEpisode(boolean episode)
|
void |
setEpisodeFile(java.io.File episodeFile)
|
void |
setEpisodes(Artifact[] episodes)
|
void |
setExtension(boolean extension)
|
void |
setForceRegenerate(boolean forceRegenerate)
|
void |
setGenerateDirectory(java.io.File generateDirectory)
|
void |
setGeneratePackage(java.lang.String generatePackage)
|
void |
setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
|
void |
setMavenProjectBuilder(org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder)
|
void |
setOtherDepends(java.lang.String[] otherDepends)
|
void |
setPlugins(Artifact[] plugins)
|
void |
setProject(org.apache.maven.project.MavenProject project)
|
void |
setReadOnly(boolean readOnly)
|
void |
setRemoveOldOutput(boolean removeOldOutput)
|
void |
setSchemaDirectory(java.io.File schemaDirectory)
|
void |
setSchemaExcludes(java.lang.String[] schemaExcludes)
|
void |
setSchemaIncludes(java.lang.String[] schemaIncludes)
|
void |
setSchemaLanguage(java.lang.String schemaLanguage)
|
void |
setStrict(boolean strict)
|
protected void |
setupCmdLineArgs(com.sun.tools.xjc.Options xjcOpts)
|
protected void |
setupLogging()
Sets up the verbose and debug mode depending on mvn logging level, and sets up hyperjaxb logging. |
protected com.sun.tools.xjc.Options |
setupOptions()
Ensure the any default settings are met and throws exceptions when settings are invalid and also stores the schemas and the bindings files into member vars for calculating timestamps, later. |
void |
setVerbose(boolean verbose)
|
void |
setWriteCode(boolean writeCode)
|
protected void |
updateMavenPaths()
Updates compilePath ans resources. |
Methods inherited from class org.apache.maven.plugin.AbstractMojo |
---|
getLog, getPluginContext, setLog, setPluginContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.List schemaFiles
protected java.util.List bindingFiles
Constructor Detail |
---|
public XJC2Mojo()
Method Detail |
---|
protected java.lang.String getVersionFromDependencies(Artifact artifact, java.util.Set<org.apache.maven.artifact.Artifact> dependencies)
artifact
- the artifact for which to return the version.dependencies
- the list of dependencies in which to search for the version.
null
if
dependencies
is either null
or does not contain
the artifact's version.public org.apache.maven.artifact.resolver.ArtifactResolver getArtifactResolver()
public void setArtifactResolver(org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver)
public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
plugins
to their jar files.
public void setArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
public org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()
public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
public org.apache.maven.project.MavenProjectBuilder getMavenProjectBuilder()
public void setMavenProjectBuilder(org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder)
public java.lang.String getSchemaLanguage()
public void setSchemaLanguage(java.lang.String schemaLanguage)
public java.io.File getSchemaDirectory()
public void setSchemaDirectory(java.io.File schemaDirectory)
public java.lang.String[] getSchemaIncludes()
A list of regular expression file search patterns to specify the schemas
to be processed. Searching is based from the root of
schemaDirectory
.
If left udefined, then all *.xsd files in schemaDirectory will be processed.
public void setSchemaIncludes(java.lang.String[] schemaIncludes)
public java.lang.String[] getSchemaExcludes()
schemaIncludes
list. Searching is
based from the root of schemaDirectory.
public void setSchemaExcludes(java.lang.String[] schemaExcludes)
public void setBindingDirectory(java.io.File bindingDirectory)
public java.io.File getBindingDirectory()
The source directory containing the *.xjb binding files.
If left undefined, then the schemaDirectory
is assumed.
public java.lang.String[] getBindingIncludes()
A list of regular expression file search patterns to specify the binding
files to be processed. Searching is based from the root of
bindingDirectory
.
If left undefined, then all *.xjb files in schemaDirectory will be processed.
public void setBindingIncludes(java.lang.String[] bindingIncludes)
public java.lang.String[] getBindingExcludes()
bindingIncludes
. Searching
is based from the root of bindingDirectory.
public void setBindingExcludes(java.lang.String[] bindingExcludes)
public boolean getDisableDefaultExcludes()
public void setDisableDefaultExcludes(boolean disableDefaultExcludes)
public java.io.File getCatalog()
Support TR9401, XCatalog, and OASIS XML Catalog format. See the catalog-resolver sample and this article for details.
public void setCatalog(java.io.File catalog)
public java.lang.String getCatalogResolver()
public void setCatalogResolver(java.lang.String catalogResolver)
public java.lang.String getGeneratePackage()
The generated classes will all be placed under this Java package (xjc's -p option), unless otherwise specified in the schemas.
If left unspecified, the package will be derived from the schemas only.
public void setGeneratePackage(java.lang.String generatePackage)
public java.io.File getGenerateDirectory()
Generated code will be written under this directory.
For instance, if you specify generateDirectory="doe/ray"
and generatePackage="org.here"
, then files are generated
to doe/ray/org/here
.
public void setGenerateDirectory(java.io.File generateDirectory)
public boolean getReadOnly()
public void setReadOnly(boolean readOnly)
public boolean getExtension()
public void setExtension(boolean extension)
public boolean getStrict()
public void setStrict(boolean strict)
public boolean getWriteCode()
public void setWriteCode(boolean writeCode)
public boolean getVerbose()
If 'true', the plugin and the XJC compiler are both set to verbose mode (xjc's -verbose option).
It is automatically set to 'true' when maven is run in debug mode (mvn's -X option).
public void setVerbose(boolean verbose)
public boolean getDebug()
If 'true', the XJC compiler is set to debug mode (xjc's -debug option)and the 'com.sun.tools.xjc.Options.findServices' property is set, to print any add-on instanciation messages.
It is automatically set to 'true' when maven is run in debug mode (mvn's -X option).
public void setDebug(boolean debug)
public java.util.List<java.lang.String> getArgs()
A list of extra XJC's command-line arguments (items must include the dash '-').
Arguments set here take precedence over other mojo parameters.
public void setArgs(java.util.List<java.lang.String> args)
public boolean getForceRegenerate()
public void setForceRegenerate(boolean forceRegenerate)
public boolean getRemoveOldOutput()
If 'true', the [generateDirectory] dir will be deleted before the XJC binding compiler recompiles the source files.
Note that if set to 'false', the up-to-date check might not work, since XJC does not regenerate all files (i.e. files for "any" elements under 'xjc/org/w3/_2001/xmlschema' directory).
public void setRemoveOldOutput(boolean removeOldOutput)
public java.lang.String[] getOtherDepends()
public void setOtherDepends(java.lang.String[] otherDepends)
public java.io.File getEpisodeFile()
public void setEpisodeFile(java.io.File episodeFile)
public boolean getEpisode()
public void setEpisode(boolean episode)
public java.util.List getClasspathElements()
public void setClasspathElements(java.util.List classpathElements)
public org.apache.maven.project.MavenProject getProject()
public void setProject(org.apache.maven.project.MavenProject project)
public Artifact[] getPlugins()
public void setPlugins(Artifact[] plugins)
public Artifact[] getEpisodes()
public void setEpisodes(Artifact[] episodes)
public void execute() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected com.sun.tools.xjc.Options setupOptions() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void configureCatalogResolver(com.sun.tools.xjc.Options options) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void setupCmdLineArgs(com.sun.tools.xjc.Options xjcOpts) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void setupLogging()
protected void logSettings()
protected void logUserSettings(java.lang.StringBuffer sb)
protected void logCalcSettings(java.lang.StringBuffer sb)
protected boolean isUpdToDate() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void gatherDependsFiles(java.util.List inputFiles)
protected void gatherProducesFiles(java.util.List destFiles) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void runXJC(com.sun.tools.xjc.Options xjcOpts) throws org.apache.maven.plugin.MojoExecutionException
xjcOpts
-
org.apache.maven.plugin.MojoExecutionException
protected void updateMavenPaths()
org.apache.maven.plugin.MojoExecutionException
protected long findLastModified(java.util.List files, boolean oldest)
files
- the fileNames or URLs to scan their lastModified timestamp.oldest
- if true, returns the latest modificationDate of all files,
otherwise returns the earliest.
protected static org.xml.sax.InputSource getInputSource(java.io.File f)
protected java.util.List gatherFiles(java.io.File baseDir, java.lang.String[] includesPattern, java.lang.String[] excludesPattern) throws org.apache.maven.plugin.MojoExecutionException
baseDir
- includesPattern
- excludesPattern
-
org.apache.maven.plugin.MojoExecutionException
protected java.lang.String[] getExcludes(java.lang.String[] origExcludes)
protected java.util.List getExcludes(java.util.List origExcludes)
origExcludes
- a list that must support the 'add' operation.
protected static boolean isDefined(java.lang.Object setting, int minimumLength)
setting
- the settings to validateminimumLength
- minimum length required.
protected static java.lang.String recursiveToString(java.lang.Object setting)
setting
-
public static java.lang.String getAllExMsgs(java.lang.Throwable ex, boolean includeExName)
public static java.lang.String getAllExStackTraces(java.lang.Throwable ex)
public java.util.Collection<java.net.URL> getPluginURLs() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public java.util.Collection<java.io.File> getEpisodeFiles() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected java.util.Collection<java.io.File> getArtifactFiles(Artifact[] artifacts, boolean resolveDependencies) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected java.util.Set<org.apache.maven.artifact.Artifact> resolveArtifactDependencies(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException, org.apache.maven.project.ProjectBuildingException, org.apache.maven.project.artifact.InvalidDependencyVersionException
artifact
- the artifact used to retrieve dependencies
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.ProjectBuildingException
org.apache.maven.project.artifact.InvalidDependencyVersionException
protected java.util.Set<org.apache.maven.artifact.Artifact> resolveDependencyArtifacts(org.apache.maven.project.MavenProject theProject) throws org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException, org.apache.maven.project.artifact.InvalidDependencyVersionException
theProject
- The POM.
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.artifact.InvalidDependencyVersionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |