mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
0f990e44a8
See gh-36195
38 lines
1.4 KiB
Groovy
38 lines
1.4 KiB
Groovy
import com.github.bjornvester.xjc.XjcTask
|
|
|
|
plugins {
|
|
id "com.github.bjornvester.xjc"
|
|
}
|
|
|
|
description = "Spring Object/XML Marshalling"
|
|
|
|
xjc {
|
|
xsdDir.set(layout.projectDirectory.dir("src/test/schema"))
|
|
defaultPackage.set('org.springframework.oxm.jaxb.test')
|
|
}
|
|
|
|
dependencies {
|
|
api(project(":spring-beans"))
|
|
api(project(":spring-core"))
|
|
optional("com.thoughtworks.xstream:xstream")
|
|
optional("jakarta.activation:jakarta.activation-api")
|
|
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
|
testImplementation(project(":spring-context"))
|
|
testImplementation(testFixtures(project(":spring-core")))
|
|
testImplementation("org.codehaus.jettison:jettison") {
|
|
exclude group: "stax", module: "stax-api"
|
|
}
|
|
testImplementation("org.xmlunit:xmlunit-assertj")
|
|
testImplementation("org.xmlunit:xmlunit-matchers")
|
|
testRuntimeOnly("com.sun.xml.bind:jaxb-core")
|
|
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
|
|
}
|
|
|
|
// The XJC plugin adds generated code to the main source set, but we need it only for tests.
|
|
// 1) Reset main source sets to the standard directories only.
|
|
sourceSets.main.java.setSrcDirs(["src/main/java"])
|
|
sourceSets.main.resources.setSrcDirs(["src/main/resources"])
|
|
// 2) Attach XJC output only to the test source sets via lazy providers.
|
|
sourceSets.test.java.srcDir(tasks.named("xjc", XjcTask).flatMap { it.outputJavaDir })
|
|
sourceSets.test.resources.srcDir(tasks.named("xjc", XjcTask).flatMap { it.outputResourcesDir })
|