buildscript {
    ext {
        springBootVersion = '1.5.9.RELEASE'
    }
    repositories {
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath "io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE"
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
    }
}

plugins {
    id "com.gorylenko.gradle-git-properties" version "1.4.17"
    id "org.sonarqube" version "2.6.1"
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
apply plugin: "org.sonarqube"
apply plugin: "jacoco"

springBoot {
    executable = true
}

def application_name = 'voter-service'
def major = '0.6'
def minor = System.env.TRAVIS_BUILD_NUMBER ?: '0'
def artifact_version = major + '.' + minor

jar {
    baseName = application_name
    version = artifact_version
}

sourceCompatibility = 1.8

repositories {
    jcenter()
}

dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-actuator-docs'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-amqp'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-hateoas'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
    compile group: 'org.webjars', name: 'hal-browser'
    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Edgware.RELEASE"
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.4.1'
}

test {
    testLogging {
        events "passed", "skipped", "failed", "standardOut", "standardError"
        exceptionFormat "full"
    }
}
