Under an encrypted linux home directory my Kotlin build (using maven) is failing with a "java.io.FileNotFoundException (File name too long)".
The filename looks something like this, and is 298 characters long:
/home/niel/projects/project/bla/.../bla/.../bla/SomeTest$test name with spaces$1.class
The test looks something like this:
@Test
fun `test with nice descriptive name`() {
// ...
}
getconf NAME_MAX /
returns 255
, more than the 298
of the file name.
Scala has a way of dealing with this using the max-classfile-name
option.
Is there a solution for this in Kotlin?
I've been bumping my head on the same issue. The problem is exacerbated (occurs primarily?) when using lambdas inside of such descriptively named test methods.
In my case I'm using ecryptfs with encrypted filenames on top of ext4. Given the payload and padding that's added to the start of the filename by ecryptfs, it seems that ~140 bytes is the usable maximum filename length.
I don't know of a mechanism in Kotlin for working around this problem, but if you're using JUnit 5 you could make use of the @DisplayName annotation for your more verbose test names.
You could use the @JvmName
annotation to rename your test I believe. See the reference and the api
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With