maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r393744 - /maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
Date Thu, 13 Apr 2006 07:08:02 GMT
Author: brett
Date: Thu Apr 13 00:07:58 2006
New Revision: 393744

URL: http://svn.apache.org/viewcvs?rev=393744&view=rev
Log:
- correct group ID checking
- don't gen archetype if packaging test will fail
- correct population of group ID/version if they were inherited in the parent

Modified:
    maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java

Modified: maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
URL: http://svn.apache.org/viewcvs/maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java?rev=393744&r1=393743&r2=393744&view=diff
==============================================================================
--- maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
(original)
+++ maven/archetype/trunk/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
Thu Apr 13 00:07:58 2006
@@ -247,13 +247,13 @@
 
         if ( creating )
         {
-            if ( !parameters.containsKey( "groupId" ) )
+            if ( parameters.get( "groupId" ) == null )
             {
                 throw new ArchetypeTemplateProcessingException(
                     "Group ID must be specified when creating a new project from an archetype."
);
             }
 
-            if ( !parameters.containsKey( "version" ) )
+            if ( parameters.get( "version" ) == null )
             {
                 throw new ArchetypeTemplateProcessingException(
                     "Version must be specified when creating a new project from an archetype."
);
@@ -301,6 +301,11 @@
                     fileReader = new FileReader( parentPomFile );
                     MavenXpp3Reader reader = new MavenXpp3Reader();
                     parentModel = reader.read( fileReader );
+                    if ( !"pom".equals( parentModel.getPackaging() ) )
+                    {
+                        throw new ArchetypeTemplateProcessingException(
+                            "Unable to add module to the current project as it is not of
packaging type 'pom'" );
+                    }
                 }
                 catch ( IOException e )
                 {
@@ -501,8 +506,16 @@
         {
             Parent parent = new Parent();
             parent.setGroupId( parentModel.getGroupId() );
+            if ( parent.getGroupId() == null )
+            {
+                parent.setGroupId( parentModel.getParent().getGroupId() );
+            }
             parent.setArtifactId( parentModel.getArtifactId() );
             parent.setVersion( parentModel.getVersion() );
+            if ( parent.getVersion() == null )
+            {
+                parent.setVersion( parentModel.getParent().getVersion() );
+            }
             generatedModel.setParent( parent );
 
             FileWriter pomWriter = null;



Mime
View raw message