From 12b996b07d499a53f0188714446d8ae927c3595f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 23 Jul 2024 15:24:30 +0200 Subject: [PATCH] Upgrade XJC processing to com.github.bjornvester.xjc This commit upgrades our build to use a different plugin for XJC processing, so that Gradle doesn't output a compatibility warning anymore. Unfortunately, com.github.bjornvester.xjc only works against main sources and our schema is only used for test purposes. This commit therefore reconfigure the task to remove the xjc main source set and apply it to the test source set instead. Closes gh-33264 --- spring-oxm/spring-oxm.gradle | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/spring-oxm/spring-oxm.gradle b/spring-oxm/spring-oxm.gradle index 456a8dbcc7d..a00763b65e8 100644 --- a/spring-oxm/spring-oxm.gradle +++ b/spring-oxm/spring-oxm.gradle @@ -1,17 +1,12 @@ plugins { - id "org.unbroken-dome.xjc" + id "com.github.bjornvester.xjc" version "1.8.2" } description = "Spring Object/XML Marshalling" xjc { - xjcVersion = '3.0' -} - -sourceSets { - test { - xjcTargetPackage = 'org.springframework.oxm.jaxb.test' - } + xsdDir.set(layout.projectDirectory.dir("src/test/schema")) + defaultPackage.set('org.springframework.oxm.jaxb.test') } dependencies { @@ -31,3 +26,16 @@ dependencies { testRuntimeOnly("com.sun.xml.bind:jaxb-core") testRuntimeOnly("com.sun.xml.bind:jaxb-impl") } + +tasks.named("xjc").configure { xjc -> + // XJC plugin only works against main sources + def javaSrcDirs = sourceSets.main.java.srcDirs + javaSrcDirs.remove(file(xjc.outputJavaDir)) + sourceSets.main.java.srcDirs = javaSrcDirs + def resourcesSrcDirs = sourceSets.main.resources.srcDirs + resourcesSrcDirs.remove(file(xjc.outputResourcesDir)) + sourceSets.main.resources.srcDirs = resourcesSrcDirs + + sourceSets.test.java.srcDir(xjc.outputJavaDir) + sourceSets.test.resources.srcDir(xjc.outputResourcesDir) +}