85 lines
1.9 KiB
Groovy
85 lines
1.9 KiB
Groovy
plugins {
|
|
id 'org.springframework.boot' version '2.7.1'
|
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
|
id 'java'
|
|
}
|
|
|
|
group = 'com.example'
|
|
version = '0.0.1-SNAPSHOT'
|
|
sourceCompatibility = '1.8'
|
|
|
|
// tag::configurations[]
|
|
configurations {
|
|
jaxb
|
|
}
|
|
// end::configurations[]
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
// tag::wsdl[]
|
|
task genJaxb {
|
|
ext.sourcesDir = "${buildDir}/generated-sources/jaxb"
|
|
ext.classesDir = "${buildDir}/classes/jaxb"
|
|
ext.schema = "http://localhost:8080/ws/countries.wsdl"
|
|
|
|
outputs.dir classesDir
|
|
|
|
doLast() {
|
|
project.ant {
|
|
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask",
|
|
classpath: configurations.jaxb.asPath
|
|
mkdir(dir: sourcesDir)
|
|
mkdir(dir: classesDir)
|
|
|
|
xjc(destdir: sourcesDir, schema: schema,
|
|
package: "com.example.consumingwebservice.wsdl") {
|
|
arg(value: "-wsdl")
|
|
produces(dir: sourcesDir, includes: "**/*.java")
|
|
}
|
|
|
|
javac(destdir: classesDir, source: 1.8, target: 1.8, debug: true,
|
|
debugLevel: "lines,vars,source",
|
|
classpath: configurations.jaxb.asPath) {
|
|
src(path: sourcesDir)
|
|
include(name: "**/*.java")
|
|
include(name: "*.java")
|
|
}
|
|
|
|
copy(todir: classesDir) {
|
|
fileset(dir: sourcesDir, erroronmissingdir: false) {
|
|
exclude(name: "**/*.java")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// end::wsdl[]
|
|
|
|
dependencies {
|
|
// tag::dependency[]
|
|
implementation ('org.springframework.boot:spring-boot-starter-web-services') {
|
|
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
|
|
}
|
|
implementation 'org.springframework.ws:spring-ws-core'
|
|
// For Java 11:
|
|
implementation 'org.glassfish.jaxb:jaxb-runtime'
|
|
implementation(files(genJaxb.classesDir).builtBy(genJaxb))
|
|
|
|
jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"
|
|
// end::dependency[]
|
|
testImplementation('org.springframework.boot:spring-boot-starter-test')
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
// tag::bootjar[]
|
|
bootJar {
|
|
baseName = 'gs-consuming-web-service'
|
|
version = '0.0.1'
|
|
}
|
|
// end::bootjar[]
|