From 326bda51d81df6f33a89f5dc60dcd1acb74a027a Mon Sep 17 00:00:00 2001 From: Stu Date: Sun, 28 Dec 2014 17:10:58 +0000 Subject: [PATCH] provide a meaningful error message if the plugin jar cannot be found --- src/main/groovy/org/scoverage/ScoverageExtension.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/org/scoverage/ScoverageExtension.groovy b/src/main/groovy/org/scoverage/ScoverageExtension.groovy index 7b0d14b..05364a9 100644 --- a/src/main/groovy/org/scoverage/ScoverageExtension.groovy +++ b/src/main/groovy/org/scoverage/ScoverageExtension.groovy @@ -1,6 +1,7 @@ package org.scoverage import org.gradle.api.Action +import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.api.artifacts.Configuration import org.gradle.api.file.FileCollection @@ -91,7 +92,12 @@ class ScoverageExtension { extension.reportDir.mkdirs() Configuration configuration = t.configurations[ScoveragePlugin.CONFIGURATION_NAME] - File pluginFile = configuration.filter { it.name.contains('plugin') }.iterator().next() + File pluginFile + try { + pluginFile = configuration.filter { it.name.contains('plugin') }.iterator().next() + } catch(NoSuchElementException e) { + throw new GradleException("Could not find a plugin jar in configuration '${ScoveragePlugin.CONFIGURATION_NAME}'") + } FileCollection pluginDependencies = configuration.filter { it != pluginFile } t.tasks[ScoveragePlugin.COMPILE_NAME].configure {