From 00f92bd73bfd8cb1e6da40e0bafe43db3f443e5e Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Thu, 28 Nov 2019 14:54:47 +0100 Subject: Add better error message when fatjar cannot be resolved --- .../src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runners/gradle-plugin/src') diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index 0412b8a7..16f6c83e 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -86,11 +86,14 @@ open class DokkaTask : DefaultTask() { private var outputDiagnosticInfo: Boolean = false // Workaround for Gradle, which fires some methods (like collectConfigurations()) multiple times in its lifecycle - private fun tryResolveFatJar(configuration: Configuration?): Set { + private fun tryResolveFatJar(configuration: Configuration?, level: Int = 0): Set { + val maxRetries = 10 return try { configuration!!.resolve() } catch (e: Exception) { - project.parent?.let { tryResolveFatJar(configuration) } ?: throw e + if (level >= maxRetries) + throw IllegalStateException("Cannot resolve dokka fatjar! Make sure you have jcenter() in your repositories") + project.parent?.let { tryResolveFatJar(configuration, level + 1) } ?: throw e } } -- cgit