olamy commented on code in PR #3359:
URL: https://github.com/apache/maven-surefire/pull/3359#discussion_r3297169516
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -3361,13 +3362,28 @@ File createSurefireBootDirectoryInBuild() {
}
File createSurefireBootDirectoryInTemp() {
+ String tempDir = getTempDir();
+ if (isTempDirPath(tempDir)) {
+ File tmp = new File(tempDir);
+ if (!tmp.isAbsolute()) {
+ tmp = new File(getProjectBuildDirectory(), tempDir);
+ }
+ //noinspection ResultOfMethodCallIgnored
+ tmp.mkdirs();
+ return tmp;
+ }
+
try {
- return Files.createTempDirectory(getTempDir()).toFile();
- } catch (IOException e) {
+ return Files.createTempDirectory(tempDir).toFile();
+ } catch (IOException | IllegalArgumentException e) {
return createSurefireBootDirectoryInBuild();
}
}
+ private static boolean isTempDirPath(String tempDir) {
+ return new File(tempDir).isAbsolute() || tempDir.indexOf('/') >= 0 ||
tempDir.indexOf('\\') >= 0;
Review Comment:
not sure to understand the logic here to say this directory is temporary?
so a path such `/home/uid/` is temporary?
can you document you use case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]