Gradle: import test files from other module in the same project

Viewed 13

My Java project has 2 modules: moduleA and moduleB. Inside moduleB's tests, I want to import some test files of moduleA.

Here is the way that I defined in the moduleB gradle:

dependencies {
    testImplementation project(":moduleA").sourceSets.test.output
}

By doing this, my IDE, which is IntellijIDEA, can recognize the test source files from the moduleA. However, when I run tests of moduleB, I receive the following error:

error: package com.moduleA.test_utils does not exist

How can I fix this?

Thanks

0 Answers
Related