I have two gradle projects in my eclipse workspace. Let's call them "A" and "B". Where "A" depends on "B". Project "A" has declared the dependency on "B" in its build.gradle file, something like this:
dependencies {
compile 'some-group:B:1.0.0'
...
}
As I will be doing modifications in both projects, it would be nice if gradle could resolve the dependency of "B" to the binary files in the eclipse project instead (rather than downloading the B.jar from some repository).
Luckily I found out there is such feature in Eclipse/STS (according to this question). I enable this feature by checking the "Remap jars to Gradle Projects" (in Eclipse: Window -> Gradle preferences). And after doing a Gradle -> Refresh All (in Project "A"), I have this in Project "A" classpath:
C:\eclipse-workspace\B\bin
(path to where the binary files of project "B" is located).- all transitive dependencies of project B.
- all dependencies declared in project "A" (and its transitive dependencies).
So far so good :)
But after a while, I realize I get a bit more than I expected in the classpath. I also get this in the project "A" classpath:
- the binaries of "B/src/test/java"
- the 'testCompile' dependencies of project "B".
It makes no sense to have the "test" code and the testCimpile dependencies of project "B" accessible from project "A". Is there anyway I can avoid this?
I have tried to set different out-put folders for src/main/*
and src/test/*
in project "B", but then both folders are added to the classpath of project "A".
I've been previously using Maven with Eclipse and referring to dependencies within same Eclipse workspace works very well.