Reputation: 11
I tried to use new version of com.intershop.gradle.jaxb:6.0.0 with gradle:8.1.1 to generate java classes from wsdl. But I need jaxb2-basics extension to use '-XtoString' parameter. When I add
jaxbext 'org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1'
to my dependencies section and try to generate even without '-XtoString' parameter I have got an error:
* What went wrong:
Execution failed for task ':jaxbJavaGenCsClientWs'.
> xjc failed
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jaxbJavaGenCsClientWs'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:149)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:147)
This is full configuration of my gradle project. I use java17.
plugins {
id "java"
id 'com.intershop.gradle.jaxb' version '6.0.0'
}
sourceSets {
main {
java {
srcDir "${project.buildDir}/generated-java/csClientWs"
}
}
}
repositories {
mavenCentral()
}
ext {
testV = '4.7.472.60'
}
dependencies {
implementation 'com.sun.xml.bind:jaxb-xjc:4.0.2'
implementation 'com.sun.xml.bind:jaxb-jxc:4.0.2'
implementation 'com.sun.xml.bind:jaxb-impl:4.0.2'
implementation 'com.sun.xml.bind:jaxb-core:4.0.2'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.2'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
implementation 'jakarta.activation:jakarta.activation-api:2.1.0'
jaxbext 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
jaxbext 'net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8'
jaxbext 'com.github.jaxb-xew-plugin:jaxb-xew-plugin:2.1'
//jaxbext 'org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1'
//implementation 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:1.11.1'
//implementation 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:1.11.1'
//implementation 'org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1'
//implementation 'org.jvnet.jaxb2_commons:jaxb2-basics-annotate:1.1.0'
}
jaxb {
javaGen {
csClientWs {
strictValidation = false
extension = true
packageName = 'org.excample.csclient.ws'
header = true
schema = file("${projectDir}/src/main/wsdl/test_${testV}.wsdl")
binding = file("${projectDir}/src/main/wsdl/binding.xjb")
args = ['-wsdl', '-Xxew', '-Xfluent-api']
}
}
}
I expect that when I uncomment all section below jaxbext 'com.github.jaxb-xew-plugin:jaxb-xew-plugin:2.1' jaxb2-basics will work properly and when I will add '-XtoString' to args section it generate properly java Classes. When this section is commented (like in my example) it works fine.
Upvotes: 0
Views: 892
Reputation: 2848
You can use the following migration guide to help get the latest version of the org.jvnet.jaxb
artifacts, according the targeted JDK and JAXB API (v4 is a good one).
We also added in latest version the backport of the jaxb-fluent-api
So it would lead to the following configuration
dependencies {
implementation 'com.sun.xml.bind:jaxb-xjc:4.0.2'
implementation 'com.sun.xml.bind:jaxb-jxc:4.0.2'
implementation 'com.sun.xml.bind:jaxb-impl:4.0.2'
implementation 'com.sun.xml.bind:jaxb-core:4.0.2'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.2'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
implementation 'jakarta.activation:jakarta.activation-api:2.1.0'
jaxbext 'com.github.jaxb-xew-plugin:jaxb-xew-plugin:2.1'
jaxbext 'org.jvnet.jaxb:jaxb-plugins:4.0.0'
//implementation 'org.jvnet.jaxb:jaxb-plugins-ant:4.0.0'
//implementation 'org.jvnet.jaxb:jaxb-plugins-runtime:4.0.0'
//implementation 'org.jvnet.jaxb:jaxb-plugins:4.0.0'
//implementation 'org.jvnet.jaxb:jaxb-plugin-annotate:4.0.0'
}
jaxb {
javaGen {
csClientWs {
strictValidation = false
extension = true
packageName = 'org.excample.csclient.ws'
header = true
schema = file("${projectDir}/src/main/wsdl/test_${testV}.wsdl")
binding = file("${projectDir}/src/main/wsdl/binding.xjb")
args = ['-wsdl', '-Xxew', '-Xfluent-api', '-XtoString']
}
}
}
Just add the good args you want (added -XtoString
) and uncomment the implementation section if needed.
I also found it strange you added the jaxb-api "2.4.0" as jaxbext, been removed in configuration above.
Upvotes: 0
Reputation: 476
Try these dependencies instead of the org.jvnet.jaxb2_commons
artifacts:
implementation 'org.patrodyne.jvnet:hisrc-basicjaxb-ant:2.1.0'
implementation 'org.patrodyne.jvnet:hisrc-basicjaxb-runtime:2.1.0'
implementation 'org.patrodyne.jvnet:hisrc-basicjaxb-plugins:2.1.0'
implementation 'org.patrodyne.jvnet:hisrc-hyperjaxb-annox-plugin:2.1.0'
Version 2.1.0 of the HiSrc BasicJAXB project is a significant release, its source/target (release) compatibility is at Java 11, up from Java 8. And, JDK 17 is used for the build. JAXB dependencies are at version 4.x.
See also BasicJAXB V2 namespace changes.
Disclaimer: I am the maintainer of the HiSrc forks.
Upvotes: 0