archetypeVersion, Artifact.SCOPE_RUNTIME, "jar");
try {
artifactResolver.resolve(archetypeArtifact, remoteRepositories, localRepository);
} catch (ArtifactResolutionException e) {
throw new ArchetypeDescriptorException("Error attempting to download archetype: " + e.getMessage(), e);
}
// ----------------------------------------------------------------------
// Load the archetype descriptor
// ----------------------------------------------------------------------
BobberArchetypeXpp3Reader builder = new BobberArchetypeXpp3Reader();
com.javaforge.bobber.archetype.model.BobberArchetype archetype;
JarFile archetypeJarFile;
try {
archetypeJarFile = new JarFile(archetypeArtifact.getFile());
final ZipEntry zipEntry = archetypeJarFile.getEntry(ARCHETYPE_DESCRIPTOR);
InputStream is = archetypeJarFile.getInputStream(zipEntry);
if (is == null) {
throw new ArchetypeDescriptorException(
"The " + ARCHETYPE_DESCRIPTOR + " descriptor cannot be found.");
}
archetype = builder.read(new InputStreamReader(is));
archetypeJarFile.close();
} catch (IOException e) {
throw new ArchetypeDescriptorException("Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e);
} catch (XmlPullParserException e) {
throw new ArchetypeDescriptorException("Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e);
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------