maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raf...@apache.org
Subject svn commit: r668260 - in /maven/archetype/trunk: archetype-common/src/main/java/org/apache/maven/archetype/generator/ archetype-common/src/main/java/org/apache/maven/archetype/old/ archetype-common/src/main/mdo/ archetype-plugin/src/main/java/org/apach...
Date Mon, 16 Jun 2008 18:52:03 GMT
Author: rafale
Date: Mon Jun 16 11:52:02 2008
New Revision: 668260

URL: http://svn.apache.org/viewvc?rev=668260&view=rev
Log:
Exception handling enhanced in backward code

Modified:
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
    maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo
    maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
Mon Jun 16 11:52:02 2008
@@ -69,9 +69,7 @@
 
     private void generateArchetype(
         ArchetypeGenerationRequest request,
-        Properties properties,
         ArtifactRepository localRepository,
-        List repositories,
         String basedir
     )
         throws
@@ -250,8 +248,8 @@
         map.put( "artifactId", request.getArtifactId() );
 
         map.put( "version", request.getVersion() );
-        try
-        {
+//        try
+//        {
             oldArchetype.createArchetype(
                 request.getArchetypeGroupId(),
                 request.getArchetypeArtifactId(),
@@ -260,34 +258,32 @@
                 repositories,
                 map
             );
-        }
-        catch ( ArchetypeDescriptorException ex )
-        {
-            throw new ArchetypeGenerationFailure(
-                "Failed to generate project from the old archetype", ex
-            );
-        }
-        catch ( ArchetypeTemplateProcessingException ex )
-        {
-            throw new ArchetypeGenerationFailure(
-                "Failed to generate project from the old archetype", ex
-            );
-        }
-        catch ( ArchetypeNotFoundException ex )
-        {
-            throw new ArchetypeGenerationFailure(
-                "Failed to generate project from the old archetype", ex
-            );
-        }
+//        }
+//        catch ( ArchetypeDescriptorException ex )
+//        {
+//            throw new ArchetypeGenerationFailure(
+//                "Failed to generate project from the old archetype", ex
+//            );
+//        }
+//        catch ( ArchetypeTemplateProcessingException ex )
+//        {
+//            throw new ArchetypeGenerationFailure(
+//                "Failed to generate project from the old archetype", ex
+//            );
+//        }
+//        catch ( ArchetypeNotFoundException ex )
+//        {
+//            throw new ArchetypeGenerationFailure(
+//                "Failed to generate project from the old archetype", ex
+//            );
+//        }
     }
 
     public void generateArchetype( ArchetypeGenerationRequest request, ArchetypeGenerationResult
result )
     {
-        //TODO: get rid of the property file usage.
-
         try
         {
-            generateArchetype( request, null, request.getLocalRepository(), null/*Collections.singletonList(
repo )*/, request.getOutputDirectory(  ) );
+            generateArchetype( request, request.getLocalRepository(), request.getOutputDirectory()
);
         }
         catch ( IOException ex )
         {

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
Mon Jun 16 11:52:02 2008
@@ -1,5 +1,7 @@
 package org.apache.maven.archetype.old;
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /*
  * Copyright 2004-2006 The Apache Software Foundation.
  *
@@ -21,7 +23,7 @@
  * @version $Id$
  */
 public class ArchetypeDescriptorException
-    extends Exception
+    extends ArchetypeGenerationFailure
 {
     public ArchetypeDescriptorException( String message )
     {

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
Mon Jun 16 11:52:02 2008
@@ -1,5 +1,7 @@
 package org.apache.maven.archetype.old;
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /*
  * Copyright 2004-2006 The Apache Software Foundation.
  *
@@ -21,7 +23,7 @@
  * @version $Id$
  */
 public class ArchetypeNotFoundException
-    extends Exception
+    extends ArchetypeGenerationFailure
 {
     public ArchetypeNotFoundException( String message )
     {

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
Mon Jun 16 11:52:02 2008
@@ -1,5 +1,7 @@
 package org.apache.maven.archetype.old;
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /*
  * Copyright 2004-2006 The Apache Software Foundation.
  *
@@ -21,7 +23,7 @@
  * @version $Id$
  */
 public class ArchetypeTemplateProcessingException
-    extends Exception
+    extends ArchetypeGenerationFailure
 {
     public ArchetypeTemplateProcessingException( String message )
     {

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
Mon Jun 16 11:52:02 2008
@@ -106,7 +106,7 @@
                                  ArtifactRepository localRepository,
                                  List remoteRepositories,
                                  Map parameters )
-        throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException
+        throws UnknownArchetype, ArchetypeNotFoundException, ArchetypeDescriptorException,
ArchetypeTemplateProcessingException
     {
         // ----------------------------------------------------------------------
         // Download the archetype
@@ -114,16 +114,16 @@
 
         File archetype;
 
-        try
-        {
+//        try
+//        {
             archetype = archetypeArtifactManager.getArchetypeFile( 
                 archetypeGroupId, archetypeArtifactId, archetypeVersion, 
                 archetypeRepository, localRepository, remoteRepositories );
-        }
-        catch ( UnknownArchetype e )
-        {
-            throw new ArchetypeDescriptorException( "Error attempting to download archetype.",
e );
-        }
+//        }
+//        catch ( UnknownArchetype e )
+//        {
+//            throw new ArchetypeDescriptorException( "Error attempting to download archetype.",
e );
+//        }
 
         // ---------------------------------------------------------------------
         // Get Logger and display all parameters used
@@ -239,7 +239,7 @@
                 }
                 else
                 {
-                    throw new ArchetypeTemplateProcessingException(
+                    throw new ArchetypeTemplateProcessingException( "Directory " +
                         outputDirectoryFile.getName() + " already exists - please run from
a clean directory" );
                 }
             }

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
Mon Jun 16 11:52:02 2008
@@ -20,6 +20,7 @@
 
 import java.util.List;
 import java.util.Map;
+import org.apache.maven.archetype.exception.UnknownArchetype;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -41,5 +42,5 @@
     void createArchetype( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
                           ArtifactRepository archetypeRepository,
                           ArtifactRepository localRepository, List remoteRepositories, Map
parameters )
-        throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException;
+        throws UnknownArchetype, ArchetypeNotFoundException, ArchetypeDescriptorException,
ArchetypeTemplateProcessingException;
 }

Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo (original)
+++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo Mon Jun 16 11:52:02
2008
@@ -110,7 +110,7 @@
           <code><![CDATA[
     public String toString ()
     {
-        return "[" + groupId + ":" + artifactId + ":" + version + " -> " + repository
+ "]";
+        return "[" + groupId + ":" + artifactId + ":" + version + (repository != null ? "
-> " + repository : "") + "]";
     }
     public int hashCode ()
     {

Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java?rev=668260&r1=668259&r2=668260&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
(original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
Mon Jun 16 11:52:02 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.archetype.exception.UnknownArchetype;
 import org.apache.maven.archetype.old.OldArchetype;
 import org.apache.maven.archetype.old.ArchetypeDescriptorException;
 import org.apache.maven.archetype.old.ArchetypeNotFoundException;
@@ -226,14 +227,18 @@
 
         try
         {
-            archetype.createArchetype( 
+            archetype.createArchetype(
                     archetypeGroupId, 
                     archetypeArtifactId, 
                     archetypeVersion, 
-                    createRepository( "http://repo1.maven.org/maven2", "central" ),
-                    localRepository,
+                    createRepository("http://repo1.maven.org/maven2", "central"), 
+                    localRepository, 
                     archetypeRemoteRepositories, 
-                    map );
+                    map);            
+        }
+        catch (UnknownArchetype e) 
+        {
+            throw new MojoExecutionException( "Error creating from archetype", e );
         }
         catch ( ArchetypeNotFoundException e )
         {



Mime
View raw message