Skip to content

Commit

Permalink
Remove unneeded method in build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarras committed Dec 17, 2024
1 parent 0412e4b commit c336961
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
import kotlin.jvm.optionals.getOrNull

plugins {
base
Expand Down Expand Up @@ -58,15 +57,13 @@ dependencies {
}

java {
val javaVersion = getVersionFromCatalog("java")
sourceCompatibility = JavaVersion.toVersion(javaVersion)
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.get())
}

kotlin {

jvmToolchain {
val javaVersion = getVersionFromCatalog("java")
languageVersion.set(JavaLanguageVersion.of(javaVersion))
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}

compilerOptions {
Expand Down Expand Up @@ -126,7 +123,7 @@ tasks.named<BootBuildImage>("bootBuildImage") {
}

spotless {
val ktlintVersion = getVersionFromCatalog("ktlintVersion")
val ktlintVersion = libs.versions.ktlintVersion.get()
kotlin {
ktlint(ktlintVersion)
licenseHeaderFile("FileHeader.txt")
Expand All @@ -136,15 +133,6 @@ spotless {
}
}

fun getVersionFromCatalog(lookup: String): String {
val versionCatalog: VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
return versionCatalog
.findVersion(lookup)
.getOrNull()
?.requiredVersion
?: throw GradleException("Version '$lookup' is not specified in the version catalog")
}

val nvdApiKey: String? = System.getenv("NVD_API_KEY") ?: properties["nvdApiKey"]?.toString()
val dependencyCheckExtension = extensions.findByType(DependencyCheckExtension::class.java)
dependencyCheckExtension?.apply {
Expand Down

0 comments on commit c336961

Please sign in to comment.