try {
final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert( pathToPomXML ).getParent();
final org.uberfire.java.nio.file.Path newProjectPath = projectDirectory.resolveSibling( newName );
final POM content = pomService.load( pathToPomXML );
if ( newProjectPath.equals( projectDirectory ) ) {
return pathToPomXML;
}
if ( ioService.exists( newProjectPath ) ) {
throw new FileAlreadyExistsException( newProjectPath.toString() );
}
final Path oldProjectDir = Paths.convert( projectDirectory );
final Project oldProject = resolveProject( oldProjectDir );
content.setName( newName );
final Path newPathToPomXML = Paths.convert( newProjectPath.resolve( "pom.xml" ) );
try {
ioService.startBatch();
ioService.move( projectDirectory, newProjectPath, makeCommentedOption( comment ) );
pomService.save( newPathToPomXML, content, null, comment );