@SuppressWarnings( "checkstyle:linelength" ) public ArchetypeConfiguration createArchetypeConfiguration( org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor, Properties properties ) { getLogger().debug( "Creating ArchetypeConfiguration from legacy descriptor and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); configuration.setName( archetypeDescriptor.getId() ); addOldRequiredProperty( configuration, properties, Constants.GROUP_ID, null, false ); addOldRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, null, false ); addOldRequiredProperty( configuration, properties, Constants.VERSION, "1.0-SNAPSHOT", false ); addOldRequiredProperty( configuration, properties, Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ), true ); return configuration; }
public ArchetypeConfiguration createArchetypeConfiguration( MavenProject project, ArchetypeDefinition archetypeDefinition, Properties properties ) { getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition, MavenProject and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); for ( Iterator<?> requiredProperties = properties.keySet().iterator(); requiredProperties.hasNext(); ) { String requiredProperty = (String) requiredProperties.next(); if ( !requiredProperty.contains( "." ) ) { getLogger().debug( "Adding requiredProperty " + requiredProperty ); configuration.addRequiredProperty( requiredProperty ); configuration.setProperty( requiredProperty, properties.getProperty( requiredProperty ) ); getLogger().debug( "Setting property " + requiredProperty + "=" + configuration.getProperty( requiredProperty ) ); } } addRequiredProperty( configuration, properties, Constants.GROUP_ID, project.getGroupId() ); addRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, project.getArtifactId() ); addRequiredProperty( configuration, properties, Constants.VERSION, project.getVersion() ); addRequiredProperty( configuration, properties, Constants.PACKAGE, null ); setProperty( configuration, properties, Constants.ARCHETYPE_GROUP_ID ); setProperty( configuration, properties, Constants.ARCHETYPE_ARTIFACT_ID ); setProperty( configuration, properties, Constants.ARCHETYPE_VERSION ); setProperty( configuration, properties, Constants.ARCHETYPE_URL ); setProperty( configuration, properties, Constants.ARCHETYPE_DESCRIPTION ); return configuration; }
Properties properties ) getLogger().debug( "Creating ArchetypeConfiguration from fileset descriptor and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); getLogger().debug( "Adding requiredProperty " + key ); getLogger().debug( "Setting property " + key + "=" + value ); else if ( ( defaultValue != null ) && !containsInnerProperty( defaultValue ) ) getLogger().debug( "Setting property " + key + "=" + defaultValue ); getLogger().debug( "Setting defaultProperty " + key + "=" + defaultValue ); getLogger().debug( "Setting validation regular expression " + key + "=" + defaultValue ); addRequiredProperty( configuration, properties, Constants.GROUP_ID, null, false ); addRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, null, false ); addRequiredProperty( configuration, properties, Constants.VERSION, "1.0-SNAPSHOT", false ); addRequiredProperty( configuration, properties, Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ), true );
if (null != properties.getProperty(requiredProperty.getKey(), requiredProperty.getDefaultValue()) && !containsInnerProperty(requiredProperty.getDefaultValue())) { configuration.setProperty(requiredProperty.getKey(), properties.getProperty(requiredProperty.getKey(), requiredProperty.getDefaultValue())); log.debug("Setting property " + requiredProperty.getKey() + "=" + configuration.getProperty(requiredProperty.getKey())); configuration.addRequiredProperty(Constants.GROUP_ID); log.debug("Adding requiredProperty " + Constants.GROUP_ID); if (null != properties.getProperty(Constants.GROUP_ID, configuration.getDefaultValue(Constants.GROUP_ID)) && !containsInnerProperty(configuration.getDefaultValue(Constants.GROUP_ID))) { configuration.setProperty(Constants.GROUP_ID, properties.getProperty(Constants.GROUP_ID, configuration.getDefaultValue(Constants.GROUP_ID))); configuration.setDefaultProperty(Constants.GROUP_ID, configuration.getProperty(Constants.GROUP_ID)); log.debug("Adding requiredProperty " + Constants.ARTIFACT_ID); if (null != properties.getProperty(Constants.ARTIFACT_ID, configuration.getDefaultValue(Constants.ARTIFACT_ID)) && !containsInnerProperty(configuration.getDefaultValue(Constants.ARTIFACT_ID))) { configuration.setProperty(Constants.ARTIFACT_ID, properties.getProperty(Constants.ARTIFACT_ID)); configuration.setDefaultProperty(Constants.ARTIFACT_ID, configuration.getProperty(Constants.ARTIFACT_ID)); configuration.addRequiredProperty(Constants.VERSION); log.debug("Adding requiredProperty " + Constants.VERSION); if (null != properties.getProperty(Constants.VERSION, configuration.getDefaultValue(Constants.VERSION)) && !containsInnerProperty(configuration.getDefaultValue(Constants.VERSION))) { configuration.setProperty(Constants.VERSION, properties.getProperty(Constants.VERSION, configuration.getDefaultValue(Constants.VERSION))); configuration.setDefaultProperty(Constants.VERSION, configuration.getProperty(Constants.VERSION)); configuration.addRequiredProperty(Constants.PACKAGE); log.debug("Adding requiredProperty " + Constants.PACKAGE); if (null != properties.getProperty(Constants.PACKAGE, configuration.getDefaultValue(Constants.PACKAGE)) && !containsInnerProperty(configuration.getDefaultValue(Constants.PACKAGE))) { configuration.setProperty(Constants.PACKAGE, properties.getProperty(Constants.PACKAGE, configuration.getDefaultValue(Constants.PACKAGE))); configuration.setDefaultProperty(Constants.PACKAGE, configuration.getProperty(Constants.PACKAGE)); else if (null != configuration.getProperty(Constants.GROUP_ID) && !containsInnerProperty(configuration.getDefaultValue(Constants.PACKAGE))) {
private void addRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue ) { getLogger().debug( "Adding requiredProperty " + key ); configuration.addRequiredProperty( key ); if ( defaultValue != null ) { configuration.setDefaultProperty( key, defaultValue ); } if ( properties.getProperty( key ) != null ) { configuration.setProperty( key, properties.getProperty( key ) ); getLogger().debug( "Setting property " + key + "=" + configuration.getProperty( Constants.GROUP_ID ) ); } }
private void addRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue, boolean initPropertyWithDefault ) { if ( !configuration.isConfigured( key ) && configuration.getDefaultValue( key ) == null ) { addOldRequiredProperty( configuration, properties, key, defaultValue, initPropertyWithDefault ); } }
Properties properties ) getLogger().debug( "Creating ArchetypeConfiguration from fileset descriptor and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); getLogger().debug( "Adding requiredProperty " + key ); getLogger().debug( "Setting property " + key + "=" + value ); else if ( ( defaultValue != null ) && !containsInnerProperty( defaultValue ) ) getLogger().debug( "Setting property " + key + "=" + defaultValue ); getLogger().debug( "Setting defaultProperty " + key + "=" + defaultValue ); getLogger().debug( "Setting validation regular expression " + key + "=" + defaultValue ); addRequiredProperty( configuration, properties, Constants.GROUP_ID, null, false ); addRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, null, false ); addRequiredProperty( configuration, properties, Constants.VERSION, "1.0-SNAPSHOT", false ); addRequiredProperty( configuration, properties, Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ), true );
private void addRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue ) { getLogger().debug( "Adding requiredProperty " + key ); configuration.addRequiredProperty( key ); if ( defaultValue != null ) { configuration.setDefaultProperty( key, defaultValue ); } if ( properties.getProperty( key ) != null ) { configuration.setProperty( key, properties.getProperty( key ) ); getLogger().debug( "Setting property " + key + "=" + configuration.getProperty( Constants.GROUP_ID ) ); } }
private void addRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue, boolean initPropertyWithDefault ) { if ( !configuration.isConfigured( key ) && configuration.getDefaultValue( key ) == null ) { addOldRequiredProperty( configuration, properties, key, defaultValue, initPropertyWithDefault ); } }
public ArchetypeConfiguration createArchetypeConfiguration( MavenProject project, ArchetypeDefinition archetypeDefinition, Properties properties ) { getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition, MavenProject and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); for ( Iterator<?> requiredProperties = properties.keySet().iterator(); requiredProperties.hasNext(); ) { String requiredProperty = (String) requiredProperties.next(); if ( !requiredProperty.contains( "." ) ) { getLogger().debug( "Adding requiredProperty " + requiredProperty ); configuration.addRequiredProperty( requiredProperty ); configuration.setProperty( requiredProperty, properties.getProperty( requiredProperty ) ); getLogger().debug( "Setting property " + requiredProperty + "=" + configuration.getProperty( requiredProperty ) ); } } addRequiredProperty( configuration, properties, Constants.GROUP_ID, project.getGroupId() ); addRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, project.getArtifactId() ); addRequiredProperty( configuration, properties, Constants.VERSION, project.getVersion() ); addRequiredProperty( configuration, properties, Constants.PACKAGE, null ); setProperty( configuration, properties, Constants.ARCHETYPE_GROUP_ID ); setProperty( configuration, properties, Constants.ARCHETYPE_ARTIFACT_ID ); setProperty( configuration, properties, Constants.ARCHETYPE_VERSION ); setProperty( configuration, properties, Constants.ARCHETYPE_URL ); setProperty( configuration, properties, Constants.ARCHETYPE_DESCRIPTION ); return configuration; }
@SuppressWarnings( "checkstyle:linelength" ) public ArchetypeConfiguration createArchetypeConfiguration( org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor, Properties properties ) { getLogger().debug( "Creating ArchetypeConfiguration from legacy descriptor and Properties" ); ArchetypeConfiguration configuration = createArchetypeConfiguration( properties ); configuration.setName( archetypeDescriptor.getId() ); addOldRequiredProperty( configuration, properties, Constants.GROUP_ID, null, false ); addOldRequiredProperty( configuration, properties, Constants.ARTIFACT_ID, null, false ); addOldRequiredProperty( configuration, properties, Constants.VERSION, "1.0-SNAPSHOT", false ); addOldRequiredProperty( configuration, properties, Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ), true ); return configuration; }
private void addOldRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue, boolean initPropertyWithDefault ) { getLogger().debug( "Adding requiredProperty " + key ); configuration.addRequiredProperty( key ); String property = properties.getProperty( key ); if ( property != null ) { configuration.setProperty( key, property ); configuration.setDefaultProperty( key, property ); } else if ( defaultValue != null ) { if ( initPropertyWithDefault ) { configuration.setProperty( key, defaultValue ); } configuration.setDefaultProperty( key, defaultValue ); } getLogger().debug( "Setting property " + key + "=" + configuration.getProperty( key ) ); }
private void addOldRequiredProperty( ArchetypeConfiguration configuration, Properties properties, String key, String defaultValue, boolean initPropertyWithDefault ) { getLogger().debug( "Adding requiredProperty " + key ); configuration.addRequiredProperty( key ); String property = properties.getProperty( key ); if ( property != null ) { configuration.setProperty( key, property ); configuration.setDefaultProperty( key, property ); } else if ( defaultValue != null ) { if ( initPropertyWithDefault ) { configuration.setProperty( key, defaultValue ); } configuration.setDefaultProperty( key, defaultValue ); } getLogger().debug( "Setting property " + key + "=" + configuration.getProperty( key ) ); }