{"id":25287543,"url":"https://github.com/gradleup/jaxb2","last_synced_at":"2025-10-27T22:30:16.714Z","repository":{"id":57724715,"uuid":"221903583","full_name":"GradleUp/jaxb2","owner":"GradleUp","description":"This plugin makes it easy to generate Java source code from XML schema files (.xsd). Internally the plugin relies on the JAXB2","archived":false,"fork":false,"pushed_at":"2024-09-04T19:29:55.000Z","size":141,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-06T02:25:13.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GradleUp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-15T10:45:40.000Z","updated_at":"2024-09-04T19:28:32.000Z","dependencies_parsed_at":"2024-09-06T02:34:58.348Z","dependency_job_id":null,"html_url":"https://github.com/GradleUp/jaxb2","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GradleUp%2Fjaxb2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GradleUp%2Fjaxb2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GradleUp%2Fjaxb2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GradleUp%2Fjaxb2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GradleUp","download_url":"https://codeload.github.com/GradleUp/jaxb2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238563620,"owners_count":19492974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-12T22:39:57.119Z","updated_at":"2025-10-27T22:30:16.218Z","avatar_url":"https://github.com/GradleUp.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](http://img.shields.io/badge/license-Apache%202.0-brightgreen.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)\n[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.github.gradlecommunity.jaxb2)](https://plugins.gradle.org/plugin/com.github.gradlecommunity.jaxb2)\n\n### JAXB2 plugin\nThis started as a fork from [ewerk/gradle-plugins/jaxb2](https://github.com/ewerk/gradle-plugins/).\n\n#### Description\n\nThis plugin makes it easy to generate Java source code from XML schema files (.xsd). Internally\nthe plugin relies on the JAXB2 ant task for generating the code. The examples below show how \nthe plugin can be used.\n\nAt the moment the plugin is simplistic and just supports creating Java code from XSD. JAXB2\nspecific special stuff like binding files or additional task parameters are currently not \nsupported but can surely make it into the plugin in future. \n\n#### Dependency management\nThe plugin creates a own 'jaxb2' configuration and adds it to the project. Then it adds all needed\ndependencies to execute the JAXB ant task. You may need to extend are change these dependencies.\nAs we have the `jaxb2` configuration, you can do this by using the default `dependencies {}` \nclosure of your project. This is shown in the examples below.\n\n#### Configuration\n\n##### taskName\nThe full qualified name of the JAXB2 ant task the does the real work. \nDefaults to `org.jvnet.jaxb2_commons.xjc.XJC2Task`. \nNormally there will be need to change this.\n\n##### xjc\nThis is the container for configuring the distinct generation steps. It can be repeated as needed\nwithin the `jaxb2` extension. The container structure is as follows:\n\n```groovy\nxjc {\n  'generation-step-name' {\n    // optional, defaults to src/generated/java\n    generatedSourcesDir = 'any/relative/path'\n    \n    // full qualified base package for the classes to be generated\n    basePackage = 'com.any.app'\n    \n    // relative path the XSD file to generate the code from\n    schema = 'src/main/xsd/any-file.xsd'\n    \n    // relative path to directory including binding files\n    // all files of pattern **/*.xjb will be included\n    // default to null (no binding files used)\n    // Optional, can be left away\n    bindingsDir = 'src/main/xsb'\n    \n    // comma separated list of binding file includes\n    // falls back to '**/*.xjb' if not specified\n    includedBindingFiles = 'any.xjb, subdir/test.xjb'\n    \n    additionalArgs = '-nv -dtd'\n\n    // output encoding of the generated files\n    encoding = 'UTF-8'\n  }\n}\n```\n\n#### Examples\n\n__Use via Gradle plugin portal__\n\nPlugin page, Groovy \u0026 Kotlin DSL:\nhttps://plugins.gradle.org/plugin/com.github.gradlecommunity.jaxb2\n\n```groovy\nplugins {\n  id 'com.github.gradlecommunity.jaxb2' version '3.1.0'\n}\n```\n\n__Full configuration example__\n\n```groovy\nplugins {\n  id 'com.github.gradlecommunity.jaxb2' version '3.1.0'\n}\n\nrepositories {\n  mavenCentral()\n}\n\n// the whole dependency container could be left out\ndependencies {\n  // default JAXB2 libs added by the plugin\n  jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.9.5'\n  jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.9.5'\n  jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics:0.9.5'\n\n  // default JAXB libs added by the plugin\n  jaxb2 'com.sun.xml.bind:jaxb-core:2.2.11'\n  jaxb2 'com.sun.xml.bind:jaxb-xjc:2.2.11'\n  jaxb2 'com.sun.xml.bind:jaxb-impl:2.2.11'\n  \n  // any custom libraries here\n  jaxb2 'com. …'\n}\n\njaxb2 {\n  xjc {\n    'request-classes' {\n      basePackage = 'com.any.app.model.request'\n      schema = 'src/main/xsd/request.xsd'\n      encoding = 'UTF-8'\n      extension = true \n    }\n  }\n\n  xjc {\n    'response-classes' {\n      basePackage = 'com.any.app.model.response'\n      schema = 'src/main/xsd/response.xsd'\n      bindings = 'src/main/xsb'\n    }\n  }\n}\n\n```\n\n__Minimal configuration example__\n```groovy\nplugins {\n  id 'com.github.gradlecommunity.jaxb2' version '3.1.0'\n}\n\nrepositories {\n  mavenCentral()\n}\n\njaxb2 {\n  xjc {\n    'request-classes' {\n      basePackage = 'com.any.app.model.request'\n      schema = 'src/main/xsd/request.xsd'\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgradleup%2Fjaxb2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgradleup%2Fjaxb2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgradleup%2Fjaxb2/lists"}