Skip to content

Runtime dependencies not included in --package option #425

Description

@Dogacel

|tasks.jar {
| manifest {
| attributes["Main-Class"] = "$capsuleApp"
| }
| archiveBaseName.set("$baseName")
| configurations["compileClasspath"].forEach { file: File ->
| from(zipTree(file.absoluteFile))
| }
| duplicatesStrategy = DuplicatesStrategy.INCLUDE
|}

Here I see that we don't use runtimeClasspath and in some scenarios, we need to.

I guess something like so,

from({
    configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }
})

For example,

@file:DependsOn("com.linecorp.armeria:armeria:1.30.1")

import com.linecorp.armeria.client.WebClient

val wc = WebClient.of("https://ssl-checker.io/api/v1/check/")

wc
    .get("/example.com")
    .aggregate()
    .thenAccept { response ->
        println(response.contentUtf8())
    }.join()

Try this script, it works when run using kscript, however it doesn't work when compiled with --package option.

You need to add @file:DependsOn("io.netty:netty-handler-proxy:4.1.112.Final") to make it compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions