-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathspring-oxm.gradle
145 lines (124 loc) · 4.31 KB
/
spring-oxm.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
description = "Spring Object/XML Marshalling"
configurations {
castor
jibx
xjc
}
dependencies {
castor "org.codehaus.castor:castor-anttasks:1.4.1"
jibx "org.jibx:jibx-bind:1.3.1"
jibx "org.apache.bcel:bcel:6.0"
xjc "javax.xml.bind:jaxb-api:2.3.1"
xjc "com.sun.xml.bind:jaxb-core:2.3.0.1"
xjc "com.sun.xml.bind:jaxb-impl:2.3.0.1"
xjc "com.sun.xml.bind:jaxb-xjc:2.3.1"
xjc "com.sun.activation:javax.activation:1.2.0"
}
ext.genSourcesDir = "${buildDir}/generated-sources"
ext.flightSchema = "${projectDir}/src/test/resources/org/springframework/oxm/flight.xsd"
task genCastor {
def orderSchema = "${projectDir}/src/test/resources/org/springframework/oxm/order.xsd"
def castorBuilderProperties = "${projectDir}/src/test/castor/castorbuilder.properties"
ext.sourcesDir = "${genSourcesDir}/castor"
ext.classesDir = "${buildDir}/classes/castor"
inputs.files flightSchema, orderSchema, castorBuilderProperties
outputs.dir classesDir
doLast() {
project.ant {
taskdef name: "castor", classname: "org.castor.anttask.CastorCodeGenTask",
classpath: configurations.castor.asPath
mkdir(dir: sourcesDir)
mkdir(dir: classesDir)
castor(types: "j2", warnings: false, file: flightSchema, todir: sourcesDir,
package: "org.springframework.oxm.castor", properties: castorBuilderProperties)
castor(types: "j2", warnings: false, file: orderSchema, todir: sourcesDir,
package: "org.springframework.oxm.castor", properties: castorBuilderProperties)
javac(destdir: classesDir, source: 1.8, target: 1.8, debug: true,
debugLevel: "lines,vars,source", classpath: configurations.castor.asPath) {
src(path: sourcesDir)
include(name: "**/*.java")
include(name: "*.java")
}
copy(todir: classesDir) {
fileset(dir: sourcesDir, erroronmissingdir: false) {
exclude(name: "**/*.java")
}
}
}
}
}
task genJaxb {
ext.sourcesDir = "${genSourcesDir}/jaxb"
ext.classesDir = "${buildDir}/classes/jaxb"
inputs.files flightSchema
outputs.dir classesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask",
classpath: configurations.xjc.asPath
mkdir(dir: sourcesDir)
mkdir(dir: classesDir)
xjc(destdir: sourcesDir, schema: flightSchema,
package: "org.springframework.oxm.jaxb.test") {
produces(dir: sourcesDir, includes: "**/*.java")
}
javac(destdir: classesDir, source: 1.8, target: 1.8, debug: true,
debugLevel: "lines,vars,source",
classpath: configurations.xjc.asPath) {
src(path: sourcesDir)
include(name: "**/*.java")
include(name: "*.java")
}
copy(todir: classesDir) {
fileset(dir: sourcesDir, erroronmissingdir: false) {
exclude(name: "**/*.java")
}
}
}
}
}
dependencies {
compile(project(":spring-beans"))
compile(project(":spring-core"))
optional("javax.xml.bind:jaxb-api:2.3.1")
optional("javax.activation:javax.activation-api:1.2.0")
optional("org.codehaus.castor:castor-xml:1.4.1") {
exclude group: "stax", module: "stax-api"
exclude group: "org.springframework", module: "spring-context"
exclude group: "commons-logging", module: "commons-logging"
}
optional("com.thoughtworks.xstream:xstream:1.4.11.1") {
exclude group: "xpp3", module: "xpp3_min"
exclude group: "xmlpull", module: "xmlpull"
}
optional("org.jibx:jibx-run:1.3.1")
testCompile(project(":spring-context"))
testCompile("org.ogce:xpp3:1.1.6")
testCompile("org.codehaus.jettison:jettison:1.3.8") {
exclude group: "stax", module: "stax-api"
}
testCompile(files(genCastor.classesDir).builtBy(genCastor))
testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
testCompile("org.xmlunit:xmlunit-matchers:2.6.2")
testRuntime("xerces:xercesImpl:2.11.0") // for Castor
testRuntime("com.sun.xml.bind:jaxb-core:2.3.0.1")
testRuntime("com.sun.xml.bind:jaxb-impl:2.3.0.1")
}
// JiBX compiler is currently not compatible with JDK 9
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
compileTestJava {
def bindingXml = "${projectDir}/src/test/resources/org/springframework/oxm/jibx/binding.xml"
doLast() {
project.ant {
taskdef(name: "jibx",
classname: "org.jibx.binding.ant.CompileTask",
classpath: configurations.jibx.asPath)
jibx(verbose: true, load: true, binding: bindingXml) {
classpathset(dir: sourceSets.test.java.outputDir) {
include(name: "**/jibx/**/*")
}
}
}
}
}
}