jaxb2-maven-plugin

http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html

jaxb2:xjc

Full name:

org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc

Description:

Generates Java sources from XML Schema(s) and binding file(s) using the JAXB Binding Compiler (XJC).

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: runtime.
  • Binds by default to the lifecycle phase: generate-sources.

Required Parameters

Name Type Since Description
outputDirectory File - The working directory where the generated Java source files are created.
Default value is: ${project.build.directory}/generated-sources/jaxb.
schemaDirectory File - The directory for XML Schema files (XSDs).
Default value is: ${project.basedir}/src/main/xsd.
staleFile File - The location of the flag file used to determine if the output is stale.
Default value is: ${project.build.directory}/jaxb2/.xjcStaleFlag.

Optional Parameters

Name Type Since Description
arguments String - Space separated string of extra arguments, for instance -Xfluent-api -episode somefile; These will be passed on to XJC as"-Xfluent-api" "-episode" "somefile" options.
bindingDirectory File - The directory for JAXB binding files.
Default value is: ${project.basedir}/src/main/xjb.
bindingFiles String - List of files to use for bindings, comma delimited. If none, then all xjb files are used in the bindingDirectory.
catalog File - Catalog file to resolve external entity references. Supports TR9401, XCatalog, and OASIS XML Catalog format.
clearOutputDir boolean - Clears the output directory on each run. Defaults to 'true' but if false, will not clear the directory.
Default value is: true.
dtd boolean - Treat input schemas as XML DTD (experimental, unsupported).
Default value is: false.
enableIntrospection boolean 1.4 Enable correct generation of Boolean getters/setters to enable Bean Introspection apis.
Default value is: false.
encoding String - The character encoding for the generated Java source files.
Default value is: ${project.build.sourceEncoding}.
explicitAnnotation boolean - Allow generation of explicit annotations that are needed for JAXB2 to work on RetroTranslator.
Default value is: false.
extension boolean - Allow to use the JAXB Vendor Extensions.
Default value is: false.
failOnNoSchemas boolean 1.3 Fails the mojo if no schemas are found.
Default value is: true.
generatedResourcesDirectory File - The optional directory where generated resources can be placed, generated by addons/plugins.
httpproxy String - Set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost[:proxyPort]
includeSchemasOutputPath String - The output path to include in your jar/war/etc if you wish to include your schemas in your artifact.
npa boolean - Suppress generation of package level annotations (package-info.java).
Default value is: false.
nv boolean - Do not perform strict validation of the input schema(s).
Default value is: false.
packageName String - The package under which the source files will be generated.
quiet boolean - Suppress compiler output.
Default value is: false.
readOnly boolean - Deprecated. Not suitable for a Maven build.
Default value is: false.
relaxng boolean - Treat input schemas as RELAX NG (experimental, unsupported).
Default value is: false.
relaxngCompact boolean - Treat input as RELAX NG compact syntax (experimental, unsupported).
Default value is: false.
schemaFiles String - List of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory. This parameter also accepts Ant-style file patterns.
Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).
schemaListFileName String - A filename containing the list of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory.
Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).
target String 1.3 Specifies the runtime environment in which the generated code is supposed to run, if older than the JAXB version used by the plugin (for example "2.0"). This will create generated code that doesn't use any newer JAXB features. Thus, allowing the generated code to run with an earlier JAXB 2.x runtime.
verbose boolean - Be extra verbose.
Default value is: false.
wsdl boolean - Treat input as WSDL and compile schemas inside it (experimental, unsupported).
Default value is: false.
xmlschema boolean - Treat input as W3C XML Schema (default).
Default value is: true.

Parameter Details

arguments:

Space separated string of extra arguments, for instance -Xfluent-api -episode somefile; These will be passed on to XJC as "-Xfluent-api" "-episode" "somefile" options.
  • Type: java.lang.String
  • Required: No
  • Expression: ${xjc.arguments}

bindingDirectory:

The directory for JAXB binding files.
  • Type: java.io.File
  • Required: No
  • Default: ${project.basedir}/src/main/xjb

bindingFiles:

List of files to use for bindings, comma delimited. If none, then all xjb files are used in the bindingDirectory.
  • Type: java.lang.String
  • Required: No

catalog:

Catalog file to resolve external entity references. Supports TR9401, XCatalog, and OASIS XML Catalog format.
  • Type: java.io.File
  • Required: No

clearOutputDir:

Clears the output directory on each run. Defaults to 'true' but if false, will not clear the directory.
  • Type: boolean
  • Required: No
  • Default: true

dtd:

Treat input schemas as XML DTD (experimental, unsupported).
  • Type: boolean
  • Required: No
  • Default: false

enableIntrospection:

Enable correct generation of Boolean getters/setters to enable Bean Introspection apis.
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Default: false

encoding:

The character encoding for the generated Java source files.
  • Type: java.lang.String
  • Required: No
  • Default: ${project.build.sourceEncoding}

explicitAnnotation:

Allow generation of explicit annotations that are needed for JAXB2 to work on RetroTranslator.
  • Type: boolean
  • Required: No
  • Default: false

extension:

Allow to use the JAXB Vendor Extensions.
  • Type: boolean
  • Required: No
  • Default: false

failOnNoSchemas:

Fails the mojo if no schemas are found.
  • Type: boolean
  • Since: 1.3
  • Required: No
  • Default: true

generatedResourcesDirectory:

The optional directory where generated resources can be placed, generated by addons/plugins.
  • Type: java.io.File
  • Required: No

httpproxy:

Set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost[:proxyPort]
  • Type: java.lang.String
  • Required: No

includeSchemasOutputPath:

The output path to include in your jar/war/etc if you wish to include your schemas in your artifact.
  • Type: java.lang.String
  • Required: No

npa:

Suppress generation of package level annotations (package-info.java).
  • Type: boolean
  • Required: No
  • Default: false

nv:

Do not perform strict validation of the input schema(s).
  • Type: boolean
  • Required: No
  • Default: false

outputDirectory:

The working directory where the generated Java source files are created.
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.directory}/generated-sources/jaxb

packageName:

The package under which the source files will be generated.
  • Type: java.lang.String
  • Required: No

quiet:

Suppress compiler output.
  • Type: boolean
  • Required: No
  • Default: false

readOnly:

Deprecated. Not suitable for a Maven build.
Generated files will be in read-only mode.
  • Type: boolean
  • Required: No
  • Default: false

relaxng:

Treat input schemas as RELAX NG (experimental, unsupported).
  • Type: boolean
  • Required: No
  • Default: false

relaxngCompact:

Treat input as RELAX NG compact syntax (experimental, unsupported).
  • Type: boolean
  • Required: No
  • Default: false

schemaDirectory:

The directory for XML Schema files (XSDs).
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.basedir}/src/main/xsd

schemaFiles:

List of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory. This parameter also accepts Ant-style file patterns.
Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).
  • Type: java.lang.String
  • Required: No

schemaListFileName:

A filename containing the list of files to use for schemas, comma delimited. If none, then all xsd files are used in the schemaDirectory.
Note: you can only use either the 'schemaFiles' or the 'schemaListFileName' option (you may not use both at once!).
  • Type: java.lang.String
  • Required: No

staleFile:

The location of the flag file used to determine if the output is stale.
  • Type: java.io.File
  • Required: Yes
  • Default: ${project.build.directory}/jaxb2/.xjcStaleFlag

target:

Specifies the runtime environment in which the generated code is supposed to run, if older than the JAXB version used by the plugin (for example "2.0"). This will create generated code that doesn't use any newer JAXB features. Thus, allowing the generated code to run with an earlier JAXB 2.x runtime.
  • Type: java.lang.String
  • Since: 1.3
  • Required: No

verbose:

Be extra verbose.
  • Type: boolean
  • Required: No
  • Expression: ${xjc.verbose}
  • Default: false

wsdl:

Treat input as WSDL and compile schemas inside it (experimental, unsupported).
  • Type: boolean
  • Required: No
  • Default: false

xmlschema:

Treat input as W3C XML Schema (default).
  • Type: boolean
  • Required: No
  • Default: true

=============================example


    org.codehaus.mojo
    jaxb2-maven-plugin
    1.3.1
    
     
      schema1-xjc
      
       xjc
      

      
       Transaction.xsd
       com.xxx.domain
       ${project.build.directory}/jaxb2/.schema1XjcStaleFlag
      

     

     
      schema2-xjc
      
       xjc
      

      
       STModels.xsd
       com.xxx.st.domain
       ${project.build.directory}/jaxb2/.schema2XjcStaleFlag
       false
      

     

    

   

你可能感兴趣的:(Maven,jaxb,annotations,generation,input,schema,binding)