Hi, I have a KVision project I'm trying to create ...
# kvision
m
Hi, I have a KVision project I'm trying to create a jar for, but the shadowJar task isn't being included. When I look at one of the demo projects for ktor (addressbook-fullstack-ktor) and print the taskinfo tree I see:
Copy code
:jar                                                                                                  (org.gradle.api.tasks.bundling.Jar)
+--- :classes                                                                                         (org.gradle.api.DefaultTask)
| ... removed for clarity
+--- :compileJava                                                                                     (org.gradle.api.tasks.compile.JavaCompile)
`--- :shadowJar                                                                                       (org.gradle.api.tasks.bundling.Jar)
     +--- :jsArchive                                                                                  (org.gradle.api.tasks.bundling.Jar)
     |    `--- :jsBrowserDistribution                                                                 (org.gradle.api.tasks.Copy)
... etc
but with my own project, the shadowJar task is not listed, and thus my "jar" task isn't creating a fat jar file. Where is the shadowJar being pulled in from? I can't see it directly added to the example project, but it's there.
r
You need KVision Gradle plugin
m
I have it, it's just not providing the shadowJar task:
In the demo app, using the same version of the plugin does provide it
image.png
This second image is addressbook
r
The plugin detects if the project is fullstack application by checking the existence of
src/jsMain
and
src/jvmMain
directories
Do you have these source sets?
m
yes
r
Next it checks if the project uses one of
kvision-server-*
dependencies
It generates tasks compatible with different servers
m
I have:
Copy code
commonMain {
            dependencies {
                implementation(libs.kvision.server.ktor)
            }
        }
which is in libs.versions.toml:
Copy code
kvision-server-ktor = { module = "io.kvision:kvision-server-ktor", version.ref = "kvision-version" }
aha!
I was using "implementation", but the demo uses "api"
That's added the shadowJar task
r
Yep, it checks
commonMainApi
dependencies
m
ok, my bad. simple oversight, I'm so used to adding implementations, I missed it was an api type
Thanks for your help!