Skip to content

Commit

Permalink
SDK-228: Always start with a clean tmp directory as a part of the Run…
Browse files Browse the repository at this point in the history
…Tomcat mojo
  • Loading branch information
mseaton committed Jan 11, 2018
1 parent 34ce9fb commit 66be3e4
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 66be3e4

Please sign in to comment.