Home  >  Article  >  Java  >  How do I set up test dependencies between projects in a multi-project Gradle configuration?

How do I set up test dependencies between projects in a multi-project Gradle configuration?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-28 16:20:02656browse

How do I set up test dependencies between projects in a multi-project Gradle configuration?

Multi-project Test Dependencies with Gradle

In a multi-project configuration using Gradle, it's common to encounter situations where a project requires access to test code from another project. To establish this dependency, Gradle 1.7 provides a straightforward solution.

Dependency Configuration for Test Code

To ensure that Project B can access the test code of Project A, the build.gradle file for Project B should include the following dependency:

dependencies {
  ...
  testCompile project(':A').sourceSets.test.output
}

This dependency specifies that Project B should include the output of the test source set from Project A in its test compilation process.

By incorporating this dependency, Project B gains access to the test code from Project A, allowing the seamless compilation of test files.

The above is the detailed content of How do I set up test dependencies between projects in a multi-project Gradle configuration?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn