-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@XmlRootElement not added to corresponding Java Class #49
Comments
A possible solution without annotation plugin:build.gradle: ext { plugins { id 'com.intershop.gradle.jaxb' version "${versionIntershopJaxbPlugin}" sourceCompatibility = '17' repositories { def SRC_GEN_DIR = 'src-gen/main/java' sourceSets { dependencies { implementation "org.apache.commons:commons-lang3:${versionApacheCommonsLang3}" implementation "jakarta.xml.bind:jakarta.xml.bind-api:${versionJakartaXmlBindApi}" // Use JUnit Jupiter for testing. tasks.named('test') { //////////////////////////////////////// // Create src-gen folder if it does not exist: // Generate java code if it does not exist: // Java code generation from XML schema. bindings/bindings.xjb: <jxb:bindings xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
</jxb:bindings> |
Hi.
I am using Java 17 and Jakarta Xml Binding 3.0 for code generation from XML Schema.
The jaxb task results with the following error:
Working Directory: D:\DEV\git\s2r-cloud\utilities\xml-utils
Gradle user home: D:\DEV\gradle_user_home
Gradle Distribution: Local installation at D:\DEV\Gradle
Gradle Version: 7.4
Java Home: D:\DEV\Java
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: build
FAILURE: Build failed with an exception.
Execution failed for task ':jaxbJavaGenBttcg'.
BUILD FAILED in 1s
1 actionable task: 1 executed
build.gradle:
buildscript {
apply from: '../../common-versions.gradle'
ext {
}
}
plugins {
id 'java'
id 'com.intershop.gradle.jaxb' version '5.1.0'
}
sourceCompatibility = '17'
targetCompatibility = '17'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation "org.slf4j:slf4j-api:${versionSlf4j}"
implementation "org.slf4j:slf4j-ext:${versionSlf4j}"
implementation "org.apache.commons:commons-lang3:${versionApacheCommonsLang3}"
implementation "jakarta.xml.bind:jakarta.xml.bind-api:${versionJakartaXmlBindApi}"
implementation "org.eclipse.persistence:org.eclipse.persistence.moxy:${versionEclipsePersistenceMoxy}"
// Use JUnit Jupiter for testing.
testImplementation "org.slf4j:slf4j-simple:${versionSlf4j}"
testImplementation(platform("org.junit:junit-bom:${versionJunitJupiter}"))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation "org.assertj:assertj-core:${versionAssertJ}"
testImplementation "org.awaitility:awaitility:${versionAwaitility}"
}
tasks.named('test') {
// Use junit platform for unit tests.
useJUnitPlatform()
}
jaxb {
// generate java code from schema
javaGen {
//generates java code for project from project schema
bttcg {
packageName = 'com.siemens.ra.cg.schema.bttcg'
//schema = file('src/main/resources/person.xsd')
schemas = files('src/main/resources/xsd/bttCgElements.xsd',
'src/main/resources/xsd/bttCgHeadwayPatterns.xsd',
'src/main/resources/xsd/bttCgATROffPatterns.xsd')
binding = file('src/main/resources/xsd/bindings/bindings.xjb')
catalog = file('src/main/resources/xsd/catalog/schema.cat')
outputDir = file('src-gen/main/java')
}
}
}
bindings/bindings.xjb:
<jxb:bindings xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jaxb https://jakarta.ee/xml/ns/jaxb/bindingschema_3_0.xsd"
jxb:extensionBindingPrefixes="annox" jxb:version="3.0">
</jxb:bindings>
The text was updated successfully, but these errors were encountered: