在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):rackerlabs/gradle-jaxb-plugin开源软件地址(OpenSource Url):https://github.com/rackerlabs/gradle-jaxb-plugin开源编程语言(OpenSource Language):Groovy 100.0%开源软件介绍(OpenSource Introduction):gradle-jaxb-pluginThis plugin is an update to the original project this was forked from.
We acknowledge and are grateful to these developers for their contributions to open source.
You can find the source code of their original using the To prevent possible collisions and/or confusion if the original author decides to accept our PR’s or to simply begin anew, we have changed the id and package names. In compliance with the gradle plugin submission guidelines, the plugin’s id was changed from This Gradle plugin defines some conventions for XSD projects and provides some processing to ease some of the maintenance of these projects by:
Using The PluginSee this plugin’s page in the gradle plugins repo. Setting Up The JAXB ConfigurationsYou need the jaxb configuration to run the Any version of jaxb that you care to use will work. dependencies {
jaxb 'org.glassfish.jaxb:jaxb-xjc:2.2.11'
jaxb 'org.glassfish.jaxb:jaxb-runtime:2.2.11'
xjc 'com.example:xjc-plugin:0.0.0'
} Plugin TasksThere are only two tasks.
Plugin ConventionsThere are two conventions that can be overridden and one is nested in the other. The You can change these defaults with a closure in your build script. jaxb {
...
xjc {
...
}
} JAXB Plugin ConventionThese are the configurable parameters for the JAXB Plugin.
XJC ConventionThese are the configurable parameters for the JAXB Plugin’s XJC interactions.
For more in depth description please see the XJC Ant Task documentation. ExamplesDefault Example using JAXBIf the default conventions are used, then there is nothing to configure. Default Example using JAXB2Customized to use dependencies {
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1"
jaxb 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:1.11.1'
jaxb 'org.jvnet.jaxb2_commons:jaxb2-basics-annotate:1.0.4'
jaxb 'org.slf4j:slf4j-log4j12:1.7.25'
}
jaxb {
xsdDir = "${project.projectDir}/some/folder"
xjc {
generateEpisodeFiles = false
taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
generatePackage = "com.company.example"
args = ["-Xinheritance", "-Xannotate"]
}
} Defining The Plugin For All ProjectsCreate a convention for xsd projects to have a suffix of subprojects { project ->
if(project.name.endsWith("-schema")) {
apply plugin: 'org.openrepose.gradle.plugins.jaxb'
dependencies {
jaxb 'org.glassfish.jaxb:jaxb-xjc:2.2.11'
jaxb 'org.glassfish.jaxb:jaxb-runtime:2.2.11'
}
}
} applying the plugin to all schema projects. Another way to do this is by adding a boolean property to the subprojects { project ->
if(Boolean.valueOf(project.getProperties().getOrDefault('doJAXB', 'false'))) {
apply plugin: 'org.openrepose.gradle.plugins.jaxb'
dependencies {
jaxb 'org.glassfish.jaxb:jaxb-xjc:2.2.11'
jaxb 'org.glassfish.jaxb:jaxb-runtime:2.2.11'
}
}
} Other FeaturesDepend On Another ProjectThis lets gradle know that the xjc task of a project is dependent on the xjc task of another project. This can be achieved with: dependencies {
jaxb project(path: ':common', configuration: 'jaxb')
} This expresses that xsd’s definitely depend on other xsd’s outside of their parent folder This will run the xjc task on ExamplesYou can find some small example projects using this plugin in the examples folder.
Simply issue For a basic example of using this plugin with multiple sub-projects that have interactions, please see this test project. For a real world example of this plugin, please visit the main Repose project. ImprovementsIf you have an idea that would make something a little easier, we’d love to hear about it. If you think you can make this plugin better, then simply fork it like we did and submit a pull request. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论