if ( !isArchetypeConfigured( archetypeDescriptor, request ) )
{
if ( request.isInteractiveMode() )
{
throw new ArchetypeNotConfigured( "No archetype was chosen.", null );
}
StringBuffer exceptionMessage = new StringBuffer(
"Archetype " + request.getArchetypeGroupId() + ":" + request.getArchetypeArtifactId() + ":"
+ request.getArchetypeVersion() + " is not configured" );
List<String> missingProperties = new ArrayList<String>( 0 );
for ( RequiredProperty requiredProperty : archetypeDescriptor.getRequiredProperties() )
{
if ( StringUtils.isEmpty( request.getProperties().getProperty( requiredProperty.getKey() ) ) )
{
exceptionMessage.append( "\n\tProperty " + requiredProperty.getKey() + " is missing." );
missingProperties.add( requiredProperty.getKey() );
}
}
throw new ArchetypeNotConfigured( exceptionMessage.toString(), missingProperties );
}
Context context = prepareVelocityContext( request );
String packageName = request.getPackage();