3

I'm a new Gradle user coming from Maven and I've hit a bit of a roadblock in our CI builds due to the issue with the working directory in a multi-module build. Specifically it's the unit tests, as I have a few unit tests that are loading resources that are relative to the sub-project directory.

If I build the projects individually, everything works as expected. If I build them using the master build.gradle file, then I run into issues with files not being found, etc.

So the question is,can I change the working directory when gradle forks a new Java process to build the sub-module?

TIA

John S
  • 1,695
  • 2
  • 14
  • 25

1 Answers1

0

I've the similar problem: shared config directory in root for Gradle muli-module, migrated from Maven. Manipulation with projectDir (https://discuss.gradle.org/t/how-do-i-set-a-common-build-directory-for-multi-module-builds-in-the-root-project-directory/5570, https://docs.gradle.org/current/userguide/fine_tuning_project_layout.html#sub:modifying_element_of_the_project_tree) is restricted in last Gradle version, so I've moved to defining root directory location environment variable or fixed place (e.g. ~ or \..\..) or JVM parameter with this location.

Grigory Kislin
  • 16,647
  • 10
  • 125
  • 197