Source:
<code>public void generateProject( String projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ServerException { AttributeValue artifactId = attributes.get(ARTIFACT_ID); AttributeValue groupId = attributes.get(GROUP_ID); AttributeValue version = attributes.get(VERSION); if (groupId == null || artifactId == null || version == null) { throw new ServerException("Missed some required attribute (groupId, artifactId or version)"); } String archetypeGroupId = null; String archetypeArtifactId = null; String archetypeVersion = null; String archetypeRepository = null; Map<String, String> archetypeProperties = new HashMap<>(); options.remove( "type"); for (Entry<String, String> entry : options.entrySet()) { switch (entry.getKey()) { case "archetypeGroupId": archetypeGroupId = entry.getValue(); break; case "archetypeArtifactId": archetypeArtifactId = entry.getValue(); break; case "archetypeVersion": archetypeVersion = entry.getValue(); break; case "archetypeRepository": archetypeRepository = entry.getValue(); break; default: archetypeProperties.put(entry.getKey(), entry.getValue()); } } if (isNullOrEmpty(archetypeGroupId) || isNullOrEmpty(archetypeArtifactId) || isNullOrEmpty(archetypeVersion)) { throw new ServerException( "Missed some required option (archetypeGroupId, archetypeArtifactId or archetypeVersion)"); } MavenArchetype mavenArchetype = new MavenArchetypeImpl( archetypeGroupId, archetypeArtifactId, archetypeVersion, archetypeRepository, archetypeProperties); String projectName = projectPath.substring(projectPath.lastIndexOf(separator) + 1); final MavenArtifact mavenArtifact = new MavenArtifact(); mavenArtifact.setGroupId(getFirst(groupId.getList(), projectName)); mavenArtifact.setArtifactId(getFirst(artifactId.getList(), projectName)); mavenArtifact.setVersion(getFirst(version.getList(), DEFAULT_VERSION)); archetypeGenerator.generateFromArchetype( <START> projectName, new File("/projects"), mavenArchetype, mavenArtifact); <END> }</code><technical_language>Replace hardcoded "/project" RootDirPathProvider</technical_language>

Target:
public void generateProject( String projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ServerException { AttributeValue artifactId = attributes.get(ARTIFACT_ID); AttributeValue groupId = attributes.get(GROUP_ID); AttributeValue version = attributes.get(VERSION); if (groupId == null || artifactId == null || version == null) { throw new ServerException("Missed some required attribute (groupId, artifactId or version)"); } String archetypeGroupId = null; String archetypeArtifactId = null; String archetypeVersion = null; String archetypeRepository = null; Map<String, String> archetypeProperties = new HashMap<>(); options.remove( "type"); for (Entry<String, String> entry : options.entrySet()) { switch (entry.getKey()) { case "archetypeGroupId": archetypeGroupId = entry.getValue(); break; case "archetypeArtifactId": archetypeArtifactId = entry.getValue(); break; case "archetypeVersion": archetypeVersion = entry.getValue(); break; case "archetypeRepository": archetypeRepository = entry.getValue(); break; default: archetypeProperties.put(entry.getKey(), entry.getValue()); } } if (isNullOrEmpty(archetypeGroupId) || isNullOrEmpty(archetypeArtifactId) || isNullOrEmpty(archetypeVersion)) { throw new ServerException( "Missed some required option (archetypeGroupId, archetypeArtifactId or archetypeVersion)"); } MavenArchetype mavenArchetype = new MavenArchetypeImpl( archetypeGroupId, archetypeArtifactId, archetypeVersion, archetypeRepository, archetypeProperties); String projectName = projectPath.substring(projectPath.lastIndexOf(separator) + 1); final MavenArtifact mavenArtifact = new MavenArtifact(); mavenArtifact.setGroupId(getFirst(groupId.getList(), projectName)); mavenArtifact.setArtifactId(getFirst(artifactId.getList(), projectName)); mavenArtifact.setVersion(getFirst(version.getList(), DEFAULT_VERSION)); archetypeGenerator.generateFromArchetype( projectName, new File(rootDirPathProvider.get()), mavenArchetype, mavenArtifact); }