Coder Social home page Coder Social logo

isabella232 / xsd2java-gradle-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qaware/xsd2java-gradle-plugin

0.0 0.0 0.0 147 KB

The XSD2Java Gradle Plugin generates java classes from an existing XSD schema.

License: Other

Groovy 100.00%

xsd2java-gradle-plugin's Introduction

Apache License 2

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:

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'de.qaware.gradle.plugin:xsd2java-gradle-plugin:2.1.0'
    }
}

apply plugin: 'de.qaware.gradle.plugin.xsd2java'

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
    id 'de.qaware.gradle.plugin.xsd2java' version '2.1.0'
}

Tasks

The 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<Xsd2JavaTaskConfig> - 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<String> - 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:

plugins {
    id 'de.qaware.gradle.plugin.xsd2java' version '2.1.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:

plugins {
    id("de.qaware.gradle.plugin.xsd2java") version "2.1.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.

xsd2java-gradle-plugin's People

Contributors

chr-fritz avatar johnpooley avatar lreimer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.