diff --git a/build.gradle.kts b/build.gradle.kts index 132a63d..51ad854 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,6 +18,10 @@ repositories { val kotlinVersion = "1.3.60" +java { + targetCompatibility = JavaVersion.VERSION_11 +} + // Add plugins used in buildSrc as dependencies, also we should specify version only here dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") @@ -73,7 +77,6 @@ publishing { // Process each publication we have in this project publications.filterIsInstance().forEach { publication -> - @Suppress("UnstableApiUsage") publication.pom { name.set(project.name) description.set(project.description) diff --git a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt b/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt index 23a6427..debf50d 100644 --- a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt @@ -1,8 +1,11 @@ package scientifik +import Scientifik +import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.JavaBasePlugin +import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.bundling.Jar @@ -20,9 +23,13 @@ open class ScientifikJVMPlugin : Plugin { repositories.applyRepos() + extensions.findByType()?.apply { + targetCompatibility = JavaVersion.VERSION_11 + } + tasks.withType { kotlinOptions { - jvmTarget = "11" + jvmTarget = Scientifik.JVM_VERSION } } diff --git a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt b/src/main/kotlin/scientifik/ScientifikMPPlugin.kt index 2c4e218..31cc0d5 100644 --- a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt +++ b/src/main/kotlin/scientifik/ScientifikMPPlugin.kt @@ -1,5 +1,6 @@ package scientifik +import Scientifik import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.JavaBasePlugin @@ -27,7 +28,7 @@ open class ScientifikMPPlugin : Plugin { jvm { compilations.all { kotlinOptions { - jvmTarget = "11" + jvmTarget = Scientifik.JVM_VERSION } } }