'How to redirect maven surefire plugins stdout*deferred temp files away from /tmp folder

When I run my test suites (using maven test) which includes around 20000 test cases and create test report using maven surefire plugin it creates a massive temp file in /tmp folder in my linux server. As I found out since maven cannot contain all the output in memory it buffers outputs to /tmp folder creating files with pattern of stdout*deferred. I want to redirect these files created into a different folder. I couldn't find any configurations to do so. Is there anyway to do this?



Solution 1:[1]

You can do it by setting a different temp directory than the default one. Call maven with the standard JVM system property for tmp dir:

mvn -Djava.io.tmpdir=<otherDir> test

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chirlo