mudasar187
01/06/2025, 10:20 AMmudasar187
01/06/2025, 10:21 AM./gradlew clean build shadowJar --warning-mode all
Calculating task graph as no cached configuration is available for tasks: clean build shadowJar
> Configure project :
Calling configuration method 'attributes(Action)' is deprecated for configuration 'kover', which has permitted usage(s):
Declarable - this configuration can have dependencies added to it
This method is only meant to be called on configurations which allow the (non-deprecated) usage(s): 'Consumable, Resolvable'. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: <https://docs.gradle.org/8.11/userguide/upgrading_version_8.html#deprecated_configuration_usage>
> Task :shadowJar
The FileTreeElement.getMode() method has been deprecated. This is scheduled to be removed in Gradle 9.0. Please use the getPermissions() method instead. Consult the upgrading guide for further information: <https://docs.gradle.org/8.11/userguide/upgrading_version_8.html#unix_file_permissions_deprecated>
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> Task :test
no.nav.sokos.prosjektnavn.security.SecurityTest > test http GET endepunkt uten token bør returnere 401 PASSED
no.nav.sokos.prosjektnavn.security.SecurityTest > test http GET endepunkt med token bør returnere 200 PASSED
> Task :koverHtmlReport
Kover: HTML report for ':' file:///Users/mudasar/Documents/Github/sokos-ktor-template/build/reports/kover/html/index.html
[Incubating] Problems report is available at: file:///Users/mudasar/Documents/Github/sokos-ktor-template/build/reports/problems/problems-report.html
BUILD SUCCESSFUL in 15s
25 actionable tasks: 25 executed
Configuration cache entry stored.
Successfully build but with warning.mudasar187
01/06/2025, 10:21 AM./gradlew clean build shadowJar --warning-mode all
Calculating task graph as configuration cache cannot be reused because file 'build.gradle.kts' has changed.
> Configure project :
Calling configuration method 'attributes(Action)' is deprecated for configuration 'kover', which has permitted usage(s):
Declarable - this configuration can have dependencies added to it
This method is only meant to be called on configurations which allow the (non-deprecated) usage(s): 'Consumable, Resolvable'. This behavior has been deprecated. This behavior is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: <https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#deprecated_configuration_usage>
> Task :test FAILED
[Incubating] Problems report is available at: file:///Users/mudasar/Documents/Github/sokos-ktor-template/build/reports/problems/problems-report.html
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> java.io.FileNotFoundException: /Users/mudasar/Documents/Github/sokos-ktor-template/build/tmp/test/kover-agent.args (No such file or directory)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
BUILD FAILED in 2s
20 actionable tasks: 5 executed, 15 from cache
Configuration cache entry stored.
Build failed.mudasar187
01/06/2025, 10:22 AMbuild.gradle.kts
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
id("org.jetbrains.kotlinx.kover") version "0.9.0"
}
group = "no.nav.sokos"
repositories {
mavenCentral()
maven { url = uri("<https://maven.pkg.jetbrains.space/public/p/ktor/eap>") }
}
val ktorVersion = "3.0.3"
val logbackVersion = "1.5.15"
val logstashVersion = "8.0"
val micrometerVersion = "1.14.2"
val kotlinLoggingVersion = "3.0.5"
val janionVersion = "3.1.12"
val natpryceVersion = "1.6.10.0"
val kotestVersion = "5.9.1"
val kotlinxSerializationVersion = "1.7.3"
val mockOAuth2ServerVersion = "2.1.10"
val mockkVersion = "1.13.14"
dependencies {
// Ktor server
implementation("io.ktor:ktor-server-call-logging-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-call-id-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-swagger:$ktorVersion")
// Ktor client
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-apache-jvm:$ktorVersion")
// Security
implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jwt-jvm:$ktorVersion")
// Serialization
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$kotlinxSerializationVersion")
// Monitorering
implementation("io.ktor:ktor-server-metrics-micrometer-jvm:$ktorVersion")
implementation("io.micrometer:micrometer-registry-prometheus:$micrometerVersion")
// Logging
implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")
runtimeOnly("org.codehaus.janino:janino:$janionVersion")
runtimeOnly("ch.qos.logback:logback-classic:$logbackVersion")
runtimeOnly("net.logstash.logback:logstash-logback-encoder:$logstashVersion")
// Config
implementation("com.natpryce:konfig:$natpryceVersion")
// Test
testImplementation("io.ktor:ktor-server-test-host-jvm:$ktorVersion")
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("no.nav.security:mock-oauth2-server:$mockOAuth2ServerVersion")
}
// Vulnerability fix because of id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
configurations.ktlint {
resolutionStrategy.force("ch.qos.logback:logback-classic:$logbackVersion")
}
sourceSets {
main {
java {
srcDirs("${layout.buildDirectory.get()}/generated/src/main/kotlin")
}
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks {
withType<KotlinCompile>().configureEach {
dependsOn("ktlintFormat")
}
withType<ShadowJar>().configureEach {
enabled = true
archiveFileName.set("app.jar")
manifest {
attributes["Main-Class"] = "no.nav.sokos.prosjektnavn.ApplicationKt"
}
finalizedBy(koverHtmlReport)
}
("jar") {
enabled = false
}
withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
reports.forEach { report -> report.required.value(false) }
}
withType<Wrapper> {
gradleVersion = "8.11"
}
}