{
depQuery.setRepositories(new DependencyRepository("archetype", repository));
}
Dependency resolvedArtifact = resolver.resolveArtifact(depQuery);
FileResource<?> artifact = resolvedArtifact.getArtifact();
MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
File fileRoot = project.getRoot().reify(DirectoryResource.class).getUnderlyingResourceObject();
ArchetypeHelper archetypeHelper = new ArchetypeHelper(artifact.getResourceInputStream(), fileRoot,
metadataFacet.getProjectGroupName(), metadataFacet.getProjectName(), metadataFacet.getProjectVersion());
JavaSourceFacet facet = (JavaSourceFacet) project.getFacet(JavaSourceFacet.class);
archetypeHelper.setPackageName(facet.getBasePackage());
archetypeHelper.execute();
return Results.success();
}