Package org.gradle.api

Examples of org.gradle.api.GradleException


        ProjectSpec selector = gradle.getStartParameter().getDefaultProjectSelector();
        ProjectInternal defaultProject;
        try {
            defaultProject = selector.selectProject(gradle.getRootProject().getProjectRegistry());
        } catch (InvalidUserDataException e) {
            throw new GradleException(String.format("Could not select the default project for this build. %s",
                    e.getMessage()), e);
        }
        gradle.setDefaultProject(defaultProject);
    }
View Full Code Here


    private void doExecute(TaskInternal task, TaskStateInternal state) {
        boolean skip;
        try {
            skip = !task.getOnlyIf().isSatisfiedBy(task);
        } catch (Throwable t) {
            state.executed(new GradleException(String.format("Could not evaluate onlyIf predicate for %s.", task), t));
            return;
        }

        if (skip) {
            logger.info("Skipping execution as task onlyIf is false.");
View Full Code Here

            return (T) Message.receive(instr, classLoader);
        } catch (Exception e) {
            if (isEndOfStream(e)) {
                return null;
            }
            throw new GradleException(String.format("Could not read message from '%s'.", remoteAddress), e);
        }
    }
View Full Code Here

    public void dispatch(T message) {
        try {
            Message.send(message, outstr);
            outstr.flush();
        } catch (Exception e) {
            throw new GradleException(String.format("Could not write message to '%s'.", remoteAddress), e);
        }
    }
View Full Code Here

            throw (RuntimeException) failure;
        }
        if (failure instanceof Error) {
            throw (Error) failure;
        }
        throw new GradleException(String.format("%s failed with an exception.", StringUtils.capitalize(description)), failure);
    }
View Full Code Here

        listener.beforeActions(task);
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(task.getClass().getClassLoader());
        state.setExecuting(true);
        try {
            GradleException failure = executeActions(task, state);
            state.executed(failure);
        } finally {
            state.setExecuting(false);
            Thread.currentThread().setContextClassLoader(originalClassLoader);
            listener.afterActions(task);
View Full Code Here

                return serializer.read(inStr);
            } finally {
                inStr.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not read cache value from '%s'.", cacheFile), e);
        }
    }
View Full Code Here

                serializer.write(outStr, newValue);
            } finally {
                outStr.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not write cache value to '%s'.", cacheFile), e);
        }
        cache.markValid();
    }
View Full Code Here

    private void attachTaskAction(final Method method, Collection<Action<Task>> actions, Collection<String> methods) {
        if (method.getAnnotation(TaskAction.class) == null) {
            return;
        }
        if (Modifier.isStatic(method.getModifiers())) {
            throw new GradleException(String.format("Cannot use @TaskAction annotation on static method %s.%s().",
                    method.getDeclaringClass().getSimpleName(), method.getName()));
        }
        if (method.getParameterTypes().length > 0) {
            throw new GradleException(String.format(
                    "Cannot use @TaskAction annotation on method %s.%s() as this method takes parameters.",
                    method.getDeclaringClass().getSimpleName(), method.getName()));
        }
        if (methods.contains(method.getName())) {
            return;
View Full Code Here

        String wrapperPropertiesPath = wrapperDir + WRAPPER_PROPERTIES;
        File jarFileDestination = new File(getProject().getProjectDir(), wrapperJar);
        File propertiesFileDestination = new File(getProject().getProjectDir(), wrapperPropertiesPath);
        URL jarFileSource = getClass().getResource("/" + WRAPPER_JAR_BASE_NAME + ".jar");
        if (jarFileSource == null) {
            throw new GradleException("Cannot locate wrapper JAR resource.");
        }
        propertiesFileDestination.delete();
        jarFileDestination.delete();
        writeProperties(propertiesFileDestination);
        GFileUtils.copyURLToFile(jarFileSource, jarFileDestination);
View Full Code Here

TOP

Related Classes of org.gradle.api.GradleException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.