本文整理汇总了Java中org.gradle.api.artifacts.dsl.DependencyHandler类的典型用法代码示例。如果您正苦于以下问题:Java DependencyHandler类的具体用法?Java DependencyHandler怎么用?Java DependencyHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DependencyHandler类属于org.gradle.api.artifacts.dsl包,在下文中一共展示了DependencyHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PlayPluginConfigurations
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
public PlayPluginConfigurations(ConfigurationContainer configurations, DependencyHandler dependencyHandler) {
this.configurations = configurations;
this.dependencyHandler = dependencyHandler;
Configuration playPlatform = configurations.create(PLATFORM_CONFIGURATION);
Configuration playCompile = configurations.create(COMPILE_CONFIGURATION);
playCompile.extendsFrom(playPlatform);
Configuration playRun = configurations.create(RUN_CONFIGURATION);
playRun.extendsFrom(playCompile);
Configuration playTestCompile = configurations.create(TEST_COMPILE_CONFIGURATION);
playTestCompile.extendsFrom(playCompile);
configurations.maybeCreate(Dependency.DEFAULT_CONFIGURATION).extendsFrom(playCompile);
}
示例2: addStandardJavaTestDependencies
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
private static void addStandardJavaTestDependencies(Project project) {
Configuration testConfiguration =
project.getPlugins().hasPlugin(JavaLibraryPlugin.class)
? project
.getConfigurations()
.getByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME)
: project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME);
DependencyHandler dependencies = project.getDependencies();
dependencies.add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, "com.google.code.findbugs:jsr305");
dependencies.add(testConfiguration.getName(), "org.curioswitch.curiostack:curio-testing-framework");
dependencies.add(testConfiguration.getName(), "org.assertj:assertj-core");
dependencies.add(testConfiguration.getName(), "org.awaitility:awaitility");
dependencies.add(testConfiguration.getName(), "junit:junit");
dependencies.add(testConfiguration.getName(), "org.mockito:mockito-core");
dependencies.add(testConfiguration.getName(), "info.solidsoft.mockito:mockito-java8");
}
示例3: initialize
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
/**
* @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize()
*/
@Override
public void initialize() {
getProject().getPluginManager().apply(ProjectConfigPlugin.class);
getProject().getPluginManager().apply(JavaConfigPlugin.class);
getProject().getPluginManager().apply(GroovyConfigPlugin.class);
getProject().getPluginManager().apply(JavaGradlePluginPlugin.class);
DependencyHandler dependencies = getProject().getDependencies();
dependencies.add("compile", dependencies.gradleApi());
dependencies.add("compile", dependencies.localGroovy());
dependencies.add("testCompile", dependencies.gradleTestKit());
dependencies.add("testCompile", "me.seeber.gradle:gradle-test-kit:1.1.1");
}
示例4: initialize
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
/**
* @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize()
*/
@Override
protected void initialize() {
getProject().getPluginManager().apply(GroovyPlugin.class);
getProject().getPluginManager().apply(JavaConfigPlugin.class);
DependencyHandler dependencies = getProject().getDependencies();
ExternalDependency spock = (ExternalDependency) dependencies.add("testCompile",
ImmutableMap.of("group", "org.spockframework", "name", "spock-core", "version", "1.0-groovy-2.4"));
spock.exclude(ImmutableMap.of("group", "org.codehaus.groovy", "module", "groovy-all"));
String name = Validate.notNull(getProject().getName());
Configuration archives = getProject().getConfigurations().getByName("archives");
Jar groovydocJar = getProject().getTasks().create("groovydocJar", Jar.class);
PublishArtifact groovydocArtifact = Projects.createJarPublishArtifact(getProject(), name, "groovydoc", "jar",
"jar", groovydocJar);
archives.getArtifacts().add(groovydocArtifact);
}
示例5: testSimplePluginApply
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
@Test
public void testSimplePluginApply() {
Project project = ProjectBuilder.builder().build();
DependencyHandler dependencyHandler = project.getDependencies();
Dependency pluginDependency = dependencyHandler.create("de.dynamicfiles.projects.gradle.plugins:javafx-gradle-plugin:+");
project.getBuildscript().getDependencies().add("classpath", pluginDependency);
assertFalse(project.getPlugins().hasPlugin("java"));
project.getPluginManager().apply("java");
assertTrue(project.getPlugins().hasPlugin("java"));
assertFalse(project.getPlugins().hasPlugin("javafx-gradle-plugin"));
project.getPluginManager().apply("javafx-gradle-plugin");
assertTrue(project.getPlugins().hasPlugin("javafx-gradle-plugin"));
}
示例6: preVariantWork
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
@Override
public void preVariantWork(final Project project) {
final TestAndroidConfig testExtension = (TestAndroidConfig) extension;
String path = testExtension.getTargetProjectPath();
if (path == null) {
throw new GradleException(
"targetProjectPath cannot be null in test project " + project.getName());
}
if (testExtension.getTargetVariant() == null) {
throw new GradleException(
"targetVariant cannot be null in test project " + project.getName());
}
DependencyHandler handler = project.getDependencies();
handler.add("provided", handler.project(ImmutableMap.of(
"path", path,
"configuration", testExtension.getTargetVariant() + "-classes"
)));
}
示例7: addConfiguration
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
private void addConfiguration(final Project project, final SonarRunnerRootExtension rootExtension) {
final Configuration configuration = project.getConfigurations().create(SonarRunnerExtension.SONAR_RUNNER_CONFIGURATION_NAME);
configuration
.setVisible(false)
.setTransitive(false)
.setDescription("The SonarRunner configuration to use to run analysis")
.getIncoming()
.beforeResolve(new Action<ResolvableDependencies>() {
public void execute(ResolvableDependencies resolvableDependencies) {
DependencySet dependencies = resolvableDependencies.getDependencies();
if (dependencies.isEmpty()) {
String toolVersion = rootExtension.getToolVersion();
DependencyHandler dependencyHandler = project.getDependencies();
Dependency dependency = dependencyHandler.create("org.codehaus.sonar.runner:sonar-runner-dist:" + toolVersion);
configuration.getDependencies().add(dependency);
}
}
});
}
示例8: extractRepoFileDependencies
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
public Collection<IdeExtendedRepoFileDependency> extractRepoFileDependencies(DependencyHandler dependencyHandler, Collection<Configuration> plusConfigurations, Collection<Configuration> minusConfigurations, boolean downloadSources, boolean downloadJavadoc) {
// can have multiple IDE dependencies with same component identifier (see GRADLE-1622)
Multimap<ComponentIdentifier, IdeExtendedRepoFileDependency> resolvedDependenciesComponentMap = LinkedHashMultimap.create();
for (IdeExtendedRepoFileDependency dep : resolvedExternalDependencies(plusConfigurations, minusConfigurations)) {
resolvedDependenciesComponentMap.put(toComponentIdentifier(dep.getId()), dep);
}
List<Class<? extends Artifact>> artifactTypes = new ArrayList<Class<? extends Artifact>>(2);
if (downloadSources) {
artifactTypes.add(SourcesArtifact.class);
}
if (downloadJavadoc) {
artifactTypes.add(JavadocArtifact.class);
}
downloadAuxiliaryArtifacts(dependencyHandler, resolvedDependenciesComponentMap, artifactTypes);
Collection<UnresolvedIdeRepoFileDependency> unresolvedDependencies = unresolvedExternalDependencies(plusConfigurations, minusConfigurations);
Collection<IdeExtendedRepoFileDependency> resolvedDependencies = resolvedDependenciesComponentMap.values();
Collection<IdeExtendedRepoFileDependency> resolvedAndUnresolved = new ArrayList<IdeExtendedRepoFileDependency>(unresolvedDependencies.size() + resolvedDependencies.size());
resolvedAndUnresolved.addAll(resolvedDependencies);
resolvedAndUnresolved.addAll(unresolvedDependencies);
return resolvedAndUnresolved;
}
示例9: setupKotlinHome
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void setupKotlinHome(Project project, String kotlinVersion) {
Configuration kotlinConfig = project.getConfigurations().maybeCreate(KOTLIN_DEPS_CONFIG);
DependencyHandler handler = project.getDependencies();
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_COMPILER_MODULE, kotlinVersion));
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_STDLIB_MODULE, kotlinVersion));
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_ANDROID_EXTENSIONS_MODULE, kotlinVersion));
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_REFLECT_MODULE, kotlinVersion));
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_SCRIPT_RUNTIME_MODULE, kotlinVersion));
handler.add(KOTLIN_DEPS_CONFIG, String.format("%s:%s:%s", KOTLIN_GROUP, KOTLIN_ANNOTATION_PROCESSING_MODULE, kotlinVersion));
new DependencyCache(project, DependencyUtils.createCacheDir(project, KOTLIN_LIBRARIES_LOCATION)).build(kotlinConfig);
Path kotlinLibraries = project.file(KOTLIN_LIBRARIES_LOCATION).toPath();
removeVersions(kotlinLibraries, KOTLIN_COMPILER_MODULE, "kotlin-compiler");
removeVersions(kotlinLibraries, KOTLIN_STDLIB_MODULE);
removeVersions(kotlinLibraries, KOTLIN_ANDROID_EXTENSIONS_MODULE);
removeVersions(kotlinLibraries, KOTLIN_REFLECT_MODULE);
removeVersions(kotlinLibraries, KOTLIN_SCRIPT_RUNTIME_MODULE);
removeVersions(kotlinLibraries, KOTLIN_ANNOTATION_PROCESSING_MODULE);
}
示例10: configureDefaultRhinoDependency
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
public void configureDefaultRhinoDependency(Configuration configuration, final DependencyHandler dependencyHandler, final RhinoExtension extension) {
configuration.defaultDependencies(new Action<DependencySet>() {
public void execute(DependencySet dependencies) {
Dependency dependency = dependencyHandler.create(RhinoExtension.DEFAULT_RHINO_DEPENDENCY_GROUP + ":" + RhinoExtension.DEFAULT_RHINO_DEPENDENCY_MODULE + ":" + extension.getVersion());
dependencies.add(dependency);
}
});
}
示例11: addConfiguration
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final JsHintExtension extension) {
Configuration configuration = configurations.create(JsHintExtension.CONFIGURATION_NAME);
configuration.defaultDependencies(new Action<DependencySet>() {
@Override
public void execute(DependencySet configDependencies) {
String notation = JsHintExtension.DEFAULT_DEPENDENCY_GROUP + ":" + JsHintExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
Dependency dependency = dependencies.create(notation);
configDependencies.add(dependency);
}
});
return configuration;
}
示例12: addConfiguration
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的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;
}
示例13: addJsConfiguration
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的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;
}
示例14: createDependencyHandler
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
DependencyHandler createDependencyHandler(Instantiator instantiator, ConfigurationContainerInternal configurationContainer, DependencyFactory dependencyFactory,
ProjectFinder projectFinder, ComponentMetadataHandler componentMetadataHandler, ComponentModuleMetadataHandler componentModuleMetadataHandler, ArtifactResolutionQueryFactory resolutionQueryFactory) {
return instantiator.newInstance(DefaultDependencyHandler.class,
configurationContainer,
dependencyFactory,
projectFinder,
componentMetadataHandler,
componentModuleMetadataHandler,
resolutionQueryFactory);
}
示例15: execute
import org.gradle.api.artifacts.dsl.DependencyHandler; //导入依赖的package包/类
@Override
public void execute(Project project) {
DependencyHandler dependencies = project.getDependencies();
Set<SourceSet> testSourceSets = extension.getTestSourceSets();
for (SourceSet testSourceSet : testSourceSets) {
String compileConfigurationName = testSourceSet.getCompileConfigurationName();
dependencies.add(compileConfigurationName, dependencies.gradleTestKit());
String runtimeConfigurationName = testSourceSet.getRuntimeConfigurationName();
dependencies.add(runtimeConfigurationName, project.files(pluginClasspathTask));
}
}