I have a multi-module project in Gradle.
I refactored the common functionality into a module named common
.
I have tests in a different module (lets say module A
) of the multi-module project that consume the classes under src/main/java
of the common
module.
I am able to import these classes from common
module in test classes of module A
, but when I run the tests, I get the following error:
error: package 'common.bla...' does not exist.
This is the build.gradle
file for module A
that depends on common
module for its tests (I have tried all these options):
dependencies {
compile project(':common')
testCompile project(':common')
testRuntime project(':common')
runtime project(':common')
implementation project(":common")
testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
implementation 'junit:junit:4.12'
testCompileOnly project(':common')
testRuntimeOnly project(':common')
testImplementation project(':common')
runtimeOnly project(':common')
testCompile project(":common").sourceSets.test.output
compile project(":common").sourceSets.test.output
testRuntime fileTree(dir: 'libs', include: ['*.jar'])
}
I have also verified that a jar is created in common/build/libs
.
What else can I try?