Search in sources :

Example 16 with LocationAwareException

use of org.gradle.internal.exceptions.LocationAwareException in project gradle by gradle.

the class DefaultPluginRequestApplicator method resolveToFoundResult.

private Result resolveToFoundResult(PluginResolver effectivePluginResolver, PluginRequestInternal request) {
    Result result = new Result(request);
    try {
        effectivePluginResolver.resolve(request, result);
    } catch (Exception e) {
        throw new LocationAwareException(new GradleException(String.format("Error resolving plugin %s", request.getDisplayName()), e), request.getScriptDisplayName(), request.getLineNumber());
    }
    if (!result.isFound()) {
        String message = buildNotFoundMessage(request, result);
        Exception exception = new UnknownPluginException(message);
        throw new LocationAwareException(exception, request.getScriptDisplayName(), request.getLineNumber());
    }
    return result;
}
Also used : LocationAwareException(org.gradle.internal.exceptions.LocationAwareException) GradleException(org.gradle.api.GradleException) UnknownPluginException(org.gradle.api.plugins.UnknownPluginException) GradleException(org.gradle.api.GradleException) UnknownPluginException(org.gradle.api.plugins.UnknownPluginException) LocationAwareException(org.gradle.internal.exceptions.LocationAwareException) InvalidPluginException(org.gradle.api.plugins.InvalidPluginException) PluginResolutionResult(org.gradle.plugin.use.resolve.internal.PluginResolutionResult)

Aggregations

LocationAwareException (org.gradle.internal.exceptions.LocationAwareException)16 Test (org.junit.Test)10 GradleScriptException (org.gradle.api.GradleScriptException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Collection (java.util.Collection)1 GradleException (org.gradle.api.GradleException)1 InvalidPluginException (org.gradle.api.plugins.InvalidPluginException)1 UnknownPluginException (org.gradle.api.plugins.UnknownPluginException)1 TaskExecutionException (org.gradle.api.tasks.TaskExecutionException)1 ScriptCompilationException (org.gradle.groovy.scripts.ScriptCompilationException)1 ScriptSource (org.gradle.groovy.scripts.ScriptSource)1 ReportedException (org.gradle.initialization.ReportedException)1 LinePrefixingStyledTextOutput (org.gradle.internal.logging.text.LinePrefixingStyledTextOutput)1 DefaultPluginRequest (org.gradle.plugin.management.internal.DefaultPluginRequest)1 InvalidPluginRequestException (org.gradle.plugin.management.internal.InvalidPluginRequestException)1 PluginRequestInternal (org.gradle.plugin.management.internal.PluginRequestInternal)1 PluginId (org.gradle.plugin.use.PluginId)1 PluginResolutionResult (org.gradle.plugin.use.resolve.internal.PluginResolutionResult)1