Is there a way in kotlin to compile just the stuff...
# announcements
g
Is there a way in kotlin to compile just the stuff that's relative to one class? Like if I got DB svr and web svr code in the same codebase and I wanna compile the stuff into separate fat people, I mean fat jars?
m
You’ll have to organize your code in different modules, so when packaging you will have separate jars (a fat jar is an archive comprising ALL the project classes and all dependencies together). It’s not a trait particular to Kotlin, rather of the build tool.
g
So... I'm using ktor so these are my modules right?
Copy code
val env = applicationEngineEnvironment {
    module {
        commonFeatures()
        webService()
        apiService()
    }
    ...
    ...
    ...
}
Here is my fat jar task in gradle... but what does a module look like?
Copy code
register<Jar>("buildFatJar") {
    group = "app-web"
    dependsOn(build)
    manifest {
        attributes["Main-Class"] = "com.app.BackendAppKt"
    }
    into("$buildDir/libs"){
        from(configurations.getByName("compileClasspath").map { if (it.isDirectory) it else zipTree(it) })
        from(main.output.classesDirs)
    }
    with(jar.get() as CopySpec)
    archiveBaseName.set("${project.name}-fat")
}
m
Oh… maybe you’re confusing Ktor modules with project modules? Try asking for specific help either in #ktor or #gradle
g
Thanks 😃, as long as I know its possible! Every company has different modules, lol