Skip to content

Instantly share code, notes, and snippets.

@aaukhatov
Last active February 7, 2017 11:49
Show Gist options
  • Save aaukhatov/2f9a2d7f4bed5ec44d03ebe0e4687b4e to your computer and use it in GitHub Desktop.
Save aaukhatov/2f9a2d7f4bed5ec44d03ebe0e4687b4e to your computer and use it in GitHub Desktop.
Gradle build web service script
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
maven {
url = artifactory_url
}
mavenLocal()
}
war {
baseName = 'project-name'
manifest {
attributes << [
'Build-by': System.getProperty('user.name'),
'JDK-version': System.getProperty('java.version'),
'JDK-vendor': System.getProperty('java.vendor'),
'Build-date': new Date(),
'Implementation-Version': System.getProperty('build.number') ?: 'undefined']
}
}
def springVersion = '4.3.6.RELEASE'
def jacksonVersion = '2.8.3'
def slf4jVersion = '1.7.21'
def logbackVersion = '1.1.7'
def servletVersion= '3.1.0'
def hikariVersion = '2.4.5'
def oracleVersion= '11.2.0.4'
def jUnitVersion = '4.11'
def mockitoVersion = '2.7.1'
configurations {
compile.exclude module: 'commons-logging'
jaxws
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
dependencies {
//Spring
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-jdbc:$springVersion"
// Database
compile "com.zaxxer:HikariCP:${hikariVersion}"
runtime "com.oracle:ojdbc:${oracleVersion}"
// JSON
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
compile "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
// Logging
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "ch.qos.logback:logback-classic:${logbackVersion}"
// Servlet
providedCompile "javax.servlet:javax.servlet-api:${servletVersion}"
testCompile "junit:junit:${jUnitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
jaxws 'com.sun.xml.ws:jaxws-tools:2.2.10'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}
task wsimport {
['ContentManagerFileService/FileServicePort?wsdl', '/ContentManagerDirService/DirServicePort?wsdl'].forEach { wsdl ->
doLast {
sourceSets.main.output.classesDir.mkdirs()
file("${projectDir}/src/main/java").mkdirs()
ant {
taskdef(name: 'wsimport',
classname: 'com.sun.tools.ws.ant.WsImport',
classpath: configurations.jaxws.asPath)
wsimport(keep: true,
destdir: sourceSets.main.output.classesDir,
sourcedestdir: "${projectDir}/src/main/java",
encoding: 'UTF-8',
wsdl: "http://172.23.31.135:27777/$wsdl")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment