buildscript {
    repositories {
        mavenCentral()
    }
}

plugins {
    id 'com.github.ben-manes.versions' version '0.51.0'
    id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
    id 'io.spring.dependency-management' version '1.1.6'
    id 'org.sonarqube' version '4.0.0.2929'
    id 'pl.allegro.tech.build.axion-release' version '1.18.4'
    id 'publishing'
}

repositories {
    mavenCentral()
}

scmVersion {
    tag {
        prefix = ''
    }
}

group = 'com.epages'

allprojects {
    project.version = scmVersion.version
}

subprojects {
    apply plugin: 'io.spring.dependency-management'
    apply plugin: 'jacoco'
    apply plugin: 'java'
    apply plugin: 'maven-publish'
    apply plugin: 'signing'

    repositories {
        mavenCentral()
    }

    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21

    task sourceJar(type: Jar) {
        from sourceSets.main.allJava
    }

    java {
        withSourcesJar()
        withJavadocJar()
    }

    javadoc {
        options.addStringOption('Xdoclint:none', '-quiet')
    }

    jacocoTestReport {
        reports {
            xml.required = true
            html.required = true
        }
    }
    test.finalizedBy jacocoTestReport
}

nexusPublishing {
    repositories {
        sonatype {
            nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
            snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
        }
    }
}

sonarqube {
  properties {
    property "sonar.projectKey", "ePages-de_restdocs-wiremock"
    property "sonar.organization", "epages-de"
    property "sonar.host.url", "https://sonarcloud.io"
  }
}
