Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kapt annotation processing - how to show full stacktrace

I am working on a android project using Kotlin, Databinding and Room. Sometimes the build fails with a error message, containing no information about what exactly went wrong, except that it has something to do with the annotation processor (which can have many causes...).

shortened Example:

org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.jetbrains

[more stack trace lines]

Caused by: org.jetbrains.kotlin.kapt3.base.util.KaptBaseError: Error while annotation processing

[even more stack trace lines]

at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:45)
... 32 more

Finding the cause, then means time consuming backtracking of my steps (and maybe using git stash) and guessing, when one the 32 hidden lines at the end seems likely to contain some useful information about what actually went wrong.

So the question is: how to show the full stack trace?

I tried setting the -Xmaxerrs 500 in my build.gradle as shown here https://kotlinlang.org/docs/reference/kapt.html#java-compiler-options as well as various variants of this, I found on SE (sorry, don't remember which exactly). None made any difference. Maybe i put the block in the wrong part? (tried module level, android -> defaultConfig -> kapt)

like image 693
tarbos Avatar asked Feb 20 '20 16:02

tarbos


1 Answers

Add kapt.verbose=true to your project's gradle.properties file.

like image 147
es0329 Avatar answered Nov 17 '22 12:11

es0329