Skip to content

Commit

Permalink
provide a meaningful error message if the plugin jar cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
maiflai committed Dec 28, 2014
1 parent a8a19c7 commit 326bda5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/groovy/org/scoverage/ScoverageExtension.groovy
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 326bda5

Please sign in to comment.