use of org.kie.workbench.common.screens.archetype.mgmt.backend.maven.ArchetypeGenerateCommand in project kie-wb-common by kiegroup.
the class ArchetypeServiceImpl method add.
@Override
public void add(final GAV archetypeGav, final GAV templateGav) {
checkNotNull("archetypeGav", archetypeGav);
checkNotNull("templateGav", templateGav);
appendTemplateSuffix(templateGav);
checkArchetypeAlreadyAdded(templateGav);
final Path workingDirectoryPath = createTempDirectory(templateGav.getArtifactId());
final File workingDirectory = new File(workingDirectoryPath.toString());
final FileSystemLock physicalLock = createLock(workingDirectory);
try {
physicalLock.lock();
executeMaven(new ArchetypeGenerateCommand(workingDirectoryPath.toString(), archetypeGav, templateGav));
checkModuleValid(workingDirectoryPath.resolve(templateGav.getArtifactId()));
finishAddExternalArchetype(templateGav, workingDirectory);
} catch (GitAPIException | MavenEmbedderException e) {
LOGGER.error(String.format("Failed to add the archetype %s", templateGav), e);
} finally {
physicalLock.unlock();
}
}
Aggregations