Imagine I have two Maven-based projects with Kotlin code, prjA and prjB.
Test class SomeTest in prjA
references a class and function defined in prjB
:
class SomeTest {
@Test
fun prjACanReferencePrjBStuff() {
val valRes = ValidationResult()
val correctValRes = createCorrectValidationResult()
}
}
When I
- run
mvn clean install
in prjB, - update the dependencies of
prjA
in IntelliJ Idea and - run
mvn clean install
in prjA,
I get errors - Maven can't find the classes defined in prjB
:
Why? How can I fix it?
Notes:
- Kotlin classes are publicly visible by default. I don't get any errors during
mvn install
ofprjB
. - The Maven repository contains
prjB
artifacts and IntelliJ Idea references the right Maven repository. - When I try to build
prjA
from the command line, the build succeeds. - Invalidating IntelliJ Idea cache and rebuilding the project doesn't help.
Update 1: I need a solution, which allows me to use prjB
not only in tests.
Update 2: Everything works perfectly fine, if I rewrite Kotlin classes in prjB
in Java.