Why am I getting `java.lang.AssertionError: Built-in class kotlin.Any is not found` when using `copy` in TeamCity DSL?

1.7k views Asked by At

Background

I'm trying to create some Teamcity configuration using Kotlin. I'm using a Maven in Intellij when testing the generation of the Teamcity, although I get the same result by using the command line.

Problem

A minimum example: https://gist.github.com/3761e6f3847db9f8f772c9e16663aaa9

To recreate the issue, use the command: mvn teamcity-configs:generate

The error is:

[ERROR] Runtime error RootProjectId: kotlin.reflect.jvm.internal.impl.builtins.KotlinBuiltIns$3[113]: java.lang.AssertionError: Built-in class kotlin.Any is not found

Although I've taken steps to minimise the provided example, I'm no Maven expert and I'm not sure what else could have been shaved off the pom.xml file.

The problem seems to stem from an attempted use to copy (cf., docs) which seems to trip up Kotlin with some reflection issue. Remove the copy and the generation of the config works fine.

Research

There are a few places around where this is discussed (e.g. here and here), but I can't find any that match the issue I'm experiencing or suggest a solution which fixes it for me.

The most interesting one is this one, which is not relevant as it's regarding moving from Kotlin versions 1.3.x to 1.4.x, however, the discussion has a little on the interdependence of kotlin-stdlib[...], kotlin-reflect and Java itself, from JetBrain developer "Udalov" (direct link to comment). The details are over my head and may not be relevant here, but it's the most technical answer I've seen addressing this issue.

What I've tried

I've tried adding kotlin-reflect as an explicit dependency and making sure that kotlin-stdlib-jdk8 is present and correct. I've tried varying the Kotlin version from 1.3.70 to 1.3.72 to 1.4.32 with no change to the result.

Any help or insight on this would be appreciated, even if it's just to advance my understanding of this software stack.

0

There are 0 answers