public ArchetypeDefinition createArchetypeDefinition( Properties properties ) { ArchetypeDefinition definition = new ArchetypeDefinition(); definition.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ); definition.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ); definition.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION ) ); definition.setRepository( properties.getProperty( Constants.ARCHETYPE_REPOSITORY ) ); definition.setUrl( properties.getProperty( Constants.ARCHETYPE_URL ) ); definition.setDescription( properties.getProperty( Constants.ARCHETYPE_DESCRIPTION ) ); return definition; }
public void updateRequest( ArchetypeGenerationRequest request ) { request.setArchetypeGroupId( getGroupId() ); request.setArchetypeArtifactId( getArtifactId() ); request.setArchetypeVersion( getVersion() ); request.setArchetypeGoals( getGoals() ); request.setArchetypeName( getName() ); if ( StringUtils.isNotEmpty( getRepository() ) ) { request.setArchetypeRepository( getRepository() ); } } }
public boolean isPartiallyDefined() { return isGroupDefined() && isArtifactDefined(); }
public boolean confirmSelection( ArchetypeDefinition archetypeDefinition ) throws PrompterException { String query = "Confirm archetype selection: \n" + archetypeDefinition.getGroupId() + "/" + archetypeDefinition.getName() + "\n"; String answer = prompter.prompt( query, Arrays.asList( new String[]{ "Y", "N" } ), "Y" ); return "Y".equalsIgnoreCase( answer ); }
ArchetypeDefinition definition = new ArchetypeDefinition( request ); if ( definition.isDefined() && StringUtils.isNotEmpty( request.getArchetypeRepository() ) ) if ( definition.isDefined() ) else if ( definition.isPartiallyDefined() ) definition.setVersion( null ); definition.setGroupId( null ); definition.setArtifactId( null ); if ( definition.getGroupId() == null ) definition.setGroupId( DEFAULT_ARCHETYPE_GROUPID ); if ( definition.getVersion() == null ) definition.setVersion( DEFAULT_ARCHETYPE_VERSION ); if ( !definition.isPartiallyDefined() ) if ( definition.getArtifactId() == null ) "No archetype defined. Using " + DEFAULT_ARCHETYPE_ARTIFACTID + " (" + definition.getGroupId() + ":" + DEFAULT_ARCHETYPE_ARTIFACTID + ":" + definition.getVersion() + ")" ); definition.setArtifactId( DEFAULT_ARCHETYPE_ARTIFACTID ); if ( !definition.isPartiallyDefined() )
if ( !archetypeDefinition.isDefined() ) while ( !confirmed ) if ( !archetypeDefinition.isDefined() )// <editor-fold text="..."> if ( !archetypeDefinition.isGroupDefined() ) archetypeDefinition.setGroupId( archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() ) ); if ( !archetypeDefinition.isArtifactDefined() ) archetypeDefinition.setArtifactId( archetypeCreationQueryer.getArchetypeArtifactId( project.getArtifactId() + Constants.ARCHETYPE_SUFFIX ) ); if ( !archetypeDefinition.isVersionDefined() ) archetypeDefinition.setVersion( archetypeCreationQueryer.getArchetypeVersion( project.getVersion() ) ); archetypeDefinition.reset(); if ( !archetypeDefinition.isDefined() )
ArchetypeDefinition ad = new ArchetypeDefinition( request ); if ( !ad.isDefined() ) ad.getArtifactId() + "-repo" ); repositories.add( archetypeRepository ); if ( !archetypeArtifactManager.exists( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) ) throw new UnknownArchetype( "The desired archetype does not exist (" + ad.getGroupId() + ":" + ad.getArtifactId() + ":" + ad.getVersion() + ")" ); request.setArchetypeVersion( ad.getVersion() ); if ( archetypeArtifactManager.isFileSetArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) ) archetypeArtifactManager.getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ); else if ( archetypeArtifactManager.isOldArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) )
public void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration, ArchetypeDefinition archetypeDefinition ) { archetypeConfiguration.setGroupId( archetypeDefinition.getGroupId() ); archetypeConfiguration.setArtifactId( archetypeDefinition.getArtifactId() ); archetypeConfiguration.setVersion( archetypeDefinition.getVersion() ); }
if ( defaultDefinition != null && archetype.getGroupId().equals( defaultDefinition.getGroupId() ) && archetype.getArtifactId().equals( defaultDefinition.getArtifactId() ) )
public boolean isGroupDefined() { return StringUtils.isNotEmpty( getGroupId() ); }
public boolean isArtifactDefined() { return StringUtils.isNotEmpty( getArtifactId() ); }
public boolean isVersionDefined() { return StringUtils.isNotEmpty( getVersion() ); }
ArchetypeDefinition definition = new ArchetypeDefinition( request ); if ( definition.isDefined() && StringUtils.isNotEmpty( request.getArchetypeRepository() ) ) if ( definition.isDefined() ) else if ( definition.isPartiallyDefined() ) definition.setVersion( null ); definition.setGroupId( null ); definition.setArtifactId( null ); if ( definition.getGroupId() == null ) definition.setGroupId( DEFAULT_ARCHETYPE_GROUPID ); if ( definition.getVersion() == null ) definition.setVersion( DEFAULT_ARCHETYPE_VERSION ); if ( !definition.isPartiallyDefined() ) if ( definition.getArtifactId() == null ) "No archetype defined. Using " + DEFAULT_ARCHETYPE_ARTIFACTID + " (" + definition.getGroupId() + ":" + DEFAULT_ARCHETYPE_ARTIFACTID + ":" + definition.getVersion() + ")" ); definition.setArtifactId( DEFAULT_ARCHETYPE_ARTIFACTID ); if ( !definition.isPartiallyDefined() )
if ( !archetypeDefinition.isDefined() ) while ( !confirmed ) if ( !archetypeDefinition.isDefined() )// <editor-fold text="..."> if ( !archetypeDefinition.isGroupDefined() ) archetypeDefinition.setGroupId( archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() ) ); if ( !archetypeDefinition.isArtifactDefined() ) archetypeDefinition.setArtifactId( archetypeCreationQueryer.getArchetypeArtifactId( project.getArtifactId() + Constants.ARCHETYPE_SUFFIX ) ); if ( !archetypeDefinition.isVersionDefined() ) archetypeDefinition.setVersion( archetypeCreationQueryer.getArchetypeVersion( project.getVersion() ) ); archetypeDefinition.reset(); if ( !archetypeDefinition.isDefined() )
ArchetypeDefinition ad = new ArchetypeDefinition( request ); if ( !ad.isDefined() ) ad.getArtifactId() + "-repo" ); repositories.add( archetypeRepository ); if ( !archetypeArtifactManager.exists( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) ) throw new UnknownArchetype( "The desired archetype does not exist (" + ad.getGroupId() + ":" + ad.getArtifactId() + ":" + ad.getVersion() + ")" ); request.setArchetypeVersion( ad.getVersion() ); if ( archetypeArtifactManager.isFileSetArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) ) archetypeArtifactManager.getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ); else if ( archetypeArtifactManager.isOldArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) )
public void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration, ArchetypeDefinition archetypeDefinition ) { archetypeConfiguration.setGroupId( archetypeDefinition.getGroupId() ); archetypeConfiguration.setArtifactId( archetypeDefinition.getArtifactId() ); archetypeConfiguration.setVersion( archetypeDefinition.getVersion() ); }
public boolean confirmSelection( ArchetypeDefinition archetypeDefinition ) throws PrompterException { String query = "Confirm archetype selection: \n" + archetypeDefinition.getGroupId() + "/" + archetypeDefinition.getName() + "\n"; String answer = prompter.prompt( query, Arrays.asList( new String[]{ "Y", "N" } ), "Y" ); return "Y".equalsIgnoreCase( answer ); }
if ( defaultDefinition != null && archetype.getGroupId().equals( defaultDefinition.getGroupId() ) && archetype.getArtifactId().equals( defaultDefinition.getArtifactId() ) )
public boolean isGroupDefined() { return StringUtils.isNotEmpty( getGroupId() ); }
public boolean isArtifactDefined() { return StringUtils.isNotEmpty( getArtifactId() ); }