Skip to content

Commit 12b996b

Browse files
committed
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
1 parent 656d08f commit 12b996b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

spring-oxm/spring-oxm.gradle

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
plugins {
2-
id "org.unbroken-dome.xjc"
2+
id "com.github.bjornvester.xjc" version "1.8.2"
33
}
44

55
description = "Spring Object/XML Marshalling"
66

77
xjc {
8-
xjcVersion = '3.0'
9-
}
10-
11-
sourceSets {
12-
test {
13-
xjcTargetPackage = 'org.springframework.oxm.jaxb.test'
14-
}
8+
xsdDir.set(layout.projectDirectory.dir("src/test/schema"))
9+
defaultPackage.set('org.springframework.oxm.jaxb.test')
1510
}
1611

1712
dependencies {
@@ -31,3 +26,16 @@ dependencies {
3126
testRuntimeOnly("com.sun.xml.bind:jaxb-core")
3227
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
3328
}
29+
30+
tasks.named("xjc").configure { xjc ->
31+
// XJC plugin only works against main sources
32+
def javaSrcDirs = sourceSets.main.java.srcDirs
33+
javaSrcDirs.remove(file(xjc.outputJavaDir))
34+
sourceSets.main.java.srcDirs = javaSrcDirs
35+
def resourcesSrcDirs = sourceSets.main.resources.srcDirs
36+
resourcesSrcDirs.remove(file(xjc.outputResourcesDir))
37+
sourceSets.main.resources.srcDirs = resourcesSrcDirs
38+
39+
sourceSets.test.java.srcDir(xjc.outputJavaDir)
40+
sourceSets.test.resources.srcDir(xjc.outputResourcesDir)
41+
}

0 commit comments

Comments
 (0)