Skip to content

Commit

Permalink
fixed error where root module poms from maven that already exist caus…
Browse files Browse the repository at this point in the history
…e a failure
  • Loading branch information
Clayton7510 committed Feb 26, 2020
1 parent 5cbffaa commit 8baf4f7
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -12,6 +12,7 @@
import org.apache.maven.shared.invoker.Invoker;
import org.apache.maven.shared.invoker.MavenInvocationException;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -104,8 +105,11 @@ final void getArtifactFromMavenRepo(Invoker invoker, InvocationRequest request)
Optional<Path> pomFile = Files.walk(workingPath)
.filter(path -> path.getFileName().toString().endsWith(".pom"))
.findFirst();

if (pomFile.isPresent()) {
FileUtils.moveFile(pomFile.get().toFile(), workingPath.resolve("pom.xml").toFile());
File workingFile = workingPath.resolve("pom.xml").toFile();
if (workingFile.exists()) workingFile.delete();
FileUtils.moveFile(pomFile.get().toFile(), workingFile);
}

} catch (MavenInvocationException | IOException e) {
Expand Down

0 comments on commit 8baf4f7

Please sign in to comment.