85 lines
2.0 KiB
Groovy
85 lines
2.0 KiB
Groovy
configurations {
|
|
jaxb
|
|
}
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE")
|
|
}
|
|
}
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'org.springframework.boot'
|
|
apply plugin: 'io.spring.dependency-management'
|
|
|
|
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: "hello.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[]
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
dependencies {
|
|
compile("org.springframework.boot:spring-boot-starter")
|
|
compile("org.springframework.ws:spring-ws-core")
|
|
compile(files(genJaxb.classesDir).builtBy(genJaxb))
|
|
|
|
jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"
|
|
}
|
|
|
|
bootJar {
|
|
baseName = 'gs-consuming-web-service'
|
|
version = '0.1.0'
|
|
|
|
from genJaxb.classesDir
|
|
}
|
|
|
|
|
|
task afterEclipseImport {
|
|
dependsOn genJaxb
|
|
}
|