@Override public Project newProject( final Repository repository, final String projectName, final POM pom, final String baseUrl) { try { // Projects are always created in the FS root final Path fsRoot = repository.getRoot(); final Path projectRootPath = Paths.convert(Paths.convert(fsRoot).resolve(projectName)); // Set-up project structure and KModule.xml kModuleService.setUpKModuleStructure(projectRootPath); // Create POM.xml pomService.create(projectRootPath, baseUrl, pom); // Create Project configuration final Path projectConfigPath = Paths.convert(Paths.convert(projectRootPath).resolve(PROJECT_IMPORTS_PATH)); ioService.createFile(Paths.convert(projectConfigPath)); ioService.write( Paths.convert(projectConfigPath), projectConfigurationContentHandler.toString(createProjectImports())); // Raise an event for the new project final Project project = resolveProject(projectRootPath); newProjectEvent.fire(new NewProjectEvent(project, sessionInfo)); // Create a default workspace based on the GAV final String legalJavaGroupId[] = IdentifierUtils.convertMavenIdentifierToJavaIdentifier( pom.getGav().getGroupId().split("\\.", -1)); final String legalJavaArtifactId[] = IdentifierUtils.convertMavenIdentifierToJavaIdentifier( pom.getGav().getArtifactId().split("\\.", -1)); final String defaultWorkspacePath = StringUtils.join(legalJavaGroupId, "/") + "/" + StringUtils.join(legalJavaArtifactId, "/"); final Path defaultPackagePath = Paths.convert(Paths.convert(projectRootPath).resolve(MAIN_RESOURCES_PATH)); final Package defaultPackage = resolvePackage(defaultPackagePath); final Package defaultWorkspacePackage = doNewPackage(defaultPackage, defaultWorkspacePath); // Raise an event for the new project's default workspace newPackageEvent.fire(new NewPackageEvent(defaultWorkspacePackage)); // Return new project return project; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }