We have several java subprojects with tests. Before these tests run we need to create a special file for every subproject with its dependencies. To achieve this we iterate over the dependencies of the runtime configuration and write the paths to these dependencies in the file. The file is called plugin.xml and describes what a plugin is in our system and is necessary to run the tests in a production-like environment. For this we let all the subproject test tasks depend on the task that creates the file in every subproject. If we call the test task for every project like “gradle test” all the files are created with the valid paths. But if we call the test task for a special subproject like “gradle subprojectA:test” then the file of the other subprojects are created but they don’t contain runtime dependencies. From some debugging, I saw that the dependencies are not setup if you call a subproject also if it contains a dependency to a task of another subproject.
I have set up a test project that has a minimal setup that to show what the issue is. https://github.com/Dica-Developer/-gradle_empty_configurations
There are 2 subprojects a and b both are Java projects and have a runtime dependency defined. Both have a task defined called showDeps. It iterates over the runtime dependency and prints out the file.
If you call the task for subprojects for both subprojects the deps are listed like:
gw showDeps --rerun-tasks > Task :b:showDeps b deps b -> /home/ms/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.8.2/d27c24204c5e507b16fec01006b3d0f1ec42aed4/joda-time-2.8.2.jar > Task :a:showDeps a deps a -> /home/ms/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.8.2/d27c24204c5e507b16fec01006b3d0f1ec42aed4/joda-time-2.8.2.jar
If I call the task :a :showDeps which has a dependency on :b :showDeps the runtime dependency of project b is empty
> Task :b:showDeps b deps > Task :a:showDeps a deps a -> /home/ms/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.8.2/d27c24204c5e507b16fec01006b3d0f1ec42aed4/joda-time-2.8.2.jar
Is this the expected behaviour or is this a bug?
How can we define such a dependency so that if we call a subprojects test directly the dependencies are available for another subprojects tasks?
Thanks for any help in advance.