Package org.gradle.api

Examples of org.gradle.api.GradleException


        testExecuter.execute(this, resultProcessor);

        testFramework.report();

        if (!isIgnoreFailures() && listener.hadFailures()) {
            throw new GradleException("There were failing tests. See the report at " + getTestReportDir() + ".");
        }
    }
View Full Code Here


    public ExecAction getExecHandle() {
        try {
            options.write(optionsFile);
        } catch (IOException e) {
            throw new GradleException("Faild to store javadoc options.", e);
        }

        ExecAction execAction = new DefaultExecAction();
        execAction.workingDir(execDirectory);
        execAction.executable(GUtil.elvis(executable, Jvm.current().getJavadocExecutable()));
View Full Code Here

            // keep the thread going if not in daemon mode
            if (!daemon) {
                server.join();
            }
        } catch (Exception e) {
            throw new GradleException("An error occurred starting the Jetty server.", e);
        } finally {
            if (!daemon) {
                logger.info("Jetty server exiting.");
            }
        }
View Full Code Here

            location = targetClass.getProtectionDomain().getCodeSource().getLocation().toURI();
        } catch (URISyntaxException e) {
            throw new UncheckedIOException(e);
        }
        if (!location.getScheme().equals("file")) {
            throw new GradleException(String.format("Cannot determine Gradle home using codebase '%s'.", location));
        }
        return new File(location.getPath());
    }
View Full Code Here

        if (generatedClass != null) {
            return generatedClass;
        }

        if (Modifier.isPrivate(type.getModifiers())) {
            throw new GradleException(String.format("Cannot create a proxy class for private class '%s'.",
                    type.getSimpleName()));
        }
        if (Modifier.isAbstract(type.getModifiers())) {
            throw new GradleException(String.format("Cannot create a proxy class for abstract class '%s'.",
                    type.getSimpleName()));
        }

        Class<? extends T> subclass;
        try {
            ClassBuilder<T> builder = start(type);

            boolean isConventionAware = type.getAnnotation(NoConventionMapping.class) == null;
            boolean isDynamicAware = type.getAnnotation(NoDynamicObject.class) == null;

            builder.startClass(isConventionAware, isDynamicAware);

            if (isDynamicAware && !DynamicObjectAware.class.isAssignableFrom(type)) {
                builder.mixInDynamicAware();
            }
            if (isDynamicAware && !GroovyObject.class.isAssignableFrom(type)) {
                builder.mixInGroovyObject();
            }
            if (isDynamicAware) {
                builder.addDynamicMethods();
            }
            if (isConventionAware && !IConventionAware.class.isAssignableFrom(type)) {
                builder.mixInConventionAware();
            }

            Class noMappingClass = Object.class;
            for (Class<?> c = type; c != null && noMappingClass == Object.class; c = c.getSuperclass()) {
                if (c.getAnnotation(NoConventionMapping.class) != null) {
                    noMappingClass = c;
                }
            }

            Collection<String> skipProperties = Arrays.asList("metaClass", "conventionMapping", "convention", "asDynamicObject");

            MetaClass metaClass = GroovySystem.getMetaClassRegistry().getMetaClass(type);
            for (MetaProperty property : metaClass.getProperties()) {
                if (skipProperties.contains(property.getName())) {
                    continue;
                }
                if (property instanceof MetaBeanProperty) {
                    MetaBeanProperty metaBeanProperty = (MetaBeanProperty) property;
                    MetaMethod getter = metaBeanProperty.getGetter();
                    if (getter == null) {
                        continue;
                    }
                    if (Modifier.isFinal(getter.getModifiers()) || Modifier.isPrivate(getter.getModifiers())) {
                        continue;
                    }
                    if (getter.getReturnType().isPrimitive()) {
                        continue;
                    }
                    Class declaringClass = getter.getDeclaringClass().getTheClass();
                    if (declaringClass.isAssignableFrom(noMappingClass)) {
                        continue;
                    }
                    builder.addGetter(metaBeanProperty);

                    MetaMethod setter = metaBeanProperty.getSetter();
                    if (setter == null) {
                        continue;
                    }
                    if (Modifier.isFinal(setter.getModifiers()) || Modifier.isPrivate(setter.getModifiers())) {
                        continue;
                    }

                    builder.addSetter(metaBeanProperty);
                }
            }

            for (Constructor<?> constructor : type.getConstructors()) {
                if (Modifier.isPublic(constructor.getModifiers())) {
                    builder.addConstructor(constructor);
                }
            }

            subclass = builder.generate();
        } catch (Throwable e) {
            throw new GradleException(String.format("Could not generate a proxy class for class %s.", type.getName()), e);
        }

        cache.put(type, subclass);
        return subclass;
    }
View Full Code Here

    private void walkDir(File file, RelativePath path, AtomicBoolean stopFlag) {
        File[] children = file.listFiles();
        if (children == null) {
            if (file.isDirectory() && !file.canRead()) {
                throw new GradleException(String.format("Could not list contents of directory '%s' as it is not readable.", file));
            }
            // else, might be a link which points to nothing, or has been removed while we're visiting, or ...
            throw new GradleException(String.format("Could not list contents of '%s'.", file));
        }
        List<FileVisitDetailsImpl> dirs = new ArrayList<FileVisitDetailsImpl>();
        for (int i = 0; !stopFlag.get() && i < children.length; i++) {
            File child = children[i];
            boolean isFile = child.isFile();
View Full Code Here

            }
            catch (IllegalDependencyNotation e) {
                // ignore
            }
            catch (Exception e) {
                throw new GradleException(String.format("Could not create a dependency using notation: %s", dependencyNotation), e);
            }
        }

        if (dependency == null) {
            throw new InvalidUserDataException(String.format("The dependency notation: %s is invalid.",
View Full Code Here

    public void publish(Set<Configuration> configurationsToPublish, File descriptorDestination,
                        List<DependencyResolver> publishResolvers) {
        try {
            ivyService.publish(configurationsToPublish, descriptorDestination, publishResolvers);
        } catch (Throwable e) {
            throw new GradleException(String.format("Could not publish configurations %s.", configurationsToPublish),
                    e);
        }
    }
View Full Code Here

                }
            } finally {
                zip.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not expand %s.", this), e);
        }

        return this;
    }
View Full Code Here

                }
            } finally {
                inputStream.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not expand %s.", this), e);
        }

        return this;
    }
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.