https://kotlinlang.org logo
Join SlackCommunities
Powered by
# build-tools
  • o

    obadz

    09/10/2022, 9:18 AM
    Hi, I've been trying to import a module from Maven into my project, and it doesn't seem to be working. I've added 2 Kotlin modules (betterParser and ) via File -> Project Structure -> Module -> + and yet I can't import any of the symbols (Kotlin: Packages cannot be imported). Just to check, I imported a Java module (JBlas) from Maven using the same methodology that that one works just fine. What am I doing wrong? (I'm using ant, not Graddle)
    e
    • 2
    • 5
  • p

    pardom

    11/08/2022, 3:29 PM
    Hi, I'm doing some modularization of our SDK and I see that there's a
    FatFrameworkTask
    for native targets. Is there a canonical way to produce a fat JAR?
    a
    • 2
    • 2
  • s

    Sam Gammon

    01/01/2023, 2:52 AM
    Hello K friends, What if Node were more than just JS? To celebrate the new year, I am pleased to share a new project called Elide, a new server runtime, like Node or Deno, but polyglot, written in Kotlin and based on GraalVM. We are in alpha and very open to early feedback and contributions for anyone interested, over in #framework-elide 🥳 You can do wild things with it, like fast React SSR in Micronaut or Spring. Guest language support is starting with JS, but there are plans to integrate other languages like Python, Ruby, and Rust/Go/etc. via LLVM. Of course,
    native-image
    is supported out of the box. • 🚀 Trying it out
    Copy code
    curl -sSL --tlsv1.2 dl.elide.dev/cli/install.sh | bash -s -
    👆 the one liner works on Darwin (amd64/arm64), and Linux (amd64) so far.
    If you prefer NPX:
    Copy code
    npx @elide-dev/elide@alpha shell
    K Building Kotlin apps with it • Elide can be used as a plain library with a regular Micronaut server, and Ktor support is on the way. There are Maven artifacts in a custom repository which is easy to use during the alpha; you can see a sample here. • G Gradle plugin You can easily install the Gradle plugin to build your frontend assets and your Kotlin/JS, and package it into your server binary. It will handle building for SSR and CSR both, so you can easily switch between browser rendering modes. Check it out here. Maven and Bazel support are planned. • 🖥️ Using the shell
    elide shell
    drops you into a shell just like Node (see attached screenshot), the difference being the
    URL
    class we're using here is implemented in Kotlin, backed by the road-tested power of Micronaut, KotlinX, Netty, and the Java standard library. It has simply been adapted for use in JavaScript, according to the WhatWG URL Spec. • js Use Kotlin/JS or regular Node stack Elide packages and consumes your JS/TS with built-in support for
    esbuild
    , so you can use a standard Node toolchain or the Kotlin/JS stack. • 💨 Super fast React SSR Because Elide is basically Kotlin with a super-fast JS runtime attached, it can do JS SSR without leaving the JVM. This can soon be drop-in compatible with many React apps. You can see a live sample here to confirm it is fast and server-rendered. The code for that sample is pasted below to show how simple it is to call back and forth between Kotlin and your React app:
    Copy code
    @Page class Index : PageWithProps<YourProps>(YourProps.serializer()) {
    
        // Serve React SSR.
        @Get("/") suspend fun indexPage(request: HttpRequest<*>) = ssr(request) {    // 1: tell the server we're going to do SSR for this request
          head {
            title { +"Hello, Elide!" }
            stylesheet("/styles/base.css")
            stylesheet("/styles/main.css")
            script("/scripts/ui.js", defer = true)   // <-- 2: serve the CSR bundle so it can hydrate the react SSR response
          }
          body {
            injectSSR(this@Index, request)    // <-- 3: execute the JS VM to produce the SSR response, and splice it into the server response
          }
        }
    
    }
    • 🐙 Contributors needed The future of software is much more polyglot than today's paradigm: developers love to fight about frameworks, but at the end of the day, we're all writing code, and eliminating barriers between languages means easier collaboration and more value for all of us. It shouldn't be a Node vs. The World or a Rust vs. The World argument; we should get to pick and pull the best code we want from anywhere and use it to build our apps, especially from a multi-platform language like Kotlin. This runtime and framework are designed for that future. *If you agree, join us and make a dent in the universe*; you'll have a chance to be impactful and shape a brave new idea from the ground up. • 🙏 Thank you We chose Kotlin because of the fantastic community. 2023 will be a massive year for Kotlin, and we think that betting the farm on it is reasonable and smart. We are super excited about what JetBrains and Kotlin have in store for us with K2, context receivers, value classes... just so much to look forward to. Cheers and happy new year, Kotlin devs, K sam Slack Conversation
  • d

    David Kubecka

    01/02/2023, 3:01 PM
    I'm trying to use kapt in my project and it is working well when I compile manually using maven. However, the Intellij IDEA integrated builder has trouble when compiling the generated sources. I've filed a bug to IDEA directly as I think the issue might be there (there's a simple reproducer project if anyone would be glad to look at it). To understand the issue more, I would like to know the reasoning behind and perhaps more details of this Maven/Kotlin guide that I followed. I noticed that when I don't "disable" the
    maven-compiler-plugin
    I get the same error during manual maven compilation ("package does not exist") as I get in IDEA when the pom is set up correctly. Can anyone shed more light into this issue?
    a
    • 2
    • 17
  • e

    Eugen Martynov

    01/09/2023, 1:16 PM
    Does kotlin 1.8.0 strip in the bytecode parameter names in public functions? When IDE decompiles artifact built with Kotlin 1.8.0 I see
    Copy code
    @Nullable
     Object createConversation(int var1, @NotNull String var2, @Nullable String var3, boolean var4, @Nullable String var5, @NotNull Continuation<? super CreateConversationResult> var6);
    
     @Nullable
     Object retrySdkSessionInit(@NotNull Continuation<? super Unit> var1);
    Or could it be R8? (this is an Android library).
    e
    • 2
    • 4
  • l

    Lucy

    01/16/2023, 7:05 PM
    Hello, 🙂 has anyone noticed differences with minification and Kotlin 1.8.0 (kotlin-gradle-plugin)? I'm building an Android library with minified enabled and the resulting class files are completely different from Kotlin 1.7.2. Example using 1.7.2 and minify
    Copy code
    public final class Test public constructor() {
        public final fun addOne(num: <http://kotlin.Int|kotlin.Int>): <http://kotlin.Int|kotlin.Int> { /* compiled code */ }
    
        public final suspend fun suspendAddOne(num: <http://kotlin.Int|kotlin.Int>): <http://kotlin.Int|kotlin.Int> { /* compiled code */ }
    }
    Same code after using 1.8.0 and minify
    Copy code
    public final class Test {
        public static final int $stable;
    
        public Test() {
        }
    
        public final Object suspendAddOne(int var1, Continuation<? super Integer> var2) {
            return Boxing.boxInt(var1 + 1);
        }
    
        public final int addOne(int var1) {
            return var1 + 2;
        }
    }
    In 1.8.0, I am also getting an extra parameter variable with suspend functions. I can't find any documentation or logs about this change (looked at kotlin, gradle, and minify/R8 release pages). If anyone could point me in the right direction it would be greatly appreciated!
    e
    • 2
    • 5
  • j

    jean

    02/07/2023, 8:16 AM
    I have a multiplatform library project that uses ksp to generate some code. When I try to publish that library to a maven repo I get
    Unresolved reference
    wherever the library is referencing a generated class/function. What am I suppose to do to tell the publish gradle task to also publish the generated code?
    t
    • 2
    • 2
  • d

    David Kubecka

    04/13/2023, 10:31 AM
    A
    kotlin-maven-plugin
    question: I'm using that plugin to run a (java) annotation processor. That processor uses
    Diagnostic.Kind.NOTE
    for diagnostic messages. These show up as ERROR in the plugin output, whereas the equivalent java plugin shows them as INFO. Is this expected?
    t
    • 2
    • 1
  • d

    Daniele Segato

    06/06/2023, 7:09 AM
    Does anyone know what this error means?
    Copy code
    java.lang.IllegalArgumentException: com.intellij.openapi.externalSystem.model.project.dependencies.DependencyScopeNode is not an interface
    	at java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Unknown Source)
    	at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Unknown Source)
    	at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Unknown Source)
    	at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Unknown Source)
    	at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(Unknown Source)
    	at java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(Unknown Source)
    	at java.base/java.lang.reflect.Proxy.getProxyConstructor(Unknown Source)
    	at java.base/java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.createView(ProtocolToModelAdapter.java:160)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:276)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.access$1500(ProtocolToModelAdapter.java:56)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:477)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:705)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:742)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:766)
    	at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:432)
    	at jdk.proxy6/jdk.proxy6.$Proxy166.getCompileDependenciesGraph(Unknown Source)
    	in ProjectDependenciesSerializationService$2.process(ProjectDependenciesSerializationService.java:90)
    The project get stuck at initial import when I open Android Studio, this started happening with AS Hedgehog Canary 6: worked in Canary 5. https://issuetracker.google.com/issues/285195965
    t
    d
    • 3
    • 11
  • d

    dave08

    06/19/2023, 11:33 AM
    Anyone know how to solve
    Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
    when upgrading from an older AGP version to 8.0.2?
    a
    • 2
    • 5
  • n

    Norbi

    09/05/2023, 12:41 PM
    I try to upgrade my project to Kotlin 1.9.10 + Compose Multiplatform 1.5.0. Until now I used this configuration to ignore Compose incompatibility checks (with Kotlin 1.8.21 and Compose Multiplatform 1.5.0-dev1084):
    Copy code
    compose {
        kotlinCompilerPlugin.set(dependencies.compiler.forKotlin("1.8.20"))
        kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=1.8.21")
    }
    How should I modify the above configuration to prevent
    Copy code
    Compose Multiplatform 1.5.0 doesn't support Kotlin 1.9.10
    error? Thanks.
    t
    • 2
    • 4
  • c

    chi

    09/18/2023, 5:17 AM
    I’m trying to upgrade my project from
    kapt
    to
    ksp
    but I’m seeing the following error;
    Copy code
    Execution failed for task ':app:kspDebugKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
       > Compilation error. See log for more details
    Please any idea what could be the cause and how I can fix this?
    a
    • 2
    • 2
  • d

    d4span

    11/01/2023, 9:31 PM
    After I upgraded to Kotlin 1.9.20, my Maven build breaks with the following error:
    Copy code
    [INFO] --- kotlin:1.9.20:kapt (default-kapt) @ awesomeproject ---
    [ERROR] java.lang.IllegalAccessError: superclass access check failed: class org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler (in unnamed module @0x63300c4b) cannot access class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.main to unnamed module @0x63300c4b
    	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
    	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
    	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
    	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
    	at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
    	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    	at org.jetbrains.kotlin.kapt3.base.KaptContext.<init>(KaptContext.kt:55)
    With Kotlin 1.9.10, everything works as expected. Any ideas how I can fix this?
    t
    • 2
    • 3
  • c

    Christopher Hübner

    01/15/2024, 9:08 AM
    What book/course/documentation for getting deep dive in gradle, kotlin, testing and multi module pattern? 🙂
    m
    b
    e
    • 4
    • 6
  • v

    Vivek Rajendran

    02/21/2024, 6:01 AM
    Do we have any library similar to androidx.annotation.RestrictTo in kotlin? I am trying to create modular kmp sdk with limited api surface. I want some of the apis to be accessible in my other sdks but restrict them in public. For similar case, androidx has androidx.annotation.RestrictTo. Do we have anything similar in kotlin kmp world?
    t
    • 2
    • 2
  • d

    Dmytro Serdiuk

    02/26/2024, 12:34 AM
    Hello! I saw that to run kotlin compiler before java using maven we need to add:
    Copy code
    <executions>
    <!-- Replacing default-compile as it is treated specially by maven -->
    <execution> <id>default-compile</id> <phase>none</phase>
    </execution>
    <!-- Replacing default-testCompile as it is treated specially by maven --> <execution>
    <id>default-testCompile</id>
    <phase>none</phase>
    I know that default-goal is added as an ID by default, but why “default-compile” is called first even if the plugin defined the second inn the pom file? Thanks!
  • c

    cfleming

    04/09/2024, 6:39 AM
    Is there any way to get incremental Kotlin compilation using the CLI compiler?
    t
    • 2
    • 4
  • c

    czuckie

    04/15/2024, 11:08 AM
    Fwiw: I got an email asking me to take a survey from JB and it renders incorrectly on mobile and is unresponsive
    t
    m
    n
    • 4
    • 5
  • a

    Andy Hebert

    04/18/2024, 7:15 PM
    Has anyone had issues with a Kotlin JVM app when trying to use AppCDS. I am running into
    Copy code
    [5.016s][info   ][cds         ] Run GC done
    [5.016s][error  ][cds         ] Error: non-empty directory '/home/a/git/u/build/classes/kotlin/main'
    Hint: enable -Xlog:class+path=info to diagnose the failure
    Because Kotlin is putting a app-name.kotlin_module int the build/classes/kotlin/main/META-INF directory. Anyone have a way to work around this?
  • n

    Norbi

    08/16/2024, 1:55 PM
    I have realized that originally I posted to the wrong channel...
  • r

    robnik

    08/21/2024, 3:57 PM
    I tried upgrading Kotlin to 2.0.10 (from 1.something), and now our Maven builds are sporadically failing with this. Anyone know what this is?
    Copy code
    [INFO] --- kotlin-maven-plugin:2.0.10:compile (compile) @ omnisee ---
    [WARNING] Using experimental Kotlin incremental compilation
    [ERROR] Incremental compilation failed: java.lang.NegativeArraySizeException
    java.io.IOException: java.lang.NegativeArraySizeException
    	at com.intellij.util.io.IOUtil.readString(IOUtil.java:48)
    	at org.jetbrains.kotlin.incremental.storage.StringExternalizer.read(externalizers.kt:225)
    	at org.jetbrains.kotlin.incremental.storage.FileDescriptor.read(FileToPathConverter.kt:37)
    	at org.jetbrains.kotlin.incremental.storage.FileDescriptor.read(FileToPathConverter.kt:30)
    t
    • 2
    • 2
  • h

    Harish Reddy

    09/16/2024, 10:28 AM
    Hello folks! Hope you are all doing great! I am facing some issues with Publishing Android library setup. Any help/pointers would be greatly appreciated. I have a KMP project with multi-module setup. Module-1:
    CoreModule
    Module-2:
    FeatureModule
    FeatureModule
    references
    CoreModule
    internally using
    api(project(path = ":CoreModule))
    . The final artifact
    FeatureModule
    after publishing to maven/maven local is supposed to be integrated in main Android app. So, now my expectation is to have the code within
    CoreModule
    to be accessible inside the main Android app since
    FeatureModule
    includes the
    CoreModule
    . But, I can’t access the code/classes within
    CoreModule
    inside the main Android app. This is a KMP project which I am not so familiar with. So, not sure if it is a KMP thing or something else. Any idea what could be missing in this setup? I am attaching reference code in the thread.
    t
    • 2
    • 4
  • n

    Natalia Mishina

    10/09/2024, 9:16 AM
    Hey! Kotlin team is wondering if this feedback question would be clear to you. Could you help us by letting us know how you understand it? kodee pleased Imagine that, while working in IntelliJ IDEA, you see this feedback window pop up (see the picture attached). What do you think we're asking you to evaluate? Please vote by reacting to this post: 1️⃣ It’s about my experience with Gradle as a build tool. 2️⃣ It’s about my experience with Gradle in the context of Kotlin. 3️⃣ It’s about how Gradle integrates with the IDE. 4️⃣ It’s about my overall experience using Gradle. 5️⃣ It’s about my overall experience using Kotlin. 6️⃣ I’ll write my own interpretation in the thread. Thanks a lot for your help!
    1️⃣ 8
    2️⃣ 1
    3️⃣ 11
    4️⃣ 1
    5️⃣ 1
    6️⃣ 1
    m
    a
    c
    • 4
    • 4
  • j

    jw

    10/24/2024, 4:14 AM
    Hello! With Kotlin 2.0.20 deprecating support for Gradle's built-in 'application' plugin for packaging distributable JVM executable archives, can https://youtrack.jetbrains.com/issue/KT-41409 be reopened for a first-party KGP replacement?
    👌 6
    👌🏾 2
    ➕ 4
  • c

    Charlie Tapping

    01/20/2025, 6:15 PM
    Whats the chances we can get a linuxArm64Test task? Github now supports linux arm runners and I’d like to add a workflow to cover this platform
    j
    • 2
    • 4
  • c

    calidion

    02/02/2025, 2:08 PM
    seems I cannot download this package now.
    sad panda 1
  • j

    joseph_ivie

    02/20/2025, 5:39 AM
    I'm looking into putting together an alternative to Gradle and Amper for KMP projects, mostly as a hobby. I think I've figured out the majority of what I need by reading through Amper's source, but I'm lost on how these integrate into IntelliJ - I've seen how IntelliJ only JVM projects use
    .iml
    files to define the modules, but the Gradle integration does not appear to generate any of these files, yet somehow works. Is an IntelliJ plugin necessary to define the projects and modules? If so, can anyone get me a good starting point? My non-multiplatform version of this project just used those `.iml`s but that's not an option this time around.
    g
    t
    a
    • 4
    • 6
  • j

    jrod

    04/03/2025, 12:36 AM
    👋 seeing this issue on our CI/Jenkins environments while building KMP projects. looks like it's been open for a while; are we misconfiguring something or is the suggestion about the lazy caching of the device map a valid concern?
    t
    • 2
    • 1
  • d

    dead.fish

    05/05/2025, 3:05 PM
    Hi, I recently updated to KSP 2.1.20-1.0.32 (Kotlin 2.1.20) and get an exception when compiling:
    Copy code
    java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.incremental.IncrementalCompilationFeatures.<init>(boolean, boolean, boolean, boolean, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)'
            at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.makeIncrementalCompilationFeatures(AbstractKotlinCompile.kt:288)
            at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.makeIncrementalCompilationFeatures(KotlinCompile.kt:476)
            at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(KotlinCompile.kt:331)
            at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(KotlinCompile.kt:55)
            at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(AbstractKotlinCompile.kt:314)
            at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(AbstractKotlinCompile.kt:263)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
            at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
            at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
            at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:244)
    Anybody has seen this before?
    t
    • 2
    • 1
  • d

    dead.fish

    05/05/2025, 3:08 PM
    Switching off incremental compilation (via
    -Pkotlin.incremental=false
    ) fixes the issue. This seems to affect both Android and multiplatform projects.