try {
final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert( pathToPomXML ).getParent();
final Project project2Delete = resolveProject( Paths.convert( projectDirectory ) );
final org.uberfire.java.nio.file.Path parentPom = projectDirectory.getParent().resolve( "pom.xml" );
POM parent = null;
if ( ioService.exists( parentPom ) ) {
parent = pomService.load( Paths.convert( parentPom ) );
}
ioService.delete( projectDirectory, StandardDeleteOption.NON_EMPTY_DIRECTORIES, optionsFactory.makeCommentedOption( comment, identity, sessionInfo ) );
deleteProjectEvent.fire( new DeleteProjectEvent( project2Delete ) );
if ( parent != null ) {
parent.setMultiModule( true );
parent.getModules().remove( project2Delete.getProjectName() );
pomService.save( Paths.convert( parentPom), parent, null, "Removing child module " + project2Delete.getProjectName() );
}
} catch ( final Exception e ) {
throw ExceptionUtilities.handleException( e );
}