Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qaware/xsd2java-gradle-plugin
The XSD2Java Gradle Plugin generates java classes from an existing XSD schema.
https://github.com/qaware/xsd2java-gradle-plugin
gradle gradle-plugin hacktoberfest kotlin-dsl xsd2java
Last synced: 3 months ago
JSON representation
The XSD2Java Gradle Plugin generates java classes from an existing XSD schema.
- Host: GitHub
- URL: https://github.com/qaware/xsd2java-gradle-plugin
- Owner: qaware
- License: other
- Created: 2018-03-22T13:45:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-24T09:19:13.000Z (almost 2 years ago)
- Last Synced: 2023-08-12T15:51:05.524Z (over 1 year ago)
- Topics: gradle, gradle-plugin, hacktoberfest, kotlin-dsl, xsd2java
- Language: Groovy
- Homepage:
- Size: 210 KB
- Stars: 8
- Watchers: 6
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Apache License 2](http://img.shields.io/badge/license-ASF2-blue.svg)](https://github.com/qaware/xsd2java-gradle-plugin/blob/master/LICENSE)
# XSD2Java Gradle Plugin
The XSD2Java Gradle Plugin generates java classes from an existing XSD schema. For this it uses the existing ANT task.
## Usage
Build script snippet for use in all Gradle versions:
```groovy
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'de.qaware.gradle.plugin:xsd2java-gradle-plugin:3.0.0'
}
}apply plugin: 'de.qaware.gradle.plugin.xsd2java'
```Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:
```groovy
plugins {
id 'de.qaware.gradle.plugin.xsd2java' version '3.0.0'
}
```
## TasksThe plugin defines the following tasks:
Task name | Depends on | Type | Description
--------- | ---------- | ---- | ---
`xsd2java`| - | `XSD2JavaTask` | Generates all the types as java classes from a xsd schema.## Configurations
The plugin defines the following configurations:
Configuration Name | Description
------------------- | ---
`xsd2java` | Used for dependencies that needed by the generated sources.
`xsd2javaExtension` | Used for extensions for the XJC ANT task.## Extension Properties
The plugin defines the following extension properties in the `xsd2java` closure:
Property name | Type | Default value | Description
------------- | ------ | - | ---
`schemas` | `Container` | - | Contains the configurations for every base directory with schemas.
`extension` | `Boolean` | - | Should the ant task load extensions defined in the configuration `xsd2javaExtension`. Default false
`arguments` | `List` | - | A list of arguments passed to the ant task
`outputDir` | `File` | - | The output directory for the generated sources.### Example
The following example show the full extension configuration:
```groovy
plugins {
id 'de.qaware.gradle.plugin.xsd2java' version '3.0.0'
}xsd2java {
schemas {
dummy {
schemaDirPath 'src/main/resources/xsd'
packageName 'de.qaware.gradle.plugin.xsd2java.dummy.xsd'
}
}
extension true
arguments ['-verbose']
outputDir "${project.buildDir}/generated-sources/xsd2java"
}
```In case you are using the Kotlin DSL for you build script, the above example looks as follows:
```kotlin
plugins {
id("de.qaware.gradle.plugin.xsd2java") version "3.0.0"
}xsd2java {
schemas {
create("dummy") {
schemaDirPath = file("src/main/resources/xsd").toPath()
packageName = "de.qaware.gradle.plugin.xsd2java.dummy.xsd"
}
}
extension = true
arguments = listOf("-verbose")
outputDir = file("${project.buildDir}/generated-sources/xsd2java")
}
```## Maintainer
- Christian Fritz (@chrfritz)
- Mario-Leander Reimer (@lreimer)## License
This software is provided under the Apache License, Version 2.0 license. See the `LICENSE` file for details.