Author: rafale Date: Tue Aug 26 14:43:51 2008 New Revision: 689249 URL: http://svn.apache.org/viewvc?rev=689249&view=rev Log: Fix for archetype-188
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java?rev=689249&r1=689248&r2=689249&view=diff ============================================================================== --- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java (original) +++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java Tue Aug 26 14:43:51 2008 @@ -161,11 +161,11 @@ Model model = new Model(); model.setModelVersion( "4.0.0" ); - model.setGroupId( project.getGroupId() );// these values should be retrieve from the requst with sensible defaults - model.setArtifactId( project.getArtifactId() ); - model.setVersion( project.getVersion() ); + model.setGroupId( configurationProperties.getProperty(Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ) );// these values should be retrieve from the requst with sensible defaults + model.setArtifactId( configurationProperties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) ); + model.setVersion( configurationProperties.getProperty(Constants.ARCHETYPE_VERSION, project.getVersion() ) ); model.setPackaging( "maven-archetype" ); - model.setName( project.getArtifactId() ); + model.setName( configurationProperties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) ); Build build = new Build(); model.setBuild( build ); Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java?rev=689249&r1=689248&r2=689249&view=diff ============================================================================== --- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java (original) +++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java Tue Aug 26 14:43:51 2008 @@ -240,7 +240,7 @@ } } // end if - return removeDottedProperties(archetypeConfiguration.toProperties()); + return archetypeConfiguration.toProperties(); } private ArchetypeDefinition defineDefaultArchetype( @@ -250,22 +250,17 @@ { if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ) ) { - getLogger().info( "Setting default archetype's groupId: " + project.getGroupId() ); properties.setProperty( Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ); } if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) ) { - getLogger().info( - "Setting default archetype's artifactId: " + project.getArtifactId() - ); properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, - project.getArtifactId() + "-archetype" + project.getArtifactId() + Constants.ARCHETYPE_SUFFIX ); } if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) ) { - getLogger().info( "Setting default archetype's version: " + project.getVersion() ); properties.setProperty( Constants.ARCHETYPE_VERSION, project.getVersion() ); } @@ -296,6 +291,24 @@ getLogger().info( "Setting default version: " + project.getVersion() ); properties.setProperty( Constants.VERSION, project.getVersion() ); } + + if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ) ) + { + getLogger().info( "Setting default archetype's groupId: " + project.getGroupId() ); + properties.setProperty( Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ); + } + + if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) ) + { + getLogger().info( "Setting default archetype's artifactId: " + project.getArtifactId() ); + properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()+Constants.ARCHETYPE_SUFFIX ); + } + + if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) ) + { + getLogger().info( "Setting default archetype's version: " + project.getVersion() ); + properties.setProperty( Constants.ARCHETYPE_VERSION, project.getVersion() ); + } if ( StringUtils.isEmpty( properties.getProperty( Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java?rev=689249&r1=689248&r2=689249&view=diff ============================================================================== --- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java (original) +++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java Tue Aug 26 14:43:51 2008 @@ -250,9 +250,9 @@ ArchetypeConfiguration configuration = new ArchetypeConfiguration(); getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition, MavenProject and Properties" ); - configuration.setGroupId( archetypeDefinition.getGroupId() ); - configuration.setArtifactId( archetypeDefinition.getArtifactId() ); - configuration.setVersion( archetypeDefinition.getVersion() ); + configuration.setGroupId( properties.getProperty(Constants.ARCHETYPE_GROUP_ID) ); + configuration.setArtifactId( properties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID) ); + configuration.setVersion( properties.getProperty(Constants.ARCHETYPE_VERSION) ); Iterator requiredProperties = properties.keySet().iterator(); @@ -310,6 +310,20 @@ + configuration.getProperty( Constants.PACKAGE ) ); } + if( null != properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) ) + { + configuration.setProperty( Constants.ARCHETYPE_GROUP_ID, properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ); + } + + if( null != properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) ) + { + configuration.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ); + } + + if( null != properties.getProperty( Constants.ARCHETYPE_VERSION, null ) ) + { + configuration.setProperty( Constants.ARCHETYPE_VERSION, properties.getProperty( Constants.ARCHETYPE_VERSION ) ); + } return configuration; }