Skip to content

Commit

Permalink
Merge pull request #727 from TIBCOSoftware/AMBW-50475
Browse files Browse the repository at this point in the history
Ambw 50475 Added changes to remove pid folder generated for maven site goal
  • Loading branch information
pramakan-tibco authored Jul 4, 2024
2 parents d381665 + 80b17d8 commit 7f8f318
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -97,7 +98,7 @@ private void init()
public void runTests() throws MojoFailureException, Exception
{
init();

removePidFolder();
r.path("tests").path("enabledebug").request().get();

List<MavenProject> projects = BWTestConfig.INSTANCE.getSession().getProjects();
Expand Down Expand Up @@ -133,6 +134,30 @@ public void runTests() throws MojoFailureException, Exception

}

private void removePidFolder() throws IOException {
String parentFolder = getWorkspacepath() + ".parent";
File file = new File(parentFolder);
if (file.exists()) {
File[] files = file.listFiles();
if (files != null) {
for (File tempFile : files) {
if (tempFile!= null && tempFile.getName().startsWith("pid_")) {
FileUtils.deleteDirectory(tempFile);
}
}
}
}
}

private String getWorkspacepath() {
String workspacePath= System.getProperty("user.dir");
String wsPath= workspacePath;
if(wsPath.indexOf(".parent")!=-1){
wsPath= workspacePath.substring(0, workspacePath.lastIndexOf(".parent"));
}
return wsPath;
}

private boolean isCXF(MavenProject project){
for(Dependency dep : project.getDependencies()){
if(dep.getArtifactId().equalsIgnoreCase("com.tibco.xml.cxf.common")){
Expand Down

0 comments on commit 7f8f318

Please sign in to comment.