Skip to content

Instantly share code, notes, and snippets.

@aaukhatov
Created June 2, 2017 08:25
Show Gist options
  • Save aaukhatov/f7b0a7b58602d6ed73b3b03e4ed86e9b to your computer and use it in GitHub Desktop.
Save aaukhatov/f7b0a7b58602d6ed73b3b03e4ed86e9b to your computer and use it in GitHub Desktop.
FileManager web-service
buildscript {
repositories {
maven {
url = "http://jerry-vrt.nsd.ru:8081/artifactory/repo"
}
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'org.springframework.boot'
repositories {
jcenter()
mavenCentral()
maven {
url = artifactory_url
}
}
sourceSets {
integrationTest {
compileClasspath += sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}
checkstyle {
toolVersion = checkstyle_version
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
compile.exclude module: 'commons-logging'
//compile.exclude module: 'spring-boot-starter-tomcat'
jaxws
}
dependencies {
//Spring
compile "org.springframework:spring-jdbc:$spring_verions"
// Spring
compile ("org.springframework.boot:spring-boot-starter-web:$spring_boot_version") {
exclude module: 'spring-boot-starter-tomcat'
}
compile ("org.springframework.cloud:spring-cloud-starter-sleuth:$spring_boot_sleuth_version") {
exclude module: 'spring-boot-starter-tomcat'
}
// Database
compile "com.zaxxer:HikariCP:$hikari_version"
runtime "com.oracle:ojdbc:$oracle_version"
// Misc
compile "org.apache.commons:commons-lang3:$apache_commons_lang_version"
compile "commons-io:commons-io:$apache_commons_io_version"
// Swagger
compile "io.springfox:springfox-swagger2:$springfox_swagger_version"
compile "io.springfox:springfox-swagger-ui:$springfox_swagger_version"
// Servlet
providedCompile "javax.servlet:javax.servlet-api:$java_servlet_version"
testCompile "junit:junit:$junit_version"
testCompile "org.mockito:mockito-core:$mockito_version"
testCompile "org.springframework.boot:spring-boot-starter-test:$spring_boot_version"
testCompile "org.springframework.boot:spring-boot-starter-tomcat:$spring_boot_version"
jaxws "com.sun.xml.ws:jaxws-tools:$jax_ws_version"
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
task buildWar(type: War) {
classpath = configurations.runtime - configurations.providedRuntime
version = System.getProperty('build.number')
webInf {
into('classes') {
from sourceSets.main.output
}
}
baseName = 'alameda-file-manager-ws'
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': version ?: 'undefined']
}
}
task integrationTest(type: Test, dependsOn: ['integrationTestClasses'], description: 'Run integration tests') {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}
/**
* Для работы с потоковой передачей некоторые поля Payload классов заменили на DataHandler вместо byte[]
* При повторной генерации классов из WSDL эти поля снова станут byte[]
*/
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")
}
}
}
}
tasks.withType(Checkstyle) {
exclude('**/soa/**')
maxWarnings = 0
}
tasks.withType(FindBugs) {
exclude('**/soa/**')
reports {
xml.enabled false
html.enabled true
}
}
task wrapper(type: Wrapper) {
gradleVersion = gradle_version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment