// ----------------------------------------------------------------------
// Load the descriptor
// ----------------------------------------------------------------------
ArchetypeDescriptorBuilder builder = new ArchetypeDescriptorBuilder();
ArchetypeDescriptor descriptor;
URLClassLoader archetypeJarLoader;
InputStream is = null;
try
{
URL[] urls = new URL[1];
urls[0] = archetypeFile.toURL();
archetypeJarLoader = new URLClassLoader( urls );
is = getStream( ARCHETYPE_DESCRIPTOR, archetypeJarLoader );
if ( is == null )
{
is = getStream( ARCHETYPE_OLD_DESCRIPTOR, archetypeJarLoader );
}
if ( is == null )
{
throw new ArchetypeDescriptorException( "The " + ARCHETYPE_DESCRIPTOR + " descriptor cannot be found." );
}
descriptor = builder.build( new XmlStreamReader( is ) );
}
catch ( IOException e )
{
throw new ArchetypeDescriptorException( "Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e );
}