samedi 2 mars 2019

Gradle common test sources in multi project build

I have a Gradle multi-project build with this folder structure:

Root
|- Commons
|  \- TestUtils
|- Services
   |- ProjectA
   \- ProjectB

To resolve the problem of the test dependencies not imported in other projects I have created the 'TestUtils' module, put my test classes inside src/main/java and added an api dependency on spring-boot-starter-test to include JUnit, Mockito etc.

In ProjectA and ProjectB, I have imported TestUtils as 'testImplementation' but the build fails because unresolved classes of module TestUtils.

PS: IntelliJ inspections show no errors.

Example Repo to reproduce the error: https://github.com/fmonorchio/gradle_test_dependencies

I don't know how to resolve this... Thanks!

Aucun commentaire:

Enregistrer un commentaire