public ArchetypeGenerationResult generateProjectFromArchetype(ArchetypeGenerationRequest request) { ArchetypeGenerationResult result = new ArchetypeGenerationResult(); generator.generateArchetype(request, result); return result; }
public void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile, ArchetypeGenerationResult result ) { try { generateArchetype( request, archetypeFile ); } catch ( IOException ex ) { result.setCause( ex ); } catch ( ArchetypeException ex ) { result.setCause( ex ); } catch ( XmlPullParserException ex ) { result.setCause( ex ); } catch ( DocumentException ex ) { result.setCause( ex ); } }
private ArchetypeGenerationRequest generate( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion, File archetypeFile, Properties properties, String basedir ) throws IntegrationTestFailure { //@formatter:off ArchetypeGenerationRequest request = new ArchetypeGenerationRequest().setArchetypeGroupId( archetypeGroupId ).setArchetypeArtifactId( archetypeArtifactId ).setArchetypeVersion( archetypeVersion ).setGroupId( properties.getProperty( Constants.GROUP_ID ) ).setArtifactId( properties.getProperty( Constants.ARTIFACT_ID ) ).setVersion( properties.getProperty( Constants.VERSION ) ).setPackage( properties.getProperty( Constants.PACKAGE ) ).setOutputDirectory( basedir ).setProperties( properties ); //@formatter:on ArchetypeGenerationResult result = new ArchetypeGenerationResult(); archetypeGenerator.generateArchetype( request, archetypeFile, result ); if ( result.getCause() != null ) { if ( result.getCause() instanceof ArchetypeNotConfigured ) { ArchetypeNotConfigured anc = (ArchetypeNotConfigured) result.getCause(); throw new IntegrationTestFailure( "Missing required properties in archetype.properties: " + StringUtils.join( anc.getMissingProperties().iterator(), ", " ), anc ); } throw new IntegrationTestFailure( result.getCause().getMessage(), result.getCause() ); } return request; }
private ArchetypeGenerationRequest generate( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion, File archetypeFile, Properties properties, String basedir ) throws IntegrationTestFailure { //@formatter:off ArchetypeGenerationRequest request = new ArchetypeGenerationRequest().setArchetypeGroupId( archetypeGroupId ).setArchetypeArtifactId( archetypeArtifactId ).setArchetypeVersion( archetypeVersion ).setGroupId( properties.getProperty( Constants.GROUP_ID ) ).setArtifactId( properties.getProperty( Constants.ARTIFACT_ID ) ).setVersion( properties.getProperty( Constants.VERSION ) ).setPackage( properties.getProperty( Constants.PACKAGE ) ).setOutputDirectory( basedir ).setProperties( properties ); //@formatter:on ArchetypeGenerationResult result = new ArchetypeGenerationResult(); archetypeGenerator.generateArchetype( request, archetypeFile, result ); if ( result.getCause() != null ) { if ( result.getCause() instanceof ArchetypeNotConfigured ) { ArchetypeNotConfigured anc = (ArchetypeNotConfigured) result.getCause(); throw new IntegrationTestFailure( "Missing required properties in archetype.properties: " + StringUtils.join( anc.getMissingProperties().iterator(), ", " ), anc ); } throw new IntegrationTestFailure( result.getCause().getMessage(), result.getCause() ); } return request; }
public ArchetypeGenerationResult generateProjectFromArchetype( ArchetypeGenerationRequest request ) { ArchetypeGenerationResult result = new ArchetypeGenerationResult(); generator.generateArchetype( request, result ); return result; }
public void generateArchetype( ArchetypeGenerationRequest request, ArchetypeGenerationResult result ) { try { File archetypeFile = getArchetypeFile( request, request.getLocalRepository() ); generateArchetype( request, archetypeFile, result ); } catch ( IOException ex ) { result.setCause( ex ); } catch ( ArchetypeException ex ) { result.setCause( ex ); } catch ( XmlPullParserException ex ) { result.setCause( ex ); } catch ( DocumentException ex ) { result.setCause( ex ); } }
public void generateArchetype(ArchetypeGenerationRequest request, ArchetypeGenerationResult result) { assert request != null; assert result != null; try { generateArchetype(request, request.getLocalRepository(), request.getOutputDirectory()); } catch (Exception ex) { log.error(ex.getMessage(), ex); result.setCause(ex); } } }