Created
February 7, 2017 11:49
-
-
Save aaukhatov/9682230d318115727b3a7f0c3626f238 to your computer and use it in GitHub Desktop.
Gradle build script
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
plugins { | |
id "io.spring.dependency-management" version "0.5.7.RELEASE" | |
id "io.dcow.sublime" version "0.9.2" | |
id "org.akhikhl.gretty" version "1.2.4" | |
} | |
apply plugin: 'war' | |
apply plugin: 'idea' | |
apply plugin: 'eclipse-wtp' | |
sourceCompatibility = '1.7' | |
targetCompatibility = '1.7' | |
def build_number = System.getProperty('build.number') | |
if (build_number) version = build_number | |
sourceSets { | |
integrationTest { | |
compileClasspath += sourceSets.test.compileClasspath | |
runtimeClasspath += sourceSets.test.runtimeClasspath | |
} | |
} | |
repositories { | |
jcenter() | |
maven { | |
url = artifactory_url | |
} | |
mavenLocal() | |
} | |
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' | |
configurations { | |
compile.exclude group: 'commons-logging', module: 'commons-logging' | |
integrationTestCompile.extendsFrom testCompile | |
integrationTestRuntime.extendsFrom testRuntime | |
} | |
dependencyManagement { | |
imports { | |
mavenBom 'io.spring.platform:platform-bom:2.0.5.RELEASE' | |
} | |
} | |
dependencies { | |
def cxf_version = '3.1.6' | |
compile 'com.google.guava:guava:19.0' | |
compile 'org.springframework:spring-jdbc' | |
compile 'org.springframework:spring-web' | |
compile 'com.zaxxer:HikariCP:2.4.5' | |
compile "org.apache.cxf:cxf:$cxf_version" | |
compile "org.apache.cxf:cxf-rt-frontend-jaxrs:$cxf_version" | |
compile "org.apache.cxf:cxf-rt-rs-service-description:$cxf_version" | |
compile 'commons-lang:commons-lang:2.6' | |
compile 'org.slf4j:slf4j-api:1.7.5' | |
compile 'com.micex:CryptoServerLibrary:20120716' | |
compile 'com.micex:jarapac:20120716' | |
compile 'com.micex:ncacn_ip_tcp:20120716' | |
compile 'org.samba.jcifs:jcifs:1.2.19' | |
compile 'javax.validation:validation-api' | |
compile 'com.thoughtworks.paranamer:paranamer:2.8' | |
compile 'javax.inject:javax.inject:1' | |
// логгирование через logback | |
compile 'ch.qos.logback:logback-classic' | |
runtime 'org.codehaus.janino:janino' | |
runtime 'org.slf4j:jcl-over-slf4j' | |
// провайдеры для CXF | |
runtime "org.apache.cxf:cxf-rt-rs-extension-providers:$cxf_version" | |
// JSON Marshalling | |
runtime 'org.codehaus.jettison:jettison:1.3.4' | |
runtime 'org.hibernate:hibernate-validator' | |
// кэширование | |
compile 'net.sf.ehcache:ehcache-web:2.0.4' | |
// тесты | |
testCompile 'junit:junit' | |
testCompile 'org.springframework:spring-test' | |
testCompile 'xmlunit:xmlunit:1.5' | |
testCompile 'org.mockito:mockito-core' | |
testRuntime 'cglib:cglib-nodep:3.2.2' | |
integrationTestCompile 'org.apache.httpcomponents:httpclient:4.5.2' | |
integrationTestCompile 'org.codehaus.jettison:jettison:1.3.4' | |
integrationTestCompile 'com.fasterxml.jackson.core:jackson-core:2.7.3' | |
integrationTestCompile 'com.fasterxml.jackson.module:jackson-module-jsonSchema:2.7.0' | |
integrationTestCompile "com.github.fge:json-schema-validator:2.2.6" | |
// драйвер БД | |
runtime "com.oracle:ojdbc:$oracle_version" | |
// сервлет API | |
compile 'javax.servlet:servlet-api:2.5' | |
} | |
gretty { | |
port = 3434 | |
integrationTestTask = 'integrationTest' | |
} | |
task integrationTest(type: Test, dependsOn: ['integrationTestClasses'], description: 'Run integration tests') { | |
testClassesDir = sourceSets.integrationTest.output.classesDir | |
classpath = sourceSets.integrationTest.runtimeClasspath | |
outputs.upToDateWhen { false } | |
} | |
task buildWar(type: War) { | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/full_dev' | |
} | |
} | |
} | |
task fullDevWar(type: War) { | |
appendix = 'full_dev' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/full_dev' | |
} | |
} | |
} | |
task test2War(type: War) { | |
appendix = 'test2' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/test2' | |
} | |
} | |
} | |
task promWar(type: War) { | |
appendix = 'prom' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/prom' | |
} | |
} | |
} | |
task fullSuoWar(type: War) { | |
appendix = 'full_suo' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/full_suo' | |
} | |
} | |
} | |
task fullTestWar(type: War) { | |
appendix = 'full_test' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/full_test' | |
} | |
} | |
} | |
task devAtWar(type: War) { | |
appendix = 'dev_at' | |
classpath = configurations.runtime - configurations.providedRuntime | |
webInf { | |
into('classes') { | |
from sourceSets.main.output | |
exclude 'ws-alameda.properties' | |
} | |
into('classes') { | |
from 'conf/dev_at' | |
} | |
} | |
} | |
tasks.withType(War).each { warTask -> | |
warTask.manifest { | |
attributes( | |
'Build-by': System.getProperty('user.name'), | |
'JDK-version': System.getProperty('java.version'), | |
'JDK-vendor': System.getProperty('java.vendor') | |
) | |
if (build_number) { | |
attributes( | |
'Build-date': new Date(), | |
'Implementation-Version': build_number | |
) | |
} | |
} | |
} | |
eclipse { | |
project { | |
natures 'org.springframework.ide.eclipse.core.springnature' | |
buildCommand 'org.springframework.ide.eclipse.core.springbuilder' | |
} | |
wtp { | |
facet { | |
facet name: 'jst.web', version: '2.5' | |
facet name: 'jst.java', version: '1.7' | |
} | |
} | |
} | |
idea { | |
module { | |
scopes.TEST.plus += [ configurations.integrationTestCompile] | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment