• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InvalidUserDataException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gradle.api.InvalidUserDataException的典型用法代码示例。如果您正苦于以下问题:Java InvalidUserDataException类的具体用法?Java InvalidUserDataException怎么用?Java InvalidUserDataException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InvalidUserDataException类属于org.gradle.api包,在下文中一共展示了InvalidUserDataException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: publish

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
@TaskAction
public void publish() {
    final MavenPublicationInternal publication = getPublicationInternal();
    if (publication == null) {
        throw new InvalidUserDataException("The 'publication' property is required");
    }

    new PublishOperation(publication, "mavenLocal") {
        @Override
        protected void publish() throws Exception {
            MavenPublisher localPublisher = new MavenLocalPublisher(getLoggingManagerFactory(), getMavenRepositoryLocator());
            MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(localPublisher);
            MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher);
            validatingPublisher.publish(publication.asNormalisedPublication(), null);
        }
    }.run();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:PublishToMavenLocal.java


示例2: from

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    for (Usage usage : this.component.getUsages()) {
        // TODO Need a smarter way to map usage to artifact classifier
        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact);
        }

        // TODO Need a smarter way to map usage to scope
        for (ModuleDependency dependency : usage.getDependencies()) {
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency);
            } else {
                addModuleDependency(dependency);
            }
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:DefaultMavenPublication.java


示例3: detectCycles

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
private static void detectCycles(Map<ModuleIdentifier, ModuleIdentifier> replacements, ModuleIdentifier source, ModuleIdentifier target) {
    if (source.equals(target)) {
        throw new InvalidUserDataException(String.format("Cannot declare module replacement that replaces self: %s->%s", source, target));
    }

    ModuleIdentifier m = replacements.get(target);
    if (m == null) {
        //target does not exist in the map, there's no cycle for sure
        return;
    }
    Set<ModuleIdentifier> visited = new LinkedHashSet<ModuleIdentifier>();
    visited.add(source);
    visited.add(target);

    while(m != null) {
        if (!visited.add(m)) {
            //module was already visited, there is a cycle
            throw new InvalidUserDataException(
                    format("Cannot declare module replacement %s->%s because it introduces a cycle: %s",
                            source, target, Joiner.on("->").join(visited) + "->" + source));
        }
        m = replacements.get(m);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:ComponentModuleMetadataContainer.java


示例4: convert

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void convert(String notation, NotationConvertResult<? super ModuleVersionSelector> result) throws TypeConversionException {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation, null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    result.converted(newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ModuleVersionSelectorParsers.java


示例5: convert

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void convert(String notation, NotationConvertResult<? super ComponentSelector> result) throws TypeConversionException {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation, null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    result.converted(newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ComponentSelectorParsers.java


示例6: add

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void add(final Class<? extends FilterReader> filterType, final Map<String, ?> properties) {
    transformers.add(new Transformer<Reader, Reader>() {
        public Reader transform(Reader original) {
            try {
                Constructor<? extends FilterReader> constructor = filterType.getConstructor(Reader.class);
                FilterReader result = constructor.newInstance(original);

                if (properties != null) {
                    ConfigureUtil.configureByMap(properties, result);
                }
                return result;
            } catch (Throwable th) {
                throw new InvalidUserDataException("Error - Invalid filter specification for " + filterType.getName(), th);
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:FilterChain.java


示例7: validateParentMutation

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
private void validateParentMutation(MutationType type) {
    // Strategy changes in a parent configuration do not affect this configuration, or any of its children, in any way
    if (type == MutationType.STRATEGY) {
        return;
    }

    if (resolvedState == ARTIFACTS_RESOLVED) {
        throw new InvalidUserDataException(String.format("Cannot change %s of parent of %s after it has been resolved", type, getDisplayName()));
    } else if (resolvedState == GRAPH_RESOLVED) {
        if (type == MutationType.DEPENDENCIES) {
            throw new InvalidUserDataException(String.format("Cannot change %s of parent of %s after task dependencies have been resolved", type, getDisplayName()));
        }
    }

    markAsModifiedAndNotifyChildren(type);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:DefaultConfiguration.java


示例8: validateMutation

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void validateMutation(MutationType type) {
    if (resolvedState == ARTIFACTS_RESOLVED) {
        // The public result for the configuration has been calculated.
        // It is an error to change anything that would change the dependencies or artifacts
        throw new InvalidUserDataException(String.format("Cannot change %s of %s after it has been resolved.", type, getDisplayName()));
    } else if (resolvedState == GRAPH_RESOLVED) {
        // The task dependencies for the configuration have been calculated using Configuration.getBuildDependencies().
        throw new InvalidUserDataException(String.format("Cannot change %s of %s after task dependencies have been resolved", type, getDisplayName()));
    } else if (observedState == GRAPH_RESOLVED || observedState == ARTIFACTS_RESOLVED) {
        // The configuration has been used in a resolution, and it is an error for build logic to change any dependencies,
        // exclude rules or parent configurations (values that will affect the resolved graph).
        if (type != MutationType.STRATEGY) {
            String extraMessage = insideBeforeResolve ? " Use 'defaultDependencies' instead of 'beforeResolve' to specify default dependencies for a configuration." : "";
            throw new InvalidUserDataException(String.format("Cannot change %s of %s after it has been included in dependency resolution.%s", type, getDisplayName(), extraMessage));
        }
    }

    markAsModifiedAndNotifyChildren(type);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:DefaultConfiguration.java


示例9: doGetSrcDirTrees

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
private Set<DirectoryTree> doGetSrcDirTrees() {
    Set<DirectoryTree> result = new LinkedHashSet<DirectoryTree>();
    for (Object path : source) {
        if (path instanceof SourceDirectorySet) {
            SourceDirectorySet nested = (SourceDirectorySet) path;
            result.addAll(nested.getSrcDirTrees());
        } else {
            for (File srcDir : fileResolver.resolveFiles(path)) {
                if (srcDir.exists() && !srcDir.isDirectory()) {
                    throw new InvalidUserDataException(String.format("Source directory '%s' is not a directory.", srcDir));
                }
                result.add(directoryFileTreeFactory.create(srcDir, patterns));
            }
        }
    }
    return result;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultSourceDirectorySet.java


示例10: getHeapSizeMb

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
private int getHeapSizeMb(String heapSize) {
    if (heapSize == null) {
        return -1; // unspecified
    }

    String normalized = heapSize.trim().toLowerCase();
    try {
        if (normalized.endsWith("m")) {
            return Integer.parseInt(normalized.substring(0, normalized.length() - 1));
        }
        if (normalized.endsWith("g")) {
            return Integer.parseInt(normalized.substring(0, normalized.length() - 1)) * 1024;
        }
    } catch (NumberFormatException e) {
        throw new InvalidUserDataException("Cannot parse heap size: " + heapSize, e);
    }
    throw new InvalidUserDataException("Cannot parse heap size: " + heapSize);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:DaemonForkOptions.java


示例11: parseNotation

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public NormalizedTimeUnit parseNotation(CharSequence notation, int value) {
    String candidate = notation.toString().toUpperCase();
    //jdk5 does not have days, hours or minutes, normalizing to millis
    if (candidate.equals("DAYS")) {
        return millis(value * 24 * 60 * 60 * 1000);
    } else if (candidate.equals("HOURS")) {
        return millis(value * 60 * 60 * 1000);
    } else if (candidate.equals("MINUTES")) {
        return millis(value * 60 * 1000);
    }
    try {
        return new NormalizedTimeUnit(value, TimeUnit.valueOf(candidate));
    } catch (Exception e) {
        throw new InvalidUserDataException("Unable to parse provided TimeUnit: " + notation, e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:TimeUnitsParser.java


示例12: getTasksByName

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public Set<Task> getTasksByName(final String name, boolean recursive) {
    if (!isTrue(name)) {
        throw new InvalidUserDataException("Name is not specified!");
    }
    final Set<Task> foundTasks = new HashSet<Task>();
    Action<Project> action = new Action<Project>() {
        public void execute(Project project) {
            // Don't force evaluation of rules here, let the task container do what it needs to
            ((ProjectInternal) project).evaluate();

            Task task = project.getTasks().findByName(name);
            if (task != null) {
                foundTasks.add(task);
            }
        }
    };
    if (recursive) {
        allprojects(action);
    } else {
        action.execute(this);
    }
    return foundTasks;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:DefaultProject.java


示例13: create

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
@Override
public <S extends TaskInternal> S create(String name, final Class<S> type) {
    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 Task> generatedType;
    if (type.isAssignableFrom(DefaultTask.class)) {
        generatedType = generator.generate(DefaultTask.class);
    } else {
        generatedType = generator.generate(type);
    }

    return type.cast(AbstractTask.injectIntoNewInstance(project, name, type, new Callable<Task>() {
        public Task call() throws Exception {
            try {
                return instantiator.newInstance(generatedType);
            } catch (ObjectInstantiationException e) {
                throw new TaskInstantiationException(String.format("Could not create task of type '%s'.", type.getSimpleName()),
                        e.getCause());
            }
        }
    }));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:27,代码来源:TaskFactory.java


示例14: findByPath

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public Task findByPath(String path) {
    if (!GUtil.isTrue(path)) {
        throw new InvalidUserDataException("A path must be specified!");
    }
    if (!path.contains(Project.PATH_SEPARATOR)) {
        return findByName(path);
    }

    String projectPath = StringUtils.substringBeforeLast(path, Project.PATH_SEPARATOR);
    ProjectInternal project = this.project.findProject(!GUtil.isTrue(projectPath) ? Project.PATH_SEPARATOR : projectPath);
    if (project == null) {
        return null;
    }
    projectAccessListener.beforeRequestingTaskByPath(project);

    return project.getTasks().findByName(StringUtils.substringAfterLast(path, Project.PATH_SEPARATOR));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:DefaultTaskContainer.java


示例15: execute

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
    List<String> messages = new ArrayList<String>();
    for (TaskValidator validator : task.getValidators()) {
        validator.validate(task, messages);
    }
    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 {
            errorMessage = String.format("Some problems were found with the configuration of %s.", task);
        }
        state.setOutcome(new TaskValidationException(errorMessage, causes));
        return;
    }
    executer.execute(task, state, context);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:ValidatingTaskExecuter.java


示例16: readProperties

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
protected PgpSignatory readProperties(Project project, String prefix, String name, boolean required) {
    ArrayList<Object> values = new ArrayList<Object>();
    for (String property : PROPERTIES) {
        String qualifiedProperty = (String)getQualifiedPropertyName(prefix, property);
        if (project.hasProperty(qualifiedProperty)) {
            values.add(
                project.property(qualifiedProperty));
        } else {
            if (required) {
                throw new InvalidUserDataException("property \'" + qualifiedProperty + "\' could not be found on project and is needed for signing");
            } else {
                return null;
            }
        }
    }

    String keyId = values.get(0).toString();
    File keyRing = project.file(values.get(1).toString());
    String password = values.get(2).toString();
    return createSignatory(name, keyId, keyRing, password);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:22,代码来源:PgpSignatoryFactory.java


示例17: add

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
protected <N extends T> N add(Class<N> clazz, Object... constructionArgs) {
    N report = getInstantiator().newInstance(clazz, constructionArgs);

    if (report.getName().equals("enabled")) {
        throw new InvalidUserDataException("Reports that are part of a ReportContainer cannot be named 'enabled'");
    }

    getStore().add(report);
    index();
    return report;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultReportContainer.java


示例18: AbstractExternalModuleDependency

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:AbstractExternalModuleDependency.java


示例19: exports

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
@Override
public void exports(String value) {
    validatePackageName(value);
    if (!exports.add(value)) {
        throw new InvalidUserDataException(
            format("Invalid public API specification: package '%s' has already been exported", value));
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultJvmApiSpec.java


示例20: validatePackageName

import org.gradle.api.InvalidUserDataException; //导入依赖的package包/类
private void validatePackageName(String value) {
    try {
        JvmPackageName.of(value);
    } catch (IllegalArgumentException cause) {
        throw new InvalidUserDataException(
            format("Invalid public API specification: %s", cause.getMessage()), cause);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultJvmApiSpec.java



注:本文中的org.gradle.api.InvalidUserDataException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Strings类代码示例发布时间:2022-05-22
下一篇:
Java READDIR3Response类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap