import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.jvm.toolchain.JavaLanguageVersion

plugins {
	kotlin("jvm") apply false
	kotlin("plugin.spring") apply false
	kotlin("plugin.jpa") apply false
	kotlin("plugin.lombok") apply false
	id("org.springframework.boot") apply false
	id("io.spring.dependency-management") apply false
	//id("org.sonarqube") apply false
}


allprojects {
	group = "space.nstart.pcp"
	ext.set("kotlinVersion", "2.2.20")
	repositories {
//		maven {
//			url = uri("https://repo.nstart.cloud/repository/maven-proxy/")
//		}
		mavenCentral {
			content {
				includeGroup("org.jacoco")
				includeGroup("org.ow2.asm")
			}
		}
		mavenCentral()
		mavenLocal()
		gradlePluginPortal()
		maven { url = uri("https://jitpack.io") }

		exclusiveContent {
			forRepository {
				maven("https://repo.osgeo.org/repository/release/")
			}
			filter {
				includeGroup("org.geotools")
				includeGroup("org.geotools.ogc")
				includeGroup("javax.media")
				includeGroup("it.geosolutions.jgridshift")
			}
		}


	}
}

subprojects {
	plugins.withId("java") {
		extensions.configure<JavaPluginExtension> {
			toolchain {
				languageVersion = JavaLanguageVersion.of((property("versions.java") as String).toInt())
			}
		}
	}

	plugins.withId("org.springframework.boot") {
		if (
			path != ":services:pcp-srpring-boot-admin-server" &&
			path != ":services:spring-cloud-config-server"
		) {
			dependencies.add(
				"implementation",
				"de.codecentric:spring-boot-admin-starter-client:${property("versions.spring.boot.admin")}"
			)
		}
	}
}
