jsonschema2pojo:generate

Full name:

com.googlecode.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.3.0:generate

Description:

When invoked, this goal reads one or more JSON Schema documents and generates DTO style Java classes for data binding.

See jsonschema2pojo.googlecode.com.

Attributes:

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

Required Parameters

Name Type Since Description
sourceDirectory File 0.1.0 Location of the JSON Schema file(s). Note: this may refer to a single file or a directory of files.

Optional Parameters

Name Type Since Description
addCompileSourceRoot boolean 0.1.9 Add the output directory to the project as a source root, so that the generated java types are compiled and included in the project artifact.
Default value is: true.
generateBuilders boolean 0.1.2 Whether to generate builder-style methods of the form withXxx(value) (that return this), alongside the standard, void-return setters.
Default value is: false.
outputDirectory File 0.1.0 Target directory for generated Java source files.
Default value is: ${project.build.directory}/java-gen.
propertyWordDelimiters String 0.2.2 The characters that should be considered as word delimiters when creating Java Bean property names from JSON property names. If blank or not set, JSON properties will be considered to contain a single word when creating Java Bean property names.
skip boolean 0.2.1 Skip plugin execution (don't read/validate any schema files, don't generate any java types).
Default value is: false.
targetPackage String 0.1.0 Package name used for generated Java classes (for types where a fully qualified name has not been supplied in the schema using the 'javaType' property).
useLongIntegers boolean 0.2.2 Whether to use the java type long (or Long) instead of int (or Integer) when representing the JSON Schema type 'integer'.
usePrimitives boolean 0.2.0 Whether to use primitives (long, double, boolean) instead of wrapper types where possible when generating bean properties (has the side-effect of making those properties non-null).
Default value is: false.

Parameter Details

addCompileSourceRoot:

Add the output directory to the project as a source root, so that the generated java types are compiled and included in the project artifact.
  • Type: boolean
  • Since: 0.1.9
  • Required: No
  • Expression: ${jsonschema2pojo.addCompileSourceRoot}
  • Default: true

generateBuilders:

Whether to generate builder-style methods of the form withXxx(value) (that return this), alongside the standard, void-return setters.
  • Type: boolean
  • Since: 0.1.2
  • Required: No
  • Expression: ${jsonschema2pojo.generateBuilders}
  • Default: false

outputDirectory:

Target directory for generated Java source files.
  • Type: java.io.File
  • Since: 0.1.0
  • Required: No
  • Expression: ${jsonschema2pojo.outputDirectory}
  • Default: ${project.build.directory}/java-gen

propertyWordDelimiters:

The characters that should be considered as word delimiters when creating Java Bean property names from JSON property names. If blank or not set, JSON properties will be considered to contain a single word when creating Java Bean property names.
  • Type: java.lang.String
  • Since: 0.2.2
  • Required: No

skip:

Skip plugin execution (don't read/validate any schema files, don't generate any java types).
  • Type: boolean
  • Since: 0.2.1
  • Required: No
  • Expression: ${jsonschema2pojo.skip}
  • Default: false

sourceDirectory:

Location of the JSON Schema file(s). Note: this may refer to a single file or a directory of files.
  • Type: java.io.File
  • Since: 0.1.0
  • Required: Yes
  • Expression: ${jsonschema2pojo.sourceDirectory}

targetPackage:

Package name used for generated Java classes (for types where a fully qualified name has not been supplied in the schema using the 'javaType' property).
  • Type: java.lang.String
  • Since: 0.1.0
  • Required: No
  • Expression: ${jsonschema2pojo.targetPackage}

useLongIntegers:

Whether to use the java type long (or Long) instead of int (or Integer) when representing the JSON Schema type 'integer'.
  • Type: boolean
  • Since: 0.2.2
  • Required: No

usePrimitives:

Whether to use primitives (long, double, boolean) instead of wrapper types where possible when generating bean properties (has the side-effect of making those properties non-null).
  • Type: boolean
  • Since: 0.2.0
  • Required: No
  • Expression: ${jsonschema2pojo.usePrimitives}
  • Default: false