Package org.gradle.api

Examples of org.gradle.api.InvalidUserDataException


    public void addArtifact(Artifact artifact, File src) {
        throwExceptionIfArtifactOrSrcIsNull(artifact, src);
        PublishArtifact publishArtifact = new MavenArtifact(artifact, src);
        ArtifactKey artifactKey = new ArtifactKey(publishArtifact);
        if (this.artifacts.containsKey(artifactKey)) {
            throw new InvalidUserDataException(String.format("A POM cannot have multiple artifacts with the same type and classifier. Already have %s, trying to add %s.",
                    this.artifacts.get(artifactKey), publishArtifact));
        }

        if (publishArtifact.getClassifier() != null) {
            addArtifact(publishArtifact);
            assignArtifactValuesToPom(artifact, pom, false);
            return;
        }

        if (this.artifact != null) {
            // Choose the 'main' artifact based on its type.
            if (!PACKAGING_TYPES.contains(artifact.getType())) {
                addArtifact(publishArtifact);
                return;
            }
            if (PACKAGING_TYPES.contains(this.artifact.getType())) {
                throw new InvalidUserDataException("A POM can not have multiple main artifacts. " +
                        "Already have " + this.artifact + ", trying to add " + publishArtifact);
            }
            addArtifact(this.artifact);
        }
View Full Code Here


        }
    }

    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

        setDidWork(result.getDidWork());
    }

    private void throwExceptionIfTaskClasspathIsEmpty(Collection<File> taskClasspath) {
        if (taskClasspath.size() == 0) {
            throw new InvalidUserDataException("You must assign a Groovy library to the groovy configuration!");
        }
    }
View Full Code Here

        return ConfigureUtil.configure(configureClosure, pom(name));
    }

    public MavenPom addFilter(String name, PublishFilter publishFilter) {
        if (name == null || publishFilter == null) {
            throw new InvalidUserDataException("Name and Filter must not be null.");
        }
        MavenPom pom = mavenPomFactory.create();
        pomFilters.put(name, new DefaultPomFilter(name, pom, publishFilter));
        return pom;
    }
View Full Code Here

        return pom;
    }

    public PublishFilter filter(String name) {
        if (name == null) {
            throw new InvalidUserDataException("Name must not be null.");
        }
        return pomFilters.get(name).getFilter();
    }
View Full Code Here

        return addBefore(userDescription, afterResolverName, null);
    }

    public DependencyResolver addBefore(Object userDescription, final String afterResolverName, Closure configureClosure) {
        if (!GUtil.isTrue(afterResolverName)) {
            throw new InvalidUserDataException("You must specify userDescription and afterResolverName");
        }
        if (findByName(afterResolverName) == null) {
            throw new InvalidUserDataException("Resolver $afterResolverName does not exists!");
        }
        return addInternal(userDescription, configureClosure, new OrderAction() {
            public void apply(String resolverName) {
                resolverNames.add(resolverNames.indexOf(afterResolverName), resolverName);
            }
View Full Code Here

        return addAfter(userDescription, beforeResolverName, null);
    }

    public DependencyResolver addAfter(Object userDescription, final String beforeResolverName, Closure configureClosure) {
        if (!GUtil.isTrue(beforeResolverName)) {
            throw new InvalidUserDataException("You must specify userDescription and beforeResolverName");
        }
        if (findByName(beforeResolverName) == null) {
            throw new InvalidUserDataException("Resolver $beforeResolverName does not exists!");
        }
        return addInternal(userDescription, configureClosure, new OrderAction() {
            public void apply(String resolverName) {
                int insertPos = resolverNames.indexOf(beforeResolverName) + 1;
                if (insertPos == resolverNames.size()) {
View Full Code Here

        return addFirst(userDescription, null);
    }

    public DependencyResolver addFirst(Object userDescription, Closure configureClosure) {
        if (!GUtil.isTrue(userDescription)) {
            throw new InvalidUserDataException("You must specify userDescription");
        }
        return addInternal(userDescription, configureClosure, new OrderAction() {
            public void apply(String resolverName) {
                if (resolverNames.size() == 0) {
                    resolverNames.add(resolverName);
View Full Code Here

        });
    }

    private DependencyResolver addInternal(Object userDescription, Closure configureClosure, OrderAction orderAction) {
        if (!GUtil.isTrue(userDescription)) {
            throw new InvalidUserDataException("You must specify userDescription");
        }
        DependencyResolver resolver = resolverFactory.createResolver(userDescription);
        ConfigureUtil.configure(configureClosure, resolver);
        if (!GUtil.isTrue(resolver.getName())) {
            throw new InvalidUserDataException("You must specify a name for the resolver. Resolver=" + userDescription);
        }
        if (findByName(resolver.getName()) != null) {
            throw new InvalidUserDataException(String.format(
                    "Cannot add a resolver with name '%s' as a resolver with that name already exists.", resolver.getName()));
        }
        addObject(resolver.getName(), resolver);
        orderAction.apply(resolver.getName());
        return resolver;
View Full Code Here

        return allModuleArtifactsCache;
    }

    public Set<ResolvedArtifact> getParentArtifacts(ResolvedDependency parent) {
        if (!parents.contains(parent)) {
            throw new InvalidUserDataException("Unknown Parent");
        }
        Set<ResolvedArtifact> artifacts = parentArtifacts.get(parent);
        return artifacts == null ? Collections.<ResolvedArtifact>emptySet() : artifacts;
    }
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.