Skip to content

Controlling the Output

highsource edited this page Dec 12, 2014 · 4 revisions

Controlling the output

  • generateDirectory - Target directory for the generated code, target/generated-sources/xjc by default.
  • generatePackage - 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.
  • writeCode - If false, the plugin will not write the generated code to disk, true by default.
  • readOnly - If true, the generated Java source files are set as read-only (XJC's -readOnly option). Default is false.
  • packageLevelAnnotations - If false, suppresses generation of package level annotations (package-info.java). Default is true. Since 0.9.0.
  • noFileHeader - If true, suppresses generation of a file header with timestamp. Default is false. Since 0.9.0.
  • enableIntrospection - If true, enables correct generation of Boolean getters/setters to enable Bean Introspection apis. Since 0.9.0.
  • removeOldOutput - If true, the generateDirectory will be deleted before the XJC binding compiler recompiles the source files. Default is false.
  • cleanPackageDirectories - If true (default), package directories will be cleaned before the XJC binding compiler generates the source files.
  • markGenerated - If true, marks generated classes using a @Generated annotation - i.e. turns on XJC -mark-generated option. Default is false.
  • encoding - Encoding for the generated sources, defaults to ${project.build.sourceEncoding}.
  • locale - Locale used during generation, for instance en, de, fr etc. This will, for instance, influence the language of the generated JavaDoc comments.

Adding target directory as Maven source directory

By default, target directory (target/generated-sources/xjc) will be added as a compile source root. If your project also generates the episode file, it will be added as a project resource.

In some cases you may need to generate test sources instead of main sources. So you'll need to add target directory as a test compile source root. Or you may need to override or avoid automatic source root addition for some other reason. You can accomplish this using the following configuration options:

  • addCompileSourceRoot - If set to true (default), adds target directory as a compile source root of this Maven project.
  • addTestCompileSourceRoot - If set to true, adds target directory as a test compile source root of this Maven project. Default value is false.
Clone this wiki locally