should ```application { mainClass.set("com.exa...
# ktor
a
should
Copy code
application {
    mainClass.set("com.example.ApplicationKt")
}
and
Copy code
ktor {
    fatJar {
        archiveFileName.set("fat.jar")
    }
}
be placed in build.gradle or application.conf?
I put it in gradle.build, but it doesn't build the jar file:
a
Both should be placed in the
build.gradle.kts
file. What Gradle task have you launched to create the fat JAR?
a
I have just built it via IntelJ "Build Project" option, didn't realize that i need to run it by a task, now when I use buildFatJar task i get:
Copy code
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.
shared module contain just util classes/files:
Copy code
plugins {
    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)
}
When i build the project using ./gradlew build this is what i get:
Copy code
> 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.
this is my java-conventions file: https://pastebin.com/D13NHna1
a
I think if the
shadowJar
task is executed from the
shared
module then the main class must be defined in the corresponding
build.gradle.kts
file.
a
I have added
Copy code
application {
    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