diff --git a/plugin/src/main/kotlin/xyz/jpenilla/runtask/RunPlugin.kt b/plugin/src/main/kotlin/xyz/jpenilla/runtask/RunPlugin.kt index 03291c3..bf190f7 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/runtask/RunPlugin.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/runtask/RunPlugin.kt @@ -83,17 +83,20 @@ public abstract class RunPlugin : Plugin { } } - protected open fun findPluginJar(project: Project): Provider? = when { - project.plugins.hasPlugin(Constants.Plugins.SHADOW_PLUGIN_ID) -> { - project.tasks.named(Constants.Plugins.SHADOW_JAR_TASK_NAME).flatMap { it.archiveFile } - } - - else -> { + protected open fun findPluginJar(project: Project): Provider? { + if (Constants.Plugins.SHADOW_JAR_TASK_NAME in project.tasks.names) { try { - project.tasks.named(JavaPlugin.JAR_TASK_NAME).flatMap { it.archiveFile } - } catch (ex: UnknownTaskException) { - null + return project.tasks.named(Constants.Plugins.SHADOW_JAR_TASK_NAME).flatMap { it.archiveFile } + } catch (ignore: Exception) { } } + + return project.defaultJar() + } + + private fun Project.defaultJar() = try { + project.tasks.named(JavaPlugin.JAR_TASK_NAME).flatMap { it.archiveFile } + } catch (ex: UnknownTaskException) { + null } } diff --git a/plugin/src/main/kotlin/xyz/jpenilla/runtask/util/Constants.kt b/plugin/src/main/kotlin/xyz/jpenilla/runtask/util/Constants.kt index 801b5ef..5ced588 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/runtask/util/Constants.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/runtask/util/Constants.kt @@ -43,7 +43,6 @@ internal object Constants { const val USER_AGENT = "run-task" object Plugins { - const val SHADOW_PLUGIN_ID = "com.github.johnrengelman.shadow" const val SHADOW_JAR_TASK_NAME = "shadowJar" const val PAPERWEIGHT_USERDEV_PLUGIN_ID = "io.papermc.paperweight.userdev"