scubacabra / gradle-jaxb-plugin Goto Github PK
View Code? Open in Web Editor NEWGradle plugin to ease projects that use xsds and the ant jaxb task
License: GNU General Public License v2.0
Gradle plugin to ease projects that use xsds and the ant jaxb task
License: GNU General Public License v2.0
my project structure is like:
Root
|-Folder 1
|--subsubproject 1
In my build.gradle I set xsdDir to /src/resources/schema.
In runtime I got error as:
Could not normalize path for file Root\src\resources\schema.
Seems the the folder and subproject name are skipped.
One small xsd.
STS 3.7
--launcher.XXMaxPermSize
256M
Gradle 2.4 (external)
Errors happens once a while (since out of memory) as I have set the Gradle to Refresh at 5 seconds after change event.
> Failed to apply plugin [id 'com.github.jacobono.jaxb']
> com.google.inject.internal.util.$ComputationException: java.lang.OutOfMemoryError: PermGen space
buildscript {
repositories {
maven { url "https://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
//classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.10.RELEASE")
//####################### XJC - JDK 1.7/1.8 ####################
classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6'
//######################
}
}
//apply plugin: 'java'
//:apply plugin: 'eclipse'
apply plugin: 'com.github.jacobono.jaxb'
dependencies {
//####################### XJC - JDK 1.7/1.8 ####################
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7'
jaxb 'javax.xml.bind:jaxb-api:2.2.7'
//######################
}
//####################### XJC - JDK 1.7/1.8 ####################
jaxb {
xjc {
xsdDir = "my-schema/src/main/resources"
generatePackage = "org.example"
}
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}
task cleanGenerated{
//delete 'src/main/java/org'
//create 'src/main/java'
//(new File('src/main/java')).mkdirs()
}
//######################
compileJava.dependsOn xjc
clean.dependsOn cleanGenerated
Here is the stacktrace:
[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks:
[sts] eclipse
[sts] -----------------------------------------------------
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred evaluating root project 'shipment'.
> PermGen space
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 31.949 secs
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle installation 'C:\tools\gradle-2.4'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:71)
at org.springsource.ide.eclipse.gradle.core.TaskUtil.execute(TaskUtil.java:117)
at org.springsource.ide.eclipse.gradle.core.launch.GradleProcess$1.doit(GradleProcess.java:92)
at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:53)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred evaluating root project 'shipment'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)
at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'shipment'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:85)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
... 34 more
Caused by: java.lang.OutOfMemoryError: PermGen space
at org.gradle.plugins.ide.eclipse.EclipsePlugin.onApply(EclipsePlugin.groovy:64)
at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy:37)
at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
[sts] Time taken: 0 min, 35 sec
[sts] -----------------------------------------------------
I am facing following exception while running the xjc task in my project.
`[Fatal Error] xmldsig-core-schema.xsd:2:10: DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
:xsd-dependency-tree FAILED
FAILURE: Build failed with an exception.
org.xml.sax.SAXParseException; systemId: file://C/Users/rajveer.singh/workspace_ndc/ndc-schema/resources/schemas/15.2-schemas-edist/xmldsig-core-schema.xsd; lineNumber: 2; columnNumber: 10; DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
`
I have several segregated folders that I would like to generate Java code from, using the same gradle script as they belong to the same project. Is there any way to achieve this?
I just cloned the repo and tried to build the example but my gradle can't find the gradle-jaxb-plugin. Is there something missing on README?
I finally got it to compile with Gradle v1.12.
I'm curious if you are planning to maintain this or is it in PR's are accepted state only?
I gather from some of the other chatter that it is.
If so, what is the turn-around time on PR's to release?
We have a build env where we need to be able to configure an absolute paths for the xsdDir, episodesDir and bindingsDir. If you attempt to do this now the plugin appends the project.rootDir to the path even if it is already absolute. Also I would argue that in the case of a relative path appending project.rootDir is actually incorrect because in a multi-project build that location is the parent project which means the path always has to be relative to the parent project's directory and not the current project's directory. It probably should be project.projectDir instead.
the following element:
<xs:element name="SomeClass" type="SomeClassType">
<xs:annotation>
<xs:appinfo>
<meta:content-type>
application/xml;application/json;class=com.example
</meta:content-type>
</xs:appinfo>
<xs:documentation source="since">5.7</xs:documentation>
<xs:documentation xml:lang="en">
...
</xs:documentation>
</xs:annotation>
</xs:element>
generates a SomeClass.java file when I use the maven plugin:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.11.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/resources/schema</schemaDirectory>
</configuration>
</plugin>
But does not when I use this one:
jaxb {
xsdDir = "${projectDir.path - rootDir.path}/src/main/resources/schema"
episodesDir = "${buildDir.path - rootDir.path}/schema/episodes"
xjc {
destinationDir = jaxbDstDir
producesDir = jaxbDstDir
}
}
with:
jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
the dependencies are the same as the maven plugin is using,
other classes are generated okay
I use the 1.3.6 version
thanks
[ant:xjc] [WARNING] Simple type "TimeZoneType" was not mapped to Enum due to
EnumMemberSizeCap limit. Facets count: 513, current limit: 256. You can use customization
attribute "typesafeEnumMaxMembers" to extend the limit.
I wasn't able to get this flag passed through, so is this my oversight or a missing capability?
In README you have invalid classpath string (it doesn't work). I found what valid one should be:
classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.1'
The default config and doc shows how to process all the XSDs in a folder to a particular package. How do I specify individual XSD files and a different package for each one? All of them are in the same folder.
We are using the plugin in Ehcache 3 but it is broken on the CI environment due to the presence of space (%20 in URL encoding) in the path. See this specific build
I have tracked down the cause to a missing quoting of the episodeFile
property when passed to the xjc
ant task in org.gradle.jacobo.plugins.ant.AntXjc
- see here
I did not check if such quoting is required in other places as once this one if fixed, the build passes when the project path contains a space in it.
Currently when providing a destinationDir
that doesn't exist already the plugin fails.
The plugin should auto-create the destinationDir if one is provided (or make this configurable)
It seems I cannot leave the generatePackage
empty because my sources will land in the generated
package.
According to the docs:
https://jaxb.java.net/2.2.4/docs/xjc.html
Here under Compiler restrictions they claim that if you won't set the -p
attribute the next choice is to look the xsd file, but I guess it's not happening. Can you tell me how I can accomplish that task ?
Example file
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="2.0"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<xs:annotation>
<xs:appinfo>
<jxb:globalBindings>
<xjc:simple />
</jxb:globalBindings>
<jxb:schemaBindings>
<jxb:package name="com.custom.package"/>
</jxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
</xs:schema>
I have a module that has several schema files in it. Each has a different namespace and a different purpose. However when you look at the episode files, it generates one per module name and not one per schema. This results in requiring all the schema's in the module be imported in the schema file if it needs any of them. If you don't you get the following error: [ant:xjc} [ERROR] SCD "x-schema::tns" didnt match any schema component.
Not sure why episode files are done at the module level in the first place, but at a minimum and option to generate an episode file per schema would be nice to fix this issue.
I think the plugin should be able to support DTD like the ant plugin or the maven plugin.
Related to #9
Give the ability to perform multiple iterations of xjc processing.
Typically you wouldn't want to use the default destinationDir of "src/main/java" because it would mingle written code with generated code. It would be nice if the default was to put the generated source into the buildDir and then add that dir to the sourceSet.
I'm trying to generate the Java classes from a zip file with a bunch of schemas files plus some binding files.
My gradle build file is as follows:
dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41' //jaxws 2.2.6 uses jaxb 2.2.5, but can't dL 2.2.5 from maven the pom is off TODO
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
jaxb 'javax.xml.bind:jaxb-api:2.2.7'
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.5"
}
jaxb {
xsdDir = "/src/main/resources/schema"
bindings = ["bindings.xjc","bindings2.xjc"]
xjc {
taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
generatePackage = "com.soler.xsd"
args = ["-Xannotate"]
}
}
When I execute gradle xjc
, I'm getting the following error:
14:02:32.917 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] [ERROR] Property "Type" is already defined. Use <jaxb:property> to resolve this conflict.
14:02:32.921 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] line 494 of file:/C:/dev/XXX/src/main/resources/schema/external/YYY/ZZZ.xsd
14:02:32.922 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]
14:02:32.923 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] [ERROR] The following location is relevant to the above error
14:02:32.923 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc] line 540 of file:/C:/dev/XXX/src/main/resources/schema/external/YYY/ZZZ.xsd
14:02:32.924 [ERROR] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:xjc]
14:02:32.941 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.942 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:02:32.944 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.945 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
14:02:32.945 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':ext/stix:xjc'.
14:02:32.946 [ERROR] [org.gradle.BuildExceptionReporter] > unable to parse the schema. Error messages should have been provided
14:02:32.948 [ERROR] [org.gradle.BuildExceptionReporter]
14:02:32.949 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
14:02:32.950 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
Many places recommend the following link Dealing with errors but I'm not sure how that applies to this plugin.
Thanks
I see that you can set the "extension mode" flag, but how do you specify the extensions to use, and the arguments to those extensions? For instance, in the Maven "cxf-xjc-plugin" plugin, I can specify an "extensions" section in the configuration where specify the GAV tuples for my extensions, and then in the "xsdOptions" section, I can specify "extensionArgs" with the command line options for those extensions.
can we specific xjc to run
xsd1 first ,
xsd2 second,
xsd3 third
apply plugin: 'com.github.jacobono.jaxb'
dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
jaxb 'javax.xml.bind:jaxb-api:2.2.11'
}
10:07:01.752 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Class org.xml.sax.ErrorHandler loaded from parent loader (parentFirst)
10:07:01.762 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Resource com/sun/tools/xjc/api/ErrorListener.class loaded from ant loader
10:07:01.782 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Couldn't load Resource com/sun/xml/bind/api/ErrorListener.class
10:07:01.792 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':iqpdct-iodd101:xjc'
10:07:01.802 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :iqpdct-iodd101:xjc FAILED
10:07:01.822 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :iqpdct-iodd101:xjc (Thread[main,5,main]) completed. Took 1.972 secs.
10:07:01.832 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 3.137 secs, idle: 0.038 secs
10:07:01.842 [ERROR] [org.gradle.BuildExceptionReporter]
10:07:01.852 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:07:01.862 [ERROR] [org.gradle.BuildExceptionReporter]
10:07:01.872 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
10:07:01.882 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':iqpdct-iodd101:xjc'.
10:07:01.892 [ERROR] [org.gradle.BuildExceptionReporter] > java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener
10:07:01.902 [ERROR] [org.gradle.BuildExceptionReporter]
10:07:01.912 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
10:07:01.922 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
10:07:01.942 [LIFECYCLE] [org.gradle.BuildResultLogger]
10:07:01.942 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
Hi,
I was trying out this plugin for generating out java classes out of xsd with custom binding *.xjb file.
jaxb { xsdDir = "src/main/resources/schema/" bindings = ["src/main/resources/schema/bindings/discovery-bindings.xjb"] xjc { taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task" generatePackage = "com.nacnez.learn.wopiTrial.xml" args = ["-Xinheritance", "-Xannotate"] } }
When I execute the gradle xjc task it doesn't seem to be recognizing my xjb file. If I rename the filename to .xsd it seems to read the file but it throws the issue that it is not a valid xsd.
If I execute the same using xjc it works - xjc -b src/main/resources/schema/bindings/ -d src/main/java/ -p com.nacnez.learn.wopiTrial.xml src/main/resources/schema/
I have attached the relevant xsd and xbj files (changed extension as txt). Please let me know where I am going wrong.
Thanks,
~ Srini
Hi everyone
I already read that isn't possible to invoke xjc from within another task, but it would be very useful. I have a task that copy a lot of xsd schema inside a folder, and i would be binding into class separately with single xjc invocation. Is there a workaround to obtain this? This is my build script (I'm trying to invoke xjc task from within initBind task). Thank you
build.gradle.txt
Great plugin, thanks very much for making it available. There is one annoyance, though.
We try to store all dependencies in a local Artifactory instance, which is set up to mirror Maven Central, JCenter and a few other major repos out there. As this plugin doesn't publish to those, I have several options, none of which are very appealing:
I think publishing to JCenter is a bit less cumbersome than publishing to Maven Central, and if you add it to plugins.gradle.org with Gradle 2.1+ we can even access it directly by its plugin id. Either of those would make our lives a fair bit easier.
Can you please consider publishing your plugin to:
This for easier access to your plugin.
This way we don't have to add your specific bintray repo to artifactory in our organisation but just can keep working on jcenter and gradle plugins.
Thanks
what am I doing wrong? I'm getting java.lang.NoClassDefFoundError: com/sun/xml/bind/api/ErrorListener
when running ./gradlew xjc. The following is my build file
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2'
classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4'
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'com.github.jacobono.jaxb'
jar {
baseName = 'mef-service'
version = '0.1.0'
}
// This is to make Spring-Loaded pick up changes when compiling through Intellij
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-jetty",
"org.springframework.boot:spring-boot-starter-security",
"org.springframework.boot:spring-boot-starter-actuator",
"org.springframework.boot:spring-boot-starter-data-mongodb")
compile fileTree("libs")
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
jaxb 'javax.xml.bind:jaxb-api:2.2.11'
testCompile("org.springframework.boot:spring-boot-starter-test",
"com.jayway.restassured:json-path:2.3.4",
"com.jayway.restassured:rest-assured:2.3.4")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
jaxb {
xsdDir = "src/main/resources/mef-schemas/2014v3.0"
xjc {
destinationDir = "src/main/java/mef/generator/rushtax/generated"
generatePackage = "rushtax.mef.generator.generated"
args = ["-Xinheritance", "-Xannotate"]
}
}
Right now, the jaxb plugin requires Gradle to be run with Java 7.
Is it possible to compile the jaxb plugin with target=1.6, so that it works even if Gradle is run with Java 6?
We are having difficulty using this plugin to generate Java code when working with schema files that declare namespaces that end with a '#'.
I am using the following version of gradle:
++++++++++++++++++++
gradle -v
Build time: 2015-05-05 08:09:24 UTC
Build number: none
Revision: 5c9c3bc20ca1c281ac7972643f1e2d190f2c943c
Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM: 1.8.0_51 (Oracle Corporation 25.51-b03)
OS: Linux 3.13.0-63-generic amd64
+++++++++++++++++++++++++++++++++++++++
Following files have been copied to this ticket in order to reproduce the problem.
(1) build.gradle
++++++++++++++++++++
buildscript {
repositories {
jcenter()
}
}
plugins {
id "com.github.jacobono.jaxb" version "1.3.5"
}
version = '1.0'
repositories {
mavenCentral()
jcenter()
}
jaxb {
xsdDir = "schemas"
xjc {
destinationDir = "generated"
generatePackage = "schemas"
}
}
dependencies {
// This first line specifies which version of the xjc compiler to use
jaxb 'com.sun.xml.bind:jaxb-xjc:2.1.12'
}
++++++++++++++++
(2) schema_imported.xsd: Place this in path 'schemas/schema_imported.xsd' relative to 'build.gradle'
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++(3) schema_importer.xsd: Place this in path 'schemas/schema_importer.xsd' relative to 'build.gradle'
++++++++++++++++++++
+++++++++++++++++++++Things appear to work well when 'http://www.w3.org/2009/09/imported#' is replaced by 'http://www.w3.org/2009/09/imported'
Error on ./gradlew clean build:
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.jacobo.plugins.JaxbPlugin.class$(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.jacobo.plugins.JaxbPlugin.$get$$class$com$google$inject$Guice(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy:51)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
15:36:01.270 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
Build.gradle:
compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet-core', version: '2.15'
compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '2.15'
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.15'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.2'
compile group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics-runtime', version: '0.9.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.2.11'
compile group: 'com.sun.xml.bind', name: 'jaxb-xjc', version: '2.2.11'
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.12'
compile group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics', version: '0.9.2'
jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:0.9.2"
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.4"
}
def generatedResources = "src/main/java"
jaxb {
xsdDir = "src/main/xsd"
bindingsDir = "src/main/xsd"
bindings = ["bindings.xjb"]
episodesDir = "build/generated-resources/main/java"
xjc {
destinationDir = generatedResources
producesDir = generatedResources
taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
}
}
buildscript {
repositories {
maven {
url "INTERNAL_NEXUS_URL"
}
}
dependencies {
classpath "org.akhikhl.gretty:gretty:1.2.2"
}
}
apply plugin: 'org.akhikhl.gretty'
gretty {
port = 8080
contextPath = '/jaxb-test'
servletContainer = 'tomcat8'
debugPort = 5005 // default
debugSuspend = true // default
}
Hi,
I have tried using 1.3.6:
jaxb {
xsdDir = "${projectDir.path - rootDir.path}/src/main/resources/schema"
episodesDir = "${buildDir.path - rootDir.path}/schema/episodes"
xjc {
taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
generatePackage = "com.example"
args = ["-Xinheritance", "-Xannotate"]
}
}
and:
dependencies {
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.5"
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics:0.6.4"
jaxb "org.jvnet.jaxb2_commons:jaxb2-basics-annotate:0.6.4"
}
and I get:
Execution failed for task ':public-cloud:xjc'.
> taskdef A class needed by class org.jvnet.jaxb2_commons.xjc.XJC2Task cannot be found: com/sun/tools/xjc/XJC2Task
using the classloader AntClassLoader[~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-ant/0.6.5/745dcb1381e32dc6d171e3299c6d1fc06728d4d6/jaxb2-basics-ant-0.6.5.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics/0.6.4/b8a0ebd9a0d9fafb19e1ebc0216f7fc85c1abb4/jaxb2-basics-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-annotate/0.6.4/9ba2ba3b83980dd71e6122bb9c3e124495beb33/jaxb2-basics-annotate-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-runtime/0.6.4/cfe61f199e352b92c63a2cce8b44df131d1bd952/jaxb2-basics-runtime-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.jaxb2_commons/jaxb2-basics-tools/0.6.4/d61697c4c8c9daf89a2aa35b26fa53b4b055efee/jaxb2-basics-tools-0.6.4.jar:~/.gradle/caches/modules-2/files-2.1/com.google.code.javaparser/javaparser/1.0.8/ec09ff06f6c0d69c07b48df1b725f50d37298c47/javaparser-1.0.8.jar:~/.gradle/caches/modules-2/files-2.1/org.jvnet.annox/annox/0.5.0/2b2ba5f7bdb897a58febf9f26cb73818d7eba548/annox-0.5.0.jar:~/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:~/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.2/ef6449b62937bbd10e29ba9ed9a852754b861d26/commons-lang-2.2.jar:~/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar]
Is there a section that should be in the Usage section where we include "apply plugin ?" in the build.gradle file? If so can the documentation be updated?
I am trying to include the plugin 1.3.6 version using buildscript {} notation just as given in the readme (executing gradle script from IDEA). At project refreshing I get: "Error: Connection refused: connect. It is certainly not a proxy issue because the same buildscript invocation works fine for no.nils.wsdl2java plugin. I tried this too to no avail:
https://plugins.gradle.org/plugin/com.github.jacobono.jaxb
Hi,
I try to use the old version 1.0.7 for make jaxb 1 and I receive this error:
xjc doesn't support the "destdir" attribute
thx
When I run this, I get an error
> Could not resolve all dependencies for configuration ':classpath'. > Could not find com.jacobo.gradle.plugins:gradle-jaxb-plugin:1.3.1. Required by: ...
Hi,
Thanks for your very useful plugin.
I encounter this error when I launch "gradle xjc" :
/correct/path/to/foo1.xsd is not a part of this compilation. Is this a mistake for (...)
(Even with -verbose mode or --info in gradle, this is the only error message I have...)
It appends when I have two xsd schemas (linked together or not), foo1.xsd and foo2.xsd in the xsdDir and want to customize one of them (for example foo1.xsd) in a binding file.
If I delete the foo2.xsd file, java classes are generated with the relevant customization.
Here is an example of my binding file, with an inheritance customization on an element of foo1.xsd :
(bindings.xjb (in the bindingsDir folder)) :
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc inheritance">
<jxb:bindings schemaLocation="../foo1.xsd">
<jxb:bindings node="//xs:complexType[@name='fooType']">
<inheritance:implements>package.foo.fooInterface</inheritance:implements>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
Precision :
If I have the two xsd schemas present in the xsdDir without "<jxb:bindings schemaLocation="../foo1.xsd"></xcb:bindings>
" customization tag in bindings.xjb, but instead, for example, a "<globalBindings>
" tag, injecting superclass on all generated classes, the reverse engineering works perfectly, with extension of the superclass by all generated classes.
It's only the schema-binded customization that is problematic...(It seems to be a path resolution problem on schemaLocation attribute, but the xsd path which is threw on the error message is right, so...)
My gradle configuration :
def generatedResources = "build/generated-resources/main/java"
jaxb {
xsdDir = "src/main/resources/schemas"
bindingsDir = "src/main/resources/schemas/bindings"
bindings = ["bindings.xjb"]
episodesDir = "build/generated-resources/main/resources"
xjc {
destinationDir = generatedResources
producesDir = generatedResources
taskClassname = "org.jvnet.jaxb2_commons.xjc.XJC2Task"
args = ["-Xinheritance", "-Xannotate"]
}
}
Thanks for your help!
I forked and cloned master, and when I finally built it, a unit test failed with the following:
java.lang.VerifyError: (class: org/gradle/jacobo/plugins/tree/TreeNode$1, method: super$1$sort signature: (Ljava/util/Comparator;)V) Illegal use of nonvirtual function call
at org.gradle.jacobo.plugins.tree.TreeNode.(TreeNode.groovy:65)
at org.gradle.jacobo.plugins.tree.TreeNodeSpec.Create node with data, and one parent(TreeNodeSpec.groovy:31)
Looking at TreeNode.groovy:
public TreeNode(T data, TreeNode parent) {
this.parents = new LinkedList<TreeNode>() {{ add(parent) }} // line 65
this.children = new LinkedList<TreeNode>()
this.data = data
parent.addChild(this, false)
}
I'm not yet a native Groovy speaker (compared to Java), so I'm not sure what's going on here. When I commented out the single "Create node with data, and one parent" test, the build succeeded.
I tried various hacks that were implied on the internet, like adding "-Xverify:none". I tried setting the JDK compile level to 1.6, 1.7, and 1.8. No change.
It would be nice in the xjc convention to be able to specify a specific xsd file relative to the jaxb.xsdDir to process.
Try to invoke the xjc task on this source XSD:
http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.0/fatturapa_v1.0.xsd
The xsd-dependency-tree task fails with an IOException. Trying to debug the plugin, I see that it tries to retrieve a file with a path like:
C:\my\local\path\xsdDir\http:\www.w3.org\TR\2002\REC-xmldsig-core-20020212\xmldsig-core-schema.xsd
When an absolute path is provided to destinationDir
, the plugin appends this as a string to the project root, making it impossible to pass absolute file references in gradle.
Would be great to support the following "toString, equals, hashcode" similar to jaxb2basics plugn
https://github.com/highsource/jaxb2-basics/wiki/Using-JAXB2-Basics-Plugins
Maybe I'm missing it and its already here, but it would be nice if an episode file could be use from a jar dependency similar to the maven jaxb2 plugin useDependenciesAsEpisode feature.
http://confluence.highsource.org/display/MJIIP/User+Guide#UserGuide-Separateschemacompilation
Gradle JAXB detects folders as XSD dependency.
Caused by: java.io.FileNotFoundException: /home/abc/dev/projects/adcubum/ksd-server/common.config/src/main/resources/xsd (Is a directory)
at org.gradle.jacobo.schema.factory.DefaultDocumentFactory.createDocument(DefaultDocumentFactory.groovy:39)
at org.gradle.jacobo.schema.factory.DocumentFactory$createDocument$0.call(Unknown Source)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver.resolveDependencies(ExternalDependencyResolver.groovy:95)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$_resolve_closure1_closure5.doCall(ExternalDependencyResolver.groovy:70)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$_resolve_closure1.doCall(ExternalDependencyResolver.groovy:69)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver.resolve(ExternalDependencyResolver.groovy:52)
at org.gradle.jacobo.plugins.resolver.ExternalDependencyResolver$resolve$0.call(Unknown Source)
at org.gradle.jacobo.plugins.task.JaxbDependencyTree.start(JaxbDependencyTree.groovy:57)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
... 64 more
This resolver method call retrieves a File
collection containg directory.
If I remove the directory (using a debugger) from the collection, everything runs smooth.
I can't seem to get past this error on gradle build:
Searched in the following locations:
https://jcenter.bintray.com/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.pom
https://jcenter.bintray.com/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.jar
https://repo1.maven.org/maven2/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.pom
https://repo1.maven.org/maven2/org/gradle/jacobo/gradle-xsd-wsdl-slurping/1.1.1/gradle-xsd-wsdl-slurping-1.1.1.jar
Required by:
:gfexpert:unspecified > org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4
:gfexpert:unspecified > org.gradle.jacobo.plugins:gradle-wsdl-plugin:1.7.6
What am I missing:
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4'
classpath 'org.gradle.jacobo.plugins:gradle-wsdl-plugin:1.7.6'
}
apply plugin: 'com.github.jacobono.jaxb'
dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
jaxb 'javax.xml.bind:jaxb-api:2.2.7'
etc
I can't get it to work for me.
Hi,
Please, I'm having trouble using the plugin (1.3.6) with Gradle 3.3 and I need help.
I had two XSD's schemas (routes.xsd and security.xsd) and after running ./gradlew xjc the ObjectFactory class that was being generated, has only some methods of only one XSD file.
routes.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.restnext.org/routes"
xmlns="http://www.restnext.org/routes"
elementFormDefault="qualified">
<xs:element name="routes">
<xs:annotation>
<xs:appinfo>This schema defines a RestNEXT Route Metadata.</xs:appinfo>
<xs:documentation source="description">
This is the root element of the descriptor.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="route" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="description">
This element represents the route metadata.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<!-- comment this path element with regex validation
because this entry can be:
a path (/test),
a path param (/test/{name}) or
a path regex (/test/regex/\\d+).
And this regex only match as valid the entries: (path and path param).
<xs:element name="path">
<xs:annotation>
<xs:documentation source="description">
This element defines the route path.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([/])(([/\w])+(/\{[\w]+\})*)*([?])?"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
-->
<xs:element name="path" type="xs:string">
<xs:annotation>
<xs:documentation source="description">
This element defines the route path.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="provider">
<xs:annotation>
<xs:documentation source="description">
This element defines the lambda string method reference route provider.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([\w.])*([:]{2})(\w)+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="enable" type="xs:boolean" minOccurs="0" default="true">
<xs:annotation>
<xs:documentation source="description">
This element defines if this route path is enable or not.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="methods" minOccurs="0">
<xs:annotation>
<xs:documentation source="description">
This element defines the route allowed http methods.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="method" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="description">
This element defines a http method.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="GET"/>
<xs:enumeration value="POST"/>
<xs:enumeration value="PUT"/>
<xs:enumeration value="PATCH"/>
<xs:enumeration value="DELETE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="medias" minOccurs="0">
<xs:annotation>
<xs:documentation source="description">
This element defines the route allowed media types.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="media" type="xs:string" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="description">
This element defines a media type.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.restnext.org/securities"
xmlns="http://www.restnext.org/securities"
elementFormDefault="qualified">
<xs:element name="securities">
<xs:annotation>
<xs:appinfo>This schema defines a RestNEXT Security Metadata.</xs:appinfo>
<xs:documentation source="description">
This is the root element of the descriptor.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="security" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="description">
This element represents the security metadata.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<!-- comment this path element with regex validation
because this entry can be:
a path (/test),
a path param (/test/{name}) or
a path regex (/test/regex/\\d+).
And this regex only match as valid the entries: (path and path param).
<xs:element name="path">
<xs:annotation>
<xs:documentation source="description">
This element defines the security path.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([/])(([/\w])+(/\{[\w]+\})*)*([?])?"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
-->
<xs:element name="path" type="xs:string">
<xs:annotation>
<xs:documentation source="description">
This element defines the security path.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="provider">
<xs:annotation>
<xs:documentation source="description">
This element defines the lambda string method reference security provider.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([\w.])*([:]{2})(\w)+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="enable" type="xs:boolean" minOccurs="0" default="true">
<xs:annotation>
<xs:documentation source="description">
This element defines if this security path is enable or not.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
build.gradle:
description = 'restnext-core'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.github.jacobono:gradle-jaxb-plugin:1.3.6'
}
}
apply plugin: 'com.github.jacobono.jaxb'
dependencies {
compile project(':restnext-util')
compile 'io.netty:netty-all'
compile 'org.slf4j:slf4j-api'
testCompile 'junit:junit'
compile 'org.javassist:javassist'
compile 'ch.qos.logback:logback-classic'
jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
jaxb 'javax.xml.bind:jaxb-api:2.2.12'
}
jaxb {
xsdDir = rootProject.file('/restnext-core/src/main/resources')
episodesDir = rootProject.file('/restnext-core/src/main/resources/META-INF')
xjc {
header = false
generatePackage = 'org.restnext.core.jaxb.internal'
args = [
//'-no-header',
'-enableIntrospection',
'-npa'
]
}
}
ObjectFactory class generated by (jacobono/gradle-jaxb-plugin):
package org.restnext.core.jaxb.internal;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.restnext.core.jaxb.internal package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Securities }
*
*/
public Securities createSecurities() {
return new Securities();
}
/**
* Create an instance of {@link Securities.Security }
*
*/
public Securities.Security createSecuritiesSecurity() {
return new Securities.Security();
}
}
ObjectFactory class generated by (highsource/maven-jaxb2-plugin):
package org.restnext.core.jaxb.internal;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.restnext.core.jaxb.internal package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.restnext.core.jaxb.internal
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Routes }
*
*/
public Routes createRoutes() {
return new Routes();
}
/**
* Create an instance of {@link Securities }
*
*/
public Securities createSecurities() {
return new Securities();
}
/**
* Create an instance of {@link Routes.Route }
*
*/
public Routes.Route createRoutesRoute() {
return new Routes.Route();
}
/**
* Create an instance of {@link Securities.Security }
*
*/
public Securities.Security createSecuritiesSecurity() {
return new Securities.Security();
}
/**
* Create an instance of {@link Routes.Route.Methods }
*
*/
public Routes.Route.Methods createRoutesRouteMethods() {
return new Routes.Route.Methods();
}
/**
* Create an instance of {@link Routes.Route.Medias }
*
*/
public Routes.Route.Medias createRoutesRouteMedias() {
return new Routes.Route.Medias();
}
}
Given that JAXB is not included in JDK 1.6 and higher, I was wondering if the usage examples could be updated.
It should no longer be necessary to include jaxb in the dependencies {} section; Ideally I would like to get as clean as possible demo/usage with JDK 1.6 and higher. Can the docs be updated?
If i use the recomended method to include the plugin in my build script i get the following error:
Error:(5, 0) Plugin [id: 'com.github.jacobono.jaxb', version: '1.3.6'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Gradle Central Plugin Repository (plugin 'com.github.jacobono.jaxb' has no version '1.3.6' - see https://plugins.gradle.org/plugin/com.github.jacobono.jaxb for available versions)
https://plugins.gradle.org/plugin/com.github.jacobono.jaxb
1.3.5 seems to be the latest there.
Hello,
I'm trying to use the plugin in my Gradle 2.8 project, but I get the following error:
Failed to apply plugin [id 'com.github.jacobono.jaxb']
No such property: extensions for class: java.lang.String
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':projectname'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:72)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:153)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:499)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:86)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:125)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:122)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.github.jacobono.jaxb']
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:160)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:35)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:79)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:135)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
at org.gradle.api.plugins.PluginAware$apply.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_9a1g6pkbxdew2m120k8e1qpmb.run(/home/robert/develop/repository/nts/trost-connector/build.gradle:1)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 58 more
Caused by: groovy.lang.MissingPropertyException: No such property: extensions for class: java.lang.String
at org.gradle.jacobo.plugins.JaxbPlugin.configureJaxbExtension(JaxbPlugin.groovy:73)
at org.gradle.jacobo.plugins.JaxbPlugin.this$2$configureJaxbExtension(JaxbPlugin.groovy)
at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy:52)
at org.gradle.jacobo.plugins.JaxbPlugin.apply(JaxbPlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:44)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
... 69 more
Here is my build.gradle:
apply plugin: 'com.github.jacobono.jaxb'
dependencies {
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.7-b41'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.7-b41'
jaxb 'javax.xml.bind:jaxb-api:2.2.7'
}
jaxb {
xjc {
xsdDir = "src/main/resources/"
generatePackage = "test"
}
}
Does this have something to do with Gradle 2.8? Or am I doing something wrong here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.