Skip to content

Commit

Permalink
Merge pull request #146 from openmrs/SDK-228
Browse files Browse the repository at this point in the history
SDK-228: Always start with a clean tmp directory as a part of the Run…
  • Loading branch information
rkorytkowski authored Jan 16, 2018
2 parents 911b148 + 66be3e4 commit a361928
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.catalina.LifecycleException;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.startup.Tomcat;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
Expand All @@ -22,6 +23,7 @@
import org.openmrs.maven.plugins.utility.Wizard;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -115,6 +117,14 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

File tempDirectory = server.getServerTmpDirectory();
if (tempDirectory.exists()) {
try {
FileUtils.deleteDirectory(tempDirectory);
}
catch (IOException e) {
throw new MojoExecutionException("Unable to delete existing tmp directory at " + tempDirectory, e);
}
}
tempDirectory.mkdirs();

String warFile = "openmrs.war";
Expand Down

0 comments on commit a361928

Please sign in to comment.