Java Code Examples for org.gradle.api.project#getDependencies()

The following examples show how to use org.gradle.api.project#getDependencies() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradleProjectTest.java    From jig with Apache License 2.0 6 votes vote down vote up
private static Project _3階層構造でcompile依存Javaプロジェクトが2つあるJavaプロジェクト(Path tempDir) {
    Project root = javaProjectOf("3階層構造でcompile依存Javaプロジェクトが2つあるJavaプロジェクト", tempDir);
    DependencyHandler dependencies = root.getDependencies();

    ProjectInternal javaChild = javaProjectOf("javaChild", tempDir);
    Stream<ProjectInternal> children = Stream.of(
            projectOf("nonJavaChild", tempDir),
            javaChild
    );
    children
            .map(GradleProjectTest::dependencyOf)
            .forEach(dependency -> dependencies.add("compile", dependency));


    DependencyHandler javaChildDependencies = javaChild.getDependencies();
    Stream<ProjectInternal> grandsons = Stream.of(
            projectOf("nonJavaGrandson", tempDir),
            javaProjectOf("javaGrandson", tempDir)
    );
    grandsons
            .map(GradleProjectTest::dependencyOf)
            .forEach(dependency -> javaChildDependencies.add("compile", dependency));
    return root;
}
 
Example 2
Source File: GradleProjectTest.java    From jig with Apache License 2.0 6 votes vote down vote up
private static Project _3階層構造でimplementation依存Javaプロジェクトが2つあるJavaプロジェクト(Path tempDir) {
    Project root = javaProjectOf("3階層構造でimplementation依存Javaプロジェクトが2つあるJavaプロジェクト", tempDir);
    DependencyHandler dependencies = root.getDependencies();

    ProjectInternal javaChild = javaProjectOf("javaChild", tempDir);
    Stream<ProjectInternal> children = Stream.of(
            projectOf("nonJavaChild", tempDir),
            javaChild
    );
    children
            .map(GradleProjectTest::dependencyOf)
            .forEach(dependency -> dependencies.add("implementation", dependency));


    DependencyHandler javaChildDependencies = javaChild.getDependencies();
    Stream<ProjectInternal> grandsons = Stream.of(
            projectOf("nonJavaGrandson", tempDir),
            javaProjectOf("javaGrandson", tempDir)
    );
    grandsons
            .map(GradleProjectTest::dependencyOf)
            .forEach(dependency -> javaChildDependencies.add("implementation", dependency));
    return root;
}
 
Example 3
Source File: CuriostackRootPlugin.java    From curiostack with MIT License 6 votes vote down vote up
private static void addStandardJavaTestDependencies(Project project) {
  DependencyHandler dependencies = project.getDependencies();

  dependencies.add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, "com.google.code.findbugs:jsr305");
  dependencies.add(
      JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME,
      "org.curioswitch.curiostack:curio-testing-framework");
  dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.assertj:assertj-core");
  dependencies.add(
      JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.awaitility:awaitility");
  dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "junit:junit");
  dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.mockito:mockito-core");
  dependencies.add(
      JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.mockito:mockito-junit-jupiter");
  dependencies.add(
      JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "info.solidsoft.mockito:mockito-java8");

  dependencies.add(
      JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-api");
  dependencies.add(
      JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-engine");
  dependencies.add(
      JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.vintage:junit-vintage-engine");
}
 
Example 4
Source File: AtlasDependencyGraph.java    From atlas with Apache License 2.0 5 votes vote down vote up
private static void handleSources(
        @NonNull Project project,
        @NonNull Set<ComponentIdentifier> artifacts,
        @NonNull Consumer<SyncIssue> failureConsumer) {
    final DependencyHandler dependencies = project.getDependencies();

    try {
        ArtifactResolutionQuery query = dependencies.createArtifactResolutionQuery();
        query.forComponents(artifacts);

        @SuppressWarnings("unchecked")
        Class<? extends Artifact>[] artifactTypesArray =
                (Class<? extends Artifact>[]) new Class<?>[] {SourcesArtifact.class};
        query.withArtifacts(JvmLibrary.class, artifactTypesArray);
        query.execute().getResolvedComponents();
    } catch (Throwable t) {
        DependencyFailureHandlerKt.processDependencyThrowable(
                t,
                s -> null,
                (data, messages) ->
                        failureConsumer.accept(
                                new SyncIssueImpl(
                                        SyncIssue.TYPE_GENERIC,
                                        SyncIssue.SEVERITY_WARNING,
                                        null,
                                        String.format(
                                                "Unable to download sources: %s",
                                                messages.get(0)),
                                        messages)));
    }
}
 
Example 5
Source File: JapicmpTask.java    From japicmp-gradle-plugin with Apache License 2.0 5 votes vote down vote up
private Configuration resolveJaxb() {
    Project project = getProject();
    DependencyHandler dependencies = project.getDependencies();
    return project.getConfigurations().detachedConfiguration(
            dependencies.create("javax.xml.bind:jaxb-api:2.3.0"),
            dependencies.create("com.sun.xml.bind:jaxb-core:2.3.0.1"),
            dependencies.create("com.sun.xml.bind:jaxb-impl:2.3.0.1"),
            dependencies.create("javax.activation:activation:1.1.1")
    );
}
 
Example 6
Source File: JavaGradlePluginPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void applyDependencies(Project project) {
    DependencyHandler dependencies = project.getDependencies();
    dependencies.add(COMPILE_CONFIGURATION, dependencies.gradleApi());
}
 
Example 7
Source File: PurpleExtension.java    From purplejs with Apache License 2.0 4 votes vote down vote up
public PurpleExtension( final Project project )
{
    this.dependencies = project.getDependencies();
}
 
Example 8
Source File: JavaGradlePluginPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void applyDependencies(Project project) {
    DependencyHandler dependencies = project.getDependencies();
    dependencies.add(COMPILE_CONFIGURATION, dependencies.gradleApi());
}