There used to be createInCustomDirectory()
methods in TempDirectory extension class in JUnit 5.4.0-M1 (see docs). The main use case for those methods was to change tmp dir used by the extension. In the final release (5.4.0) TempDirectory extension was made private and enabled by default and those methods are not available anymore.
I wonder if there is another way to change root dir for all @TempDir
directories?
No, there is no way to customize the temp dir.
The scope of the @TempDir
was reduced in JUnit 5.4 RC2. See the following issue for details: https://github.com/junit-team/junit5/issues/1752