Skip to content

Instantly share code, notes, and snippets.

@felix19350
Created January 15, 2021 17:06
Show Gist options
  • Save felix19350/46b4bd5293c09a36583012672f7eea55 to your computer and use it in GitHub Desktop.
Save felix19350/46b4bd5293c09a36583012672f7eea55 to your computer and use it in GitHub Desktop.
Gradle notes

Gradle notes

Test dependencies in multi-module projects

Scenario:

Gradle multi-module project that is comprised of two modules A, B and C. Module A exposes functionality (e.g. json serialization configurations) that is consumed by module B and C. Module A also has a set of test helpers (in src/test/) that are useful so that modules B and C are not concerned with bootstrapping the serialization part on their unit tests.

Dependency graph

A -> B
  \-> C

In order to use the test helpers on modules B and C, the following dependency needs to be added to each module's build.gradle

testImplementation project(':A').sourceSets.test.output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment