mardi 9 juin 2015

UnitTest with gradle, wenn test Infrastructure in the other project in src/test/java folder

There is two java projects A and B, the build-engine is gradle.

That is a multi-project and A depends on B

A: build.gradle

...
dependencies {
    compile project (':B')
}
...

B has core code in src/main/java and test code in src/test/java. Also in src/test/java is some testing infrastructure classes like loading of test-data.

gradle :B:test work fine

Tests in A-Project uses the testing infrastructure classes from B-Project, and that is alright for eclipse, but not for gradle. Because the builded jar-file dependency on B-Project includes only classes from src/main/java.

And we get the error:

com.aaa.SomeClassFromAAAA.java:42: error: cannot find symbol
import com.bbb.InfrastructureTestClassFromBBB;

What is the solution?

Aucun commentaire:

Enregistrer un commentaire