Antoni Zwolski
02/29/2024, 3:18 PMapplication {
mainClass.set("com.example.ApplicationKt")
}
and
ktor {
fatJar {
archiveFileName.set("fat.jar")
}
}
be placed in build.gradle or application.conf?Antoni Zwolski
02/29/2024, 3:21 PMAleksei Tirman [JB]
02/29/2024, 3:56 PMbuild.gradle.kts
file. What Gradle task have you launched to create the fat JAR?Antoni Zwolski
02/29/2024, 4:05 PMExecution failed for task ':modules:shared:shadowJar'.
> Error while evaluating property 'mainClassName' of task ':modules:shared:shadowJar'.
> Cannot query the value of extension 'application' property 'mainClass' because it has no value available.
Antoni Zwolski
02/29/2024, 4:09 PMplugins {
kotlin("jvm")
id("myproject.java-conventions")
}
group = "com.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
}
Antoni Zwolski
02/29/2024, 4:10 PM> Task :modules:shared:shadowJar FAILED
> Task :modules:chat-service:spotbugsMain
> Task :modules:chat-service:spotbugsMain FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':modules:shared:shadowJar'.
> Error while evaluating property 'mainClassName' of task ':modules:shared:shadowJar'.
> Cannot query the value of extension 'application' property 'mainClass' because it has no value available.
* 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>.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':modules:chat-service:spotbugsMain'.
> A failure occurred while executing com.github.spotbugs.snom.internal.SpotBugsRunnerForHybrid$SpotBugsExecutor
> Verification failed: SpotBugs ended with exit code 1.
Antoni Zwolski
02/29/2024, 4:12 PMAleksei Tirman [JB]
02/29/2024, 4:59 PMshadowJar
task is executed from the shared
module then the main class must be defined in the corresponding build.gradle.kts
file.Antoni Zwolski
02/29/2024, 9:16 PMapplication {
mainClass.set("io.ktor.server.netty.EngineMain")
}
to all my modules where I use ktor plugin. And it is working now. I thought it should be only in modules that actually contain a main function. Thank you @Aleksei Tirman [JB] I appreciate your engagement and help