Make Gradle use relative paths for up-to-date checks

Hello all,

we want to compile a project once and then copy all the content in the directory to other Computers, however to directories with different paths.

  1. The Project was compiled in C:/build
  2. Copy all content to another computer to C:/workspace

In that case everything has to be recompiled unfortunately because gradle thinks

Deleting stale output file: C:\workspace..\build\resources\main
Output property 'destinationDir' file C:\build\..\build\resources\main has been removed

All files have obviously been copied and are present, but gradle only considers the full path which doesn’t make sense to me and then proceeds to delete the outputs. Can gradle check the output property with a relative path instead of absolute?

It is not supported to copy the whole directory to a different location and expecting things to work.
Some parts of the Gradle cache are supported to be copied as documented at Understanding dependency resolution but that’s it.

oh well, long compile times it is then. Thanks!

Compilation can be cached though and if you leverage a remote build cache, you can even reuse compilation results and other things on multiple machines.

I’ve seen that mentioned a few times while researching a “simple” solution to our problem. Thank’s I’ll look into it