org.gradle.api.artifacts.Configuration.getResolutionStrategy()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.gradle.api.artifacts.Configuration.getResolutionStrategy()方法的一些代码示例,展示了Configuration.getResolutionStrategy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getResolutionStrategy()方法的具体详情如下:
包路径:org.gradle.api.artifacts.Configuration
类名称:Configuration
方法名:getResolutionStrategy

Configuration.getResolutionStrategy介绍

暂无

代码示例

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

@Override
public void execute(Configuration configuration) {
  action.execute(configuration.getResolutionStrategy());
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

@Override
public void configure(Configuration configuration) {
  configuration.getResolutionStrategy().eachDependency(versionConfiguringAction);
}

代码示例来源:origin: gradle.plugin.co.kaiba.gradle/aether-gradle-plugin

@Override
  public void execute(Configuration configuration) {
    configuration.getResolutionStrategy().eachDependency(new VersionResolverDependencyResolveDetails(project, configuration, aetherPlugin));
  }
}

代码示例来源:origin: gradle.plugin.com.prezi.pride/gradle-pride-plugin

@Override
  public void execute(Configuration configuration) {
    configuration.getResolutionStrategy().getDependencySubstitution().all(new ReplaceDependenciesAction(projects));
  }
});

代码示例来源:origin: prezi/pride

@Override
  public void execute(Configuration configuration) {
    configuration.getResolutionStrategy().getDependencySubstitution().all(new ReplaceDependenciesAction(projects));
  }
});

代码示例来源:origin: diffplug/goomph

public void useNativesForRunningPlatform() {
  project.getConfigurations().all(config -> {
    config.getResolutionStrategy().eachDependency(details -> {
      ModuleVersionSelector req = details.getRequested();
      if (req.getName().contains($_OSGI_PLATFORM)) {
        String running = SwtPlatform.getRunning().toString();
        details.useTarget(req.getGroup() + ":" + req.getName().replace($_OSGI_PLATFORM, running) + ":" + req.getVersion());
      }
    });
  });
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

configuration.getResolutionStrategy().eachDependency(versionConfiguringAction);

代码示例来源:origin: CoffeePartner/capt

@Override
public VariantScope create(BaseVariant v) {
  ConfigurationContainer configurations = project.getConfigurations();
  // the actual configuration
  Configuration configuration = getByVariant(v.getName());
  // attributes match
  AttributeContainer attributes = configuration.getAttributes();
  attributes
      .attribute(ARTIFACT_TYPE, ArtifactTypeDefinition.JAR_TYPE)
      .attribute(BuildTypeAttr.ATTRIBUTE, project.getObjects().named(BuildTypeAttr.class, v.getBuildType().getName()))
      .attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME));
  v.getProductFlavors().forEach(p -> attributes.attribute(Attribute.of(p.getDimension(), ProductFlavorAttr.class),
      project.getObjects().named(ProductFlavorAttr.class, p.getName())));
  configuration.setDescription("Resolved configuration for capt for variant: " + v.getName());
  configuration.setVisible(false);
  configuration.setCanBeConsumed(false);
  configuration.getResolutionStrategy().sortArtifacts(ResolutionStrategy.SortOrder.CONSUMER_FIRST);
  v.getSourceSets().stream()
      .map(SourceProvider::getName)
      .map(VariantManager::sourceSetToConfigurationName)
      .map(configurations::getByName)
      .forEach(configuration::extendsFrom);
  return new VariantScope(v.getName(), configuration, global);
}

代码示例来源:origin: linkedin/pygradle

.forEach(configuration -> configuration.getResolutionStrategy().eachDependency(dependencyResolveDetails));

代码示例来源:origin: gradle.plugin.com.linkedin.pygradle/pygradle-plugin

.forEach(configuration -> configuration.getResolutionStrategy().eachDependency(dependencyResolveDetails));

代码示例来源:origin: gradle.plugin.com.github.krs.xrepo-gradle-plugin/xrepo-gradle-plugin

private static void useSuffixedVersions(final Configuration groupDeps, final XRepoConfiguration config, final Project project) {
  groupDeps.getResolutionStrategy().eachDependency(dependency -> {
    if (isInSameGroup(dependency, project) && !versionEndsWith(dependency, config.getVersionSuffix())) {
      debug(project, "Will look for version suffixed {} for {}:{}:{}", config.getVersionSuffix(),
          dependency.getRequested().getGroup(), dependency.getRequested().getName(), dependency.getRequested().getVersion());
      dependency.useVersion(suffixed(dependency, config.getVersionSuffix()));
    }
  });
}

代码示例来源:origin: gradle.plugin.com.github.krs.xrepo-gradle-plugin/xrepo-gradle-plugin

private static void overwriteDependencies(final Configuration conf, final DependencyOverwrites dependencyOverwrites,
                     final XRepoConfiguration config, final Project project) {
  conf.getResolutionStrategy().eachDependency(dependency -> {
    if (isInSameGroup(dependency, project)) {
      final String overwrittenVersion = suffixed(dependency, config.getVersionSuffix());
      if (dependencyOverwrites.contains(dependency, overwrittenVersion)) {
        info(project, "Using overwritten dependency {}:{}:{}",
            dependency.getRequested().getGroup(), dependency.getRequested().getName(), overwrittenVersion);
        dependency.useVersion(overwrittenVersion);
      } else {
        final String fallbackSuffix = config.getFallbackSuffix();
        if (!fallbackSuffix.isEmpty()
            && !versionEndsWith(dependency, config.getVersionSuffix())
            && !versionEndsWith(dependency, fallbackSuffix)) {
          final String fallbackVersion = suffixed(dependency, fallbackSuffix);
          info(project, "Using fallback dependency {}:{}:{}",
              dependency.getRequested().getGroup(), dependency.getRequested().getName(), fallbackVersion);
          dependency.useVersion(fallbackVersion);
        }
      }
    }
  });
}

相关文章