Package org.gradle.api

Examples of org.gradle.api.InvalidUserDataException


        }
    }

    private void throwExceptionIfArtifactOrSrcIsNull(Artifact artifact, File src) {
        if (artifact == null) {
            throw new InvalidUserDataException("Artifact must not be null.");
        }
        if (src == null) {
            throw new InvalidUserDataException("Src file must not be null.");
        }
    }
View Full Code Here


        return spec;
    }

    private void checkGroovyClasspathIsNonEmpty() {
        if (getGroovyClasspath().isEmpty()) {
            throw new InvalidUserDataException("'" + getName() + ".groovyClasspath' must not be empty. If a Groovy compile dependency is provided, "
                    + "the 'groovy-base' plugin will attempt to configure 'groovyClasspath' automatically. Alternatively, you may configure 'groovyClasspath' explicitly.");
        }
    }
View Full Code Here

            return null;
        }

        private void configureLater(Action<? super T> action) {
            if (configured) {
                throw new InvalidUserDataException(String.format("Cannot configure the '%s' extension after it has been accessed.", name));
            }
            actions.add(action);
        }
View Full Code Here

    private boolean force;

    public AbstractExternalModuleDependency(String group, String name, String version, String configuration) {
        super(configuration);
        if (name == null) {
            throw new InvalidUserDataException("Name must not be null!");
        }
        this.group = group;
        this.name = name;
        this.version = version;
    }
View Full Code Here

        if (file.isAbsolute()) {
            return GFileUtils.canonicalise(file);
        }

        if (URI_SCHEME.matcher(original).matches()) {
            throw new InvalidUserDataException(String.format("Cannot convert URL '%s' to a file.", original));
        }

        file = new File(baseDir, original);
        return GFileUtils.canonicalise(file);
    }
View Full Code Here

        return this;
    }

    public File getDir() {
        if (dir == null) {
            throw new InvalidUserDataException("A base directory must be specified in the task or via a method argument!");
        }
        return resolver.resolve(dir);
    }
View Full Code Here

        Map<String, Object> actualArgs = new HashMap<String, Object>(args);
        checkTaskArgsAndCreateDefaultValues(actualArgs);

        String name = actualArgs.get(Task.TASK_NAME).toString();
        if (!GUtil.isTrue(name)) {
            throw new InvalidUserDataException("The task name must be provided.");
        }

        Class<? extends TaskInternal> type = (Class) actualArgs.get(Task.TASK_TYPE);
        Boolean generateSubclass = Boolean.valueOf(actualArgs.get(GENERATE_SUBCLASS).toString());
        TaskInternal task = createTaskObject(project, type, name, generateSubclass);
View Full Code Here

        return task;
    }

    private TaskInternal createTaskObject(ProjectInternal project, final Class<? extends TaskInternal> type, String name, boolean generateGetters) {
        if (!Task.class.isAssignableFrom(type)) {
            throw new InvalidUserDataException(String.format(
                    "Cannot create task of type '%s' as it does not implement the Task interface.",
                    type.getSimpleName()));
        }

        final Class<? extends TaskInternal> generatedType;
View Full Code Here

    private void validateArgs(Map<String, Object> args) {
        if (!validTaskArguments.containsAll(args.keySet())) {
            Map unknownArguments = new HashMap<String, Object>(args);
            unknownArguments.keySet().removeAll(validTaskArguments);
            throw new InvalidUserDataException(String.format("Could not create task '%s': Unknown argument(s) in task definition: %s",
                        args.get(Task.TASK_NAME), unknownArguments.keySet()));
        }
    }
View Full Code Here

        }
        if (!messages.isEmpty()) {
            List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>();
            messages = messages.subList(0, Math.min(5, messages.size()));
            for (String message : messages) {
                causes.add(new InvalidUserDataException(message));
            }
            String errorMessage;
            if (messages.size() == 1) {
                errorMessage = String.format("A problem was found with the configuration of %s.", task);
            } else {
View Full Code Here

TOP

Related Classes of org.gradle.api.InvalidUserDataException

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.