This page shows plugin basic usage and support.
Plugin requires to work one of these plugins: java
, java library
, Android application
or Android library
.
These plugins can be applied directly or indirectly.
Additionally, plugin is compatible with org.freefair.lombok
.
One should follow an official Gradle guide to apply the plugin.
Examples are provided in a table below to showcase org.jsonschema2dataclass
plugin minimal configuration.
This way, extension jsonSchema2Pojo
will be configured with an execution example
in the executions
container.
More detailed usage is documented in parameters section.
DSL language | DSL example |
---|---|
Groovy |
plugins {
id "java"
id "org.jsonschema2dataclass" version "x.y.z"
}
jsonSchema2Pojo {
executions {
example {}
}
} |
Kotlin |
plugins {
java
id("org.jsonschema2dataclass") version "x.y.z"
}
jsonSchema2Pojo {
executions {
create("example") {
}
}
} |
In some cases it is required to specify dependencies for a processor to reference some JSON files via classpath or define plugin classes for a processor.
To achieve this, it is required to add these dependencies to jsonschema2dataclassPlugins
configuration.
Note
|
It’s impossible to add a dependency from an output from an execution. |
By default, plugin generates tasks to be run after process resources task, so the output from this task can be used.
Additionally, plugin tasks are configured to run before execution of compilation
and lombok (from org.freefair.lombok
) processor.
SDK/Tool | Minimal Version | Maximum version | Notes |
---|---|---|---|
Java compiler |
8 |
19 |
|
Gradle |
6.0 |
7.x |
8.0 support is currently in beta. |
Android Gradle Plugin |
3 |
7 |
Project contains various minimal org.jsonschema2dataclass
plugin usage demos.
These minimal applications doesn’t represent a normal full-featured applications for a given platform.
These application are included for a showcase plugin features and capabilities.
Note
|
Any additional ideas and contributions are welcome. |
Platform | Demo | Status | Notes |
---|---|---|---|
JVM |
Groovy DSL example |
Maintained and healthy |
Demonstrates compatibility with Groovy DSL |
Kotlin DSL example |
Maintained and healthy |
Demonstrates compatibility with Kotlin DSL and Kotlin language |
|
Model publishing example |
Maintained and healthy |
Demonstrates a way to publish jars with sources and schemas along with classes |
|
Plugin’s processor classpath examples |
Maintained and healthy |
Demonstrates usage for plugin’s processor classpath manipulation to apply schemas and custom RuleFactory |
|
Android |
AGP 7 example |
Maintained and healthy |
Demonstrates usage in an android application |
AGP 4 |
|