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

Java Dependency类代码示例

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

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



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

示例1: getBundleDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private Set<String> getBundleDependencies(Configuration compileClasspath,
                                          Set<? extends DependencyResult> bundleDependencies) {
    Set<String> bundleSets = new HashSet<>();
    for (DependencyResult dependencyResult : bundleDependencies) {
        bundleSets.add(dependencyResult.toString());
    }
    for (Dependency dependency : compileClasspath.getAllDependencies()) {
        if (dependency instanceof DefaultExternalModuleDependency) {
            DefaultExternalModuleDependency externalModuleDependency = (DefaultExternalModuleDependency)dependency;
            if (!((DefaultExternalModuleDependency)dependency).getArtifacts().isEmpty()) {
                if (StringUtils.equalsIgnoreCase("awb", ((DefaultExternalModuleDependency)dependency).getArtifacts()
                    .iterator().next().getType())) {
                    bundleSets.add(
                        dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion());
                }
            }
        }
    }
    return bundleSets;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:21,代码来源:DependencyGroup.java


示例2: resolvePluginDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) {
    DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create();

    RepositoryHandler repositories = resolution.getResolveRepositoryHandler();
    final String repoUrl = metadata.implementation.get("repo");
    repositories.maven(new Action<MavenArtifactRepository>() {
        public void execute(MavenArtifactRepository mavenArtifactRepository) {
            mavenArtifactRepository.setUrl(repoUrl);
        }
    });

    Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav"));

    ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer();
    ConfigurationInternal configuration = configurations.detachedConfiguration(dependency);

    try {
        Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll());
        return new DefaultClassPath(files);
    } catch (ResolveException e) {
        throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:PluginResolutionServiceResolver.java


示例3: doGetTaskDependency

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private TaskDependency doGetTaskDependency(Spec<? super Dependency> dependencySpec, AttributeContainerInternal requestedAttributes) {
    synchronized (resolutionLock) {
        if (resolutionStrategy.resolveGraphToDetermineTaskDependencies()) {
            // Force graph resolution as this is required to calculate build dependencies
            resolveToStateOrLater(GRAPH_RESOLVED);
        }
        ResolverResults results;
        if (getState() == State.UNRESOLVED) {
            // Traverse graph
            results = new DefaultResolverResults();
            resolver.resolveBuildDependencies(this, results);
        } else {
            // Otherwise, already have a result, so reuse it
            results = cachedResolverResults;
        }
        List<Object> buildDependencies = new ArrayList<Object>();
        results.getVisitedArtifacts().select(dependencySpec, requestedAttributes).collectBuildDependencies(buildDependencies);
        return TaskDependencies.of(buildDependencies);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DefaultConfiguration.java


示例4: getIdeLocalFileDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
/**
 * Gets IDE local file dependencies.
 *
 * @param configuration Configuration
 * @return IDE local file dependencies
 */
public List<IdeLocalFileDependency> getIdeLocalFileDependencies(Configuration configuration) {
    List<SelfResolvingDependency> externalDependencies = new ArrayList<SelfResolvingDependency>();
    findAllExternalDependencies(externalDependencies, new ArrayList<Dependency>(), configuration);
    List<IdeLocalFileDependency> ideLocalFileDependencies = new ArrayList<IdeLocalFileDependency>();

    for (SelfResolvingDependency externalDependency : externalDependencies) {
        Set<File> resolvedFiles = externalDependency.resolve();

        for (File resolvedFile : resolvedFiles) {
            IdeLocalFileDependency ideLocalFileDependency = new IdeLocalFileDependency(resolvedFile);
            ideLocalFileDependencies.add(ideLocalFileDependency);
        }
    }

    return ideLocalFileDependencies;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:DefaultIdeDependencyResolver.java


示例5: getBaseApFile

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private File getBaseApFile(Project project, TBuildType tBuildType) {
    File apBaseFile;
    File buildTypeBaseApFile = tBuildType.getBaseApFile();
    if (null != buildTypeBaseApFile && buildTypeBaseApFile.exists()) {
        apBaseFile = buildTypeBaseApFile;
    } else if (!isNullOrEmpty(tBuildType.getBaseApDependency())) {
        String apDependency = tBuildType.getBaseApDependency();
        // Preconditions.checkNotNull(apDependency,
        //                            "You have to specify the baseApFile property or the baseApDependency
        // dependency");
        Dependency dependency = project.getDependencies().create(apDependency);
        Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
        configuration.setTransitive(false);
        apBaseFile = Iterables.getOnlyElement(Collections2.filter(configuration.getFiles(), new Predicate<File>() {
            @Override
            public boolean apply(@Nullable File file) {
                return file.getName().endsWith(".ap");
            }
        }));
    } else {
        throw new IllegalStateException("AP is missing");
    }
    return apBaseFile;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:25,代码来源:ApDependencies.java


示例6: configureInstall

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private void configureInstall(Project project) {
    Upload installUpload = project.getTasks().create(INSTALL_TASK_NAME, Upload.class);
    Configuration configuration = project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION);
    installUpload.setConfiguration(configuration);
    MavenRepositoryHandlerConvention repositories = new DslObject(installUpload.getRepositories()).getConvention().getPlugin(MavenRepositoryHandlerConvention.class);
    repositories.mavenInstaller();
    installUpload.setDescription("Installs the 'archives' artifacts into the local Maven repository.");
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:MavenPlugin.java


示例7: configureConfigurations

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private void configureConfigurations(final Project project) {

        ConfigurationContainer configurations = project.getConfigurations();
        Configuration moduleConfiguration = configurations.create(DEPLOY_CONFIGURATION_NAME).setVisible(false)
                .setTransitive(false).setDescription("Classpath for deployable modules, not transitive.");
        Configuration earlibConfiguration = configurations.create(EARLIB_CONFIGURATION_NAME).setVisible(false)
                .setDescription("Classpath for module dependencies.");

        configurations.getByName(Dependency.DEFAULT_CONFIGURATION)
                .extendsFrom(moduleConfiguration, earlibConfiguration);
    }
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:EarPlugin.java


示例8: addConfiguration

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final EnvJsExtension extension) {
    Configuration configuration = configurations.create(EnvJsExtension.CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet configDependencies) {
            String notation = EnvJsExtension.DEFAULT_DEPENDENCY_GROUP + ":" + EnvJsExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }

    });
    return configuration;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:EnvJsPlugin.java


示例9: addJsConfiguration

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private Configuration addJsConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final CoffeeScriptExtension extension) {
    Configuration configuration = configurations.create(CoffeeScriptExtension.JS_CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {
        @Override
        public void execute(DependencySet configDependencies) {
            String notation = CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_GROUP + ":" + CoffeeScriptExtension.DEFAULT_JS_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }
    });
    return configuration;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:CoffeeScriptBasePlugin.java


示例10: exists

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private boolean exists(PluginRequest request) {
    // This works because the corresponding BackedByArtifactRepository PluginRepository sets
    // registers an ArtifactRepository in the DependencyResolutionServices instance which is
    // exclusively used by this ArtifactRepositoryPluginResolver. If the plugin marker
    // doesn't exist in that isolated ArtifactRepository, this resolver won't look anywhere else.
    Dependency dependency = resolution.getDependencyHandler().create(getMarkerCoordinates(request));

    ConfigurationContainer configurations = resolution.getConfigurationContainer();
    Configuration configuration = configurations.detachedConfiguration(dependency);
    configuration.setTransitive(false);

    return !configuration.getResolvedConfiguration().hasError();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:ArtifactRepositoryPluginResolver.java


示例11: getFirstLevelModuleDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) {
    Set<ResolvedDependency> matches = new LinkedHashSet<ResolvedDependency>();
    for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
        matches.add(node.getPublicView());
    }
    return matches;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultLenientConfiguration.java


示例12: getFirstLevelNodes

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private Set<DependencyGraphNodeResult> getFirstLevelNodes(Spec<? super Dependency> dependencySpec) {
    Set<DependencyGraphNodeResult> matches = new LinkedHashSet<DependencyGraphNodeResult>();
    TransientConfigurationResults graphResults = loadTransientGraphResults(selectedArtifacts);
    for (Map.Entry<ModuleDependency, DependencyGraphNodeResult> entry : graphResults.getFirstLevelDependencies().entrySet()) {
        if (dependencySpec.isSatisfiedBy(entry.getKey())) {
            matches.add(entry.getValue());
        }
    }
    return matches;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultLenientConfiguration.java


示例13: getFiles

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
/**
 * Recursive but excludes unsuccessfully resolved artifacts.
 */
public Set<File> getFiles(Spec<? super Dependency> dependencySpec) {
    Set<File> files = Sets.newLinkedHashSet();
    FilesAndArtifactCollectingVisitor visitor = new FilesAndArtifactCollectingVisitor(files);
    visitArtifacts(dependencySpec, configuration.getAttributes(), selectedArtifacts, selectedFileDependencies, visitor);
    files.addAll(getFiles(filterUnresolved(visitor.artifacts)));
    return files;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultLenientConfiguration.java


示例14: visitArtifacts

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
/**
 * Recursive, includes unsuccessfully resolved artifacts
 *
 * @param dependencySpec dependency spec
 */
private void visitArtifacts(Spec<? super Dependency> dependencySpec, AttributeContainerInternal requestedAttributes, SelectedArtifactResults artifactResults, SelectedFileDependencyResults fileDependencyResults, ArtifactVisitor visitor) {
    ArtifactVisitor transformingVisitor = artifactTransformer.visitor(visitor, requestedAttributes);

    //this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends
    //avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario
    if (dependencySpec == Specs.SATISFIES_ALL) {
        if (transformingVisitor.includeFiles()) {
            fileDependencyResults.getFiles().visit(transformingVisitor);
        }
        artifactResults.getArtifacts().visit(transformingVisitor);
        return;
    }

    if (transformingVisitor.includeFiles()) {
        for (Map.Entry<FileCollectionDependency, ResolvedArtifactSet> entry: fileDependencyResults.getFirstLevelFiles().entrySet()) {
            if (dependencySpec.isSatisfiedBy(entry.getKey())) {
                entry.getValue().visit(transformingVisitor);
            }
        }
    }

    CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact> walker = new CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph(transformingVisitor, fileDependencyResults));

    DependencyGraphNodeResult rootNode = loadTransientGraphResults(artifactResults).getRootNode();
    for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
        node.getArtifactsForIncomingEdge(rootNode).visit(transformingVisitor);
        walker.add(node);
    }
    walker.findValues();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:36,代码来源:DefaultLenientConfiguration.java


示例15: getArtifacts

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
@Override
public Set<ResolvedArtifact> getArtifacts(Spec<? super Dependency> dependencySpec) {
    try {
        return lenientConfiguration.getArtifacts(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ErrorHandlingConfigurationResolver.java


示例16: getFirstLevelModuleDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) {
    try {
        return lenientConfiguration.getFirstLevelModuleDependencies(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ErrorHandlingConfigurationResolver.java


示例17: getFiles

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
@Override
public Set<File> getFiles(Spec<? super Dependency> dependencySpec) {
    try {
        return lenientConfiguration.getFiles(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, resolveContext);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ErrorHandlingConfigurationResolver.java


示例18: addDependencies

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private void addDependencies(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
    AttributeContainerInternal attributes = configuration.getAttributes().asImmutable();
    for (Dependency dependency : configuration.getDependencies()) {
        if (dependency instanceof ModuleDependency) {
            ModuleDependency moduleDependency = (ModuleDependency) dependency;
            metaData.addDependency(dependencyDescriptorFactory.createDependencyDescriptor(configuration.getName(), attributes, moduleDependency));
        } else if (dependency instanceof FileCollectionDependency) {
            final FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
            metaData.addFiles(configuration.getName(), new DefaultLocalFileDependencyMetadata(fileDependency));
        } else {
            throw new IllegalArgumentException("Cannot convert dependency " + dependency + " to local component dependency metadata.");
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:DefaultDependenciesToModuleDescriptorConverter.java


示例19: ensureConfigured

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private void ensureConfigured(Configuration config) {
    for (Dependency dependency : config.getAllDependencies()) {
        if (dependency instanceof ProjectDependency) {
            ProjectDependency projectDependency = (ProjectDependency)dependency;
            project.evaluationDependsOn(projectDependency.getDependencyProject().getPath());
        }
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:9,代码来源:AtlasDepTreeParser.java


示例20: ConfigurationFileCollection

import org.gradle.api.artifacts.Dependency; //导入依赖的package包/类
private ConfigurationFileCollection(final Set<Dependency> dependencies) {
    this(new Spec<Dependency>() {
        public boolean isSatisfiedBy(Dependency element) {
            return dependencies.contains(element);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultConfiguration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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