aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-11-10 13:22:04 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2011-11-10 13:22:26 +0100
commitf8a2f6f439d9551bb3dbbba29b1a2207d1429200 (patch)
tree6e83f1609cb89d778657ee83710b9d8c7e80423e /sonar-server
parentec0f22ebfa93c50b56765d84204014523133b5d6 (diff)
downloadsonarqube-f8a2f6f439d9551bb3dbbba29b1a2207d1429200.tar.gz
sonarqube-f8a2f6f439d9551bb3dbbba29b1a2207d1429200.zip
Improve usage of temp directory at startup
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java13
1 files changed, 2 insertions, 11 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java
index 615dbf4ae52..a17b19847c3 100644
--- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java
+++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java
@@ -21,6 +21,7 @@ package org.sonar.server.mavendeployer;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.sonar.api.utils.TempFileUtils;
import org.sonar.api.utils.ZipUtils;
import java.io.File;
@@ -43,7 +44,7 @@ public final class Mojo extends Artifact {
@Override
protected void copyTo(File toDir) throws IOException {
- File tmpDir = prepareTmpDir();
+ File tmpDir = TempFileUtils.createTempDirectory("sonar-server-");
try {
copyTo(toDir, tmpDir);
@@ -69,16 +70,6 @@ public final class Mojo extends Artifact {
return before + "<version>" + version + "</version>" + after;
}
- private File prepareTmpDir() throws IOException {
- File tmpDir = new File(System.getProperty("java.io.tmpdir"), "sonar-" + version);
- if (tmpDir.exists()) {
- FileUtils.cleanDirectory(tmpDir);
- } else {
- FileUtils.forceMkdir(tmpDir);
- }
- return tmpDir;
- }
-
private void destroyTmpDir(File tmpDir) {
if (tmpDir != null) {
FileUtils.deleteQuietly(tmpDir);