Author: rafale
Date: Wed Jun  4 14:11:28 2008
New Revision: 663375

URL: http://svn.apache.org/viewvc?rev=663375&view=rev
Log:
Fix for archetype-171
better handling user information in batch mode

Modified:
    
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
    
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java

Modified: 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
URL: 
http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java?rev=663375&r1=663374&r2=663375&view=diff
==============================================================================
--- 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
 (original)
+++ 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
 Wed Jun  4 14:11:28 2008
@@ -179,7 +179,6 @@
             
             selector.selectArchetype( request, interactiveMode, 
archetypeCatalog );
 
-            // TODO: it's confusing that request has fields that get populated 
but not accepted as input (eg, groupId)
             configurator.configureArchetype( request, interactiveMode, 
executionProperties );
 
             ArchetypeGenerationResult generationResult =
@@ -199,7 +198,7 @@
         }
         catch ( Exception ex )
         {
-            throw new MojoFailureException( ex, ex.getMessage(), 
ex.getMessage() );
+            throw new MojoFailureException( ex.getMessage() );
         }
 
         String artifactId = request.getArtifactId();

Modified: 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
URL: 
http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java?rev=663375&r1=663374&r2=663375&view=diff
==============================================================================
--- 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
 (original)
+++ 
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
 Wed Jun  4 14:11:28 2008
@@ -237,6 +237,34 @@
                 // in batch mode, we assume the defaults, and if still not 
configured fail
                 if( !archetypeConfiguration.isConfigured() )
                 {
+//                    StringBuffer missingProperties = new StringBuffer();
+//                    requiredProperties = 
archetypeConfiguration.getRequiredProperties().iterator();
+//                    while( requiredProperties.hasNext() )
+//                    {
+//                        String requiredProperty = 
(String)requiredProperties.next();
+//                        if (!archetypeConfiguration.isConfigured( 
requiredProperty ))
+//                        {
+//                            missingProperties.append("\nProperty ");
+//                            missingProperties.append(requiredProperty);
+//                            missingProperties.append(" is missing. Add -D");
+//                            missingProperties.append(requiredProperty);
+//                            missingProperties.append("=someValue");
+//                        }
+//                    }
+//                    
+//                    throw new ArchetypeNotConfigured( "Archetype " + 
request.getArchetypeGroupId() + ":"
+//                        + request.getArchetypeArtifactId() + ":" + 
request.getArchetypeVersion()
+//                        + " is not configured"+missingProperties.toString() 
);
+                    requiredProperties = 
archetypeConfiguration.getRequiredProperties().iterator();
+                    while( requiredProperties.hasNext() )
+                    {
+                        String requiredProperty = 
(String)requiredProperties.next();
+                        if (!archetypeConfiguration.isConfigured( 
requiredProperty ))
+                        {
+                            getLogger().warn("Property "+requiredProperty+" is 
missing. Add -D"+requiredProperty+"=someValue");
+                        }
+                    }
+                    
                     throw new ArchetypeNotConfigured( "Archetype " + 
request.getArchetypeGroupId() + ":"
                         + request.getArchetypeArtifactId() + ":" + 
request.getArchetypeVersion()
                         + " is not configured" );


Reply via email to