Skip to content

Instantly share code, notes, and snippets.

@xymor
Created January 24, 2019 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xymor/6e66a7bc73c8029a1ff8155ef311de47 to your computer and use it in GitHub Desktop.
Save xymor/6e66a7bc73c8029a1ff8155ef311de47 to your computer and use it in GitHub Desktop.
kotlin gradle idea
import java.text.SimpleDateFormat
buildscript {
ext.kotlin_version = '1.3.11'
ext.spek_version = '1.0.9'
ext.junit_runner_version = '1.0.0-M3'
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://dl.bintray.com/fyber/maven" }
maven { url "https://artifacts.alfresco.com/nexus/content/repositories/public/" }
}
dependencies {
classpath group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.1'
classpath group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.1'
classpath group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
classpath 'de.idealo.logback:logback-redis:0.9.3'
classpath group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.8'
classpath group: 'ch.qos.logback', name: 'logback-core', version: '1.1.8'
classpath group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '4.8'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.2.RELEASE'
//classpath 'com.sourcemuse.gradle.plugin:gradle-mongo-plugin:0.14.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "net.saliman:gradle-cobertura-plugin:2.3.2"
classpath "gradle.plugin.com.jandyco:test-results:0.1.0"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '2.0.0'
classpath group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.3.1'
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
classpath 'com.craigburke.gradle:client-dependencies:1.4.1'
classpath 'com.jcraft:jsch:0.1.44-1'
}
}
//apply plugin: "com.jandyco.test-results"
//apply plugin: 'org.springframework.boot'
//apply plugin: 'org.springframework.boot.gradle.plugin.SpringBootPlugin'
apply plugin: "application"
//apply plugin: "net.saliman.cobertura"
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'
//apply plugin: 'mongo'
apply plugin: 'kotlin'
apply plugin: "com.gorylenko.gradle-git-properties"
apply plugin: "kotlin-allopen"
apply plugin: "kotlin-spring"
apply plugin: "io.spring.dependency-management"
apply plugin: "com.craigburke.client-dependencies"
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
allOpen {
//annotation("com.your.Annotation")
}
group = 'hydra.treasure.api'
description = """"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven { url "https://repo.spring.io/libs-release" }
maven { url "http://repo.maven.apache.org/maven2" }
jcenter()
maven { url "http://repository.jetbrains.com/all" }
}
dependencies {
testCompile sourceSets.main.output
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.1'
//compile.exclude 'ch.qos.logback:logback-*:1.1.7'
compile 'de.idealo.logback:logback-redis:0.9.3'
//compile 'org.springframework.amqp:spring-rabbit:1.6.6.RELEASE'
//compile 'org.springframework.amqp:spring-amqp:1.6.6.RELEASE'
compile 'org.springframework.data:spring-data-mongodb:2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '2.1.2.RELEASE'
compile "org.springframework.boot:spring-boot-starter-actuator"
compile 'org.springframework.data:spring-data-redis:1.7.6.RELEASE'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.1.2.RELEASE'
testCompile group: 'org.springframework.security', name: 'spring-security-test', version: '4.0.0.M1'
compile 'redis.clients:jedis:2.8.2'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.8'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.8'
compile group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '4.8'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.8.6'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.8.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6'
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.8.6"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.6"
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'org.apache.poi', name: 'poi', version: '3.16'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.16'
//compile group: 'io.javaslang', name: 'javaslang', version:'2.0.2'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "org.jetbrains.spek:spek:$spek_version"
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '2.0.0'
testCompile group: 'cz.jirutka.spring', name: 'embedmongo-spring', version: '1.3.1'
compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity4', version: '2.1.2.RELEASE'
//compile group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-java8time', version: '2.1.0.RELEASE'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.github.salomonbrys.kotson:kotson:2.3.0"
compile 'com.github.kittinunf.fuel:fuel:1.3.1'
compile 'com.hazelcast:hazelcast:3.7.4'
compile group: 'com.hazelcast', name: 'hazelcast-aws', version: '2.1.0'
compile 'com.amazonaws:aws-java-sdk-s3'
compile group: 'com.jcraft', name: 'jsch', version: '0.1.44-1'
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.228'
}
}
sourceSets {
main.kotlin.srcDirs += 'src/main/kotlin'
}
idea.module.inheritOutputDirs = true
compileJava {
options.encoding = 'UTF-8'
//options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
task sass(type: Exec) {
executable "sh"
args "-c", "sass src/main/resources/static/css/application.scss src/main/resources/static/css/application.css"
}
gitProperties {
gitRepositoryRoot = new File("${project.rootDir}/..")
}
task unit( type: Test ) {
exclude "**/**IntegrationTests.class"
}
task integration( type: Test ) {
include '**/**IntegrationTests.class'
exclude "**/**GroupedIntegrationTests.class"
}
task grouped( type: Test ) {
include '**/**GroupedIntegrationTests.class'
}
war {
def bambooVersion = System.getenv("bamboo.deploy.release") ?: "$version"
def verText = "Version: $bambooVersion<br/>Buildtime: ${new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date())}"
new File("$projectDir/src/main/resources/templates/version.html").text = verText
archiveName = "tesouraria.war"
rootSpec.exclude("**/tomcat-embed*.jar")
from ('./src/main/resources/.ebextensions') {
into '/.ebextensions'
}
}
//cobertura {
// coverageFormats = ['html', 'xml']
// coverageExcludes = ['.*hydra.treasure.api.util.*']
// coverageIgnoreTrivial = true
//}
bootRun {
systemProperties = System.properties
main = 'hydra.treasure.api.Application'
}
processResources {
dependsOn clientInstall
}
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed"//, "standardOut"
showExceptions true
exceptionFormat "short"
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
clientDependencies {
installDir = 'src/main/resources/static/assets/'
npm {
'angular'('1.6.9')
'angular-animate'('1.6.9')
'ngprogress'('1.1.1')
'angular-resource'('1.6.9')
'angularjs-toaster'('2.2.0')
'angular-input-masks'('4.1.0')
'angular-paging'('2.2.2')
'angular-tooltips'('1.2.2')
'ng-mask'('3.1.1')
'ng-currency'('1.2.4')
'ng-dialog'('1.4.0')
'bootstrap'('3.3.6')
'jquery'('2.1.4')
'jquery-mask-plugin'('1.14.0')
'jquery-maskmoney'('3.0.2')
'jquery-number'('2.1.6')
'jquery-query-object'('2.2.3')
'jquery-ui-dist'('1.12.1')
'lodash'('4.17.5')
'toastr'('2.1.4')
'ng-table-to-csv'('0.3.3')
'font-awesome'('4.7.0')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment