Created
August 9, 2019 16:39
-
-
Save Gueka/836e807a7104dc4800181b8c5d09cf7f to your computer and use it in GitHub Desktop.
Gradle example to create a SOAP web service with spring boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
ext { | |
jaxbVersion = '2.3.2' | |
wsdlVersion = '1.6.3' | |
junitVersion = '5.3.2' | |
} | |
} | |
plugins { | |
id 'org.springframework.boot' version '2.1.3.RELEASE' | |
id 'java' | |
} | |
apply plugin: 'io.spring.dependency-management' | |
group = 'net.gueka' | |
version = '0.0.1-SNAPSHOT' | |
sourceCompatibility = '1.8' | |
configurations { | |
compileOnly { | |
extendsFrom annotationProcessor | |
} | |
jaxb | |
} | |
repositories { | |
mavenCentral() | |
maven { url 'https://repo.spring.io/snapshot' } | |
maven { url 'https://repo.spring.io/milestone' } | |
} | |
task genJaxb { | |
ext.sourcesDir = "${buildDir}/generated-sources/jaxb" | |
ext.classesDir = "${buildDir}/classes/jaxb" | |
ext.schema = "src/main/resources/promo.xsd" | |
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) { | |
arg(value: "-wsdl") | |
produces(dir: sourcesDir, includes: "**/*.java") | |
} | |
javac(destdir: classesDir, source: 1.6, target: 1.6, 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") | |
} | |
} | |
} | |
} | |
} | |
bootJar { | |
from genJaxb.classesDir | |
} | |
dependencies { | |
implementation "org.springframework.boot:spring-boot-starter-web-services" | |
testImplementation "org.springframework.boot:spring-boot-starter-test" | |
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" | |
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" | |
testImplementation "org.hamcrest:java-hamcrest:2.0.0.0" | |
compile "wsdl4j:wsdl4j:${wsdlVersion}" | |
jaxb "org.glassfish.jaxb:jaxb-xjc:${jaxbVersion}" | |
compile files(genJaxb.classesDir).builtBy(genJaxb) | |
annotationProcessor "org.projectlombok:lombok" | |
compileOnly "org.projectlombok:lombok" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment