Thread.currentThread().setContextClassLoader(
getContextClassloader( archetypeArtifact, localRepository, remoteRepositories ) );
try
{
VelocityComponent velocity = (VelocityComponent) lookup( VelocityComponent.class.getName() );
velocity.getEngine().mergeTemplate( OldArchetype.ARCHETYPE_RESOURCES + "/" + OldArchetype.ARCHETYPE_POM, context,
writer );
}
finally
{
Thread.currentThread().setContextClassLoader( old );