buildscript {
    ext {
        springBootVersion = '2.2.6.RELEASE'
        springBootDependenciesVersion = '1.0.8.RELEASE'
    }

    repositories {
        maven { url 'https://repo.spring.io/milestone' }
        mavenCentral()
    }

    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
        classpath "io.spring.gradle:dependency-management-plugin:${springBootDependenciesVersion}"
    }
}

allprojects {
    repositories {
        maven { url 'https://repo.spring.io/milestone' }
        mavenCentral()
    }
}

subprojects {
    project.ext {
        camelVersion = '3.1.0'
        springBootVersion = '2.2.6.RELEASE'
        springBootDependenciesVersion = '2.2.6.RELEASE'
        fasterxmlJacksonVersion = '2.10.0'
        apacheCommonsCollectionsVersion = '4.4'
        apacheCommonsLangVersion = '3.9'
        jsoupVersion = '1.13.1'
        flywaydbVersion = '6.3.3'
    }

    group = 'com.bvn13.covid19'
    version = '0.1.2'

    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        maven { url 'https://repo.spring.io/milestone' }
        mavenCentral()
    }

    dependencyManagement {
        imports {
            mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
        }
    }

    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
    }

    configurations {
        compileOnly {
            extendsFrom annotationProcessor
        }
    }

    dependencies {
        annotationProcessor 'org.projectlombok:lombok'
        compileOnly 'org.projectlombok:lombok'

        testImplementation('org.springframework.boot:spring-boot-starter-test') {
            exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
        }

        // https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
        implementation "org.apache.commons:commons-collections4:${apacheCommonsCollectionsVersion}"

        // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
        implementation "org.apache.commons:commons-lang3:${apacheCommonsLangVersion}"

    }

    test {
        useJUnitPlatform()

        testLogging {
            events 'started', 'passed', 'failed', 'skipped', 'standard_out', 'standard_error'
        }
    }

}

defaultTasks('clean', 'compileTestJava', 'jar')
