maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r582463 - in /maven/sandbox/trunk/archetypeng: archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/ archetypeng-plugin/src/main/java/org/apache/maven/arche...
Date Sat, 06 Oct 2007 07:03:36 GMT
Author: jvanzyl
Date: Sat Oct  6 00:03:35 2007
New Revision: 582463

URL: http://svn.apache.org/viewvc?rev=582463&view=rev
Log:
o starting to clean up the generator, everything is almost working again and this will be
final once the request is used as the only
  thing passing through the system. this going back and forth from properties to archDefs
needs to be cleaned up once and for all

Modified:
    maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
    maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
    maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
    maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
    maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
    maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
    maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java

Modified: maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
Sat Oct  6 00:03:35 2007
@@ -45,22 +45,4 @@
 
     void generateArchetype( ArchetypeGenerationRequest request,
                             ArchetypeGenerationResult result );
-
-    void generateArchetype( File propertyFile,
-                            ArtifactRepository localRepository,
-                            List repositories,
-                            String basedir
-    )
-        throws
-        IOException,
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
-        XmlPullParserException,
-        DocumentException,
-        InvalidPackaging,
-        ArchetypeGenerationFailure;
 }

Modified: maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
Sat Oct  6 00:03:35 2007
@@ -77,32 +77,8 @@
     /** @plexus.requirement */
     private Archetype oldArchetype;
 
-    public void generateArchetype(
-        File propertyFile,
-        ArtifactRepository localRepository,
-        List repositories,
-        String basedir
-    )
-        throws
-        IOException,
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
-        XmlPullParserException,
-        DocumentException,
-        InvalidPackaging,
-        ArchetypeGenerationFailure
-    {
-        Properties properties = initialiseArchetypeProperties( propertyFile );
-
-        generateArchetype( properties, localRepository, repositories, basedir );
-    }
-
-
     private void generateArchetype(
+        ArchetypeGenerationRequest request,
         Properties properties,
         ArtifactRepository localRepository,
         List repositories,
@@ -184,16 +160,6 @@
         return StringUtils.replace( packageName, ".", "/" );
     }
 
-    /** Common */
-    private Properties initialiseArchetypeProperties( File propertyFile )
-        throws
-        IOException
-    {
-        Properties properties = new Properties();
-        archetypePropertiesManager.readProperties( properties, propertyFile );
-        return properties;
-    }
-
     /** FileSetArchetype */
     private void processFileSetArchetype(
         final Properties properties,
@@ -310,18 +276,25 @@
     {
         try
         {
-            Properties properties = request.getProperties(  );
+            Properties properties = request.getProperties();
+
             properties.setProperty( Constants.ARCHETYPE_GROUP_ID, request.getArchetypeGroupId()
);
+
             properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, request.getArchetypeArtifactId()
);
+
             properties.setProperty( Constants.ARCHETYPE_VERSION, request.getArchetypeVersion()
);
 
             properties.setProperty( Constants.GROUP_ID, request.getGroupId(  ) );
+
             properties.setProperty( Constants.ARTIFACT_ID, request.getArtifactId(  ) );
-            properties.setProperty( Constants.VERSION, request.getVersion(  ) );
+
+            properties.setProperty( Constants.VERSION, request.getVersion() );
+
             properties.setProperty( Constants.PACKAGE, request.getPackage(  ) );
+
             properties.setProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS, request.getArchetypeGoals(
 ) );
 
-            generateArchetype( properties, request.getLocalRepository(  ), Collections.singletonList(
archetypeRegistryManager.createRepository( request.getArchetypeRepository(  ), "repository"
) ), request.getOutputDirectory(  ) );
+            generateArchetype( request, properties, request.getLocalRepository(), Collections.singletonList(
archetypeRegistryManager.createRepository( request.getArchetypeRepository(), "repository"
) ), request.getOutputDirectory(  ) );
         }
         catch ( IOException ex )
         {

Modified: maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
Sat Oct  6 00:03:35 2007
@@ -177,8 +177,7 @@
                     archetypeRegistryFile
                 );
 
-            // Only interactiveMode, repositories and registry file are needed outside the
request.
-            selector.selectArchetype( request, settings.getInteractiveMode(), archetypeRegistryFile,
repositories );
+            selector.selectArchetype( request, settings.getInteractiveMode() );
 
             // Only interactiveMode, system.properties (configuration properties) and repositories
are needed outside the request.
             configurator.configureArchetype( request, settings.getInteractiveMode(), System.getProperties(),
repositories );

Modified: maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
Sat Oct  6 00:03:35 2007
@@ -52,19 +52,4 @@
         IOException,
         PrompterException,
         ArchetypeGenerationConfigurationFailure;
-
-    public ArchetypeConfiguration configureArchetype(
-        Boolean interactiveMode,
-        File propertyFile,
-        Properties commandLineProperties,
-        ArtifactRepository localRepository,
-        List repositories
-    )
-        throws
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        IOException,
-        PrompterException,
-        ArchetypeGenerationConfigurationFailure;
 }

Modified: maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
Sat Oct  6 00:03:35 2007
@@ -32,16 +32,14 @@
 
 //TODO: We should need any remote repositories here, we should simply be doing selection,
any remote catalogs
 //      should be validating correctness, and if it so happens we get a crap entry then the
generation mechanism
+
 //      should take care of reporting the error. The selector should not be downloading anything.
 public interface ArchetypeSelector
 {
     String ROLE = ArchetypeSelector.class.getName();
 
-    public void selectArchetype( ArchetypeGenerationRequest request,
-                                 Boolean interactiveMode,
-                                 File archetypeRegistryFile,
-                                 List repositories
-    )
+    void selectArchetype( ArchetypeGenerationRequest request,
+                          Boolean interactiveMode )
         throws
         ArchetypeNotDefined,
         UnknownArchetype,

Modified: maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
Sat Oct  6 00:03:35 2007
@@ -26,24 +26,23 @@
 import org.apache.maven.archetype.common.ArchetypeDefinition;
 import org.apache.maven.archetype.common.ArchetypeFactory;
 import org.apache.maven.archetype.common.ArchetypePropertiesManager;
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.common.Constants;
 import org.apache.maven.archetype.exception.ArchetypeGenerationConfigurationFailure;
 import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
 import org.apache.maven.archetype.exception.ArchetypeNotDefined;
 import org.apache.maven.archetype.exception.UnknownArchetype;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-
 import org.codehaus.plexus.components.interactivity.PrompterException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
-import org.apache.maven.archetype.common.Constants;
 
 /** @plexus.component */
 public class DefaultArchetypeGenerationConfigurator
@@ -65,7 +64,11 @@
     /** @plexus.requirement */
     private ArchetypePropertiesManager archetypePropertiesManager;
 
-    public ArchetypeConfiguration configureArchetype(
+    /** @plexus.requirement */
+    private ArchetypeRegistryManager archetypeRegistryManager;
+
+    private ArchetypeConfiguration configureArchetype(
+        ArchetypeGenerationRequest request,
         Boolean interactiveMode,
         File propertyFile,
         Properties commandLineProperties,
@@ -82,7 +85,7 @@
     {
         // propertyFile is no longer needed
         Properties properties =
-            initialiseArchetypeProperties( commandLineProperties, propertyFile );
+            initialiseArchetypeProperties( commandLineProperties );
 
         // The archetype should be defined at this point and exist!
         ArchetypeDefinition archetypeDefinition =
@@ -93,6 +96,8 @@
             throw new ArchetypeNotDefined( "The archetype is not defined" );
         }
 
+        repositories.add( archetypeRegistryManager.createRepository( request.getRemoteRepository(),
archetypeDefinition.getArtifactId() + "-repo" ) );
+
         if ( !archetypeArtifactManager.exists( archetypeDefinition, localRepository, repositories
) )
         {
             throw new UnknownArchetype(
@@ -102,6 +107,8 @@
             );
         }
 
+        request.setArchetypeVersion( archetypeDefinition.getVersion() );
+
         ArchetypeConfiguration archetypeConfiguration;
 
         if (
@@ -206,21 +213,12 @@
             }
         }
 
-//        propertyFile is no longer needed
-//        archetypePropertiesManager.writeProperties(
-//            archetypeConfiguration.toProperties(),
-//            propertyFile
-//        );
-
         return archetypeConfiguration;
     }
 
     private Properties initialiseArchetypeProperties(
-        Properties commandLineProperties,
-        File propertyFile
-    )
+        Properties commandLineProperties )
         throws
-        FileNotFoundException,
         IOException
     {
         Properties properties = new Properties();
@@ -261,6 +259,7 @@
 
         // propertyFile is no longer needed, set to null:
         ArchetypeConfiguration archetypeConfiguration = configureArchetype(
+            request,
             interactiveMode,
             null,
             p,
@@ -269,16 +268,23 @@
         );
 
         request.setGroupId( archetypeConfiguration.getProperty( Constants.GROUP_ID ) );
+
         request.setArtifactId( archetypeConfiguration.getProperty( Constants.ARTIFACT_ID
) );
+
         request.setVersion( archetypeConfiguration.getProperty( Constants.VERSION ) );
+
         request.setPackage( archetypeConfiguration.getProperty( Constants.PACKAGE ) );
+
         Properties properties = archetypeConfiguration.getProperties();
+
         properties.remove( Constants.GROUP_ID );
+
         properties.remove( Constants.ARTIFACT_ID );
+
         properties.remove( Constants.VERSION );
+
         properties.remove( Constants.PACKAGE );
 
         request.setProperties( properties );
-
     }
 }

Modified: maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java?rev=582463&r1=582462&r2=582463&view=diff
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
(original)
+++ maven/sandbox/trunk/archetypeng/archetypeng-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
Sat Oct  6 00:03:35 2007
@@ -23,8 +23,6 @@
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
-import org.apache.maven.archetype.common.ArchetypeFactory;
-import org.apache.maven.archetype.common.ArchetypePropertiesManager;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
 import org.apache.maven.archetype.exception.ArchetypeNotDefined;
 import org.apache.maven.archetype.exception.ArchetypeSelectionFailure;
@@ -32,7 +30,6 @@
 import org.apache.maven.archetype.exception.UnknownGroup;
 import org.apache.maven.archetype.source.ArchetypeDataSource;
 import org.apache.maven.archetype.source.ArchetypeDataSourceException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.codehaus.plexus.components.interactivity.PrompterException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.PropertyUtils;
@@ -55,12 +52,6 @@
     private ArchetypeArtifactManager archetypeArtifactManager;
 
     /** @plexus.requirement */
-    private ArchetypeFactory archetypeFactory;
-
-    /** @plexus.requirement */
-    private ArchetypePropertiesManager archetypePropertiesManager;
-
-    /** @plexus.requirement */
     private ArchetypeRegistryManager archetypeRegistryManager;
 
     /** @plexus.requirement */
@@ -69,11 +60,9 @@
     /** @plexus.requirement role="org.apache.maven.archetype.source.ArchetypeDataSource"
*/
     private Map archetypeSources;
 
-    private ArchetypeDefinition selectArchetype(
-        Boolean interactiveMode,
-        ArtifactRepository localRepository,
-        List repositories
-    )
+    public void selectArchetype(
+        ArchetypeGenerationRequest request,
+        Boolean interactiveMode )
         throws
         ArchetypeNotDefined,
         UnknownArchetype,
@@ -82,11 +71,11 @@
         PrompterException,
         ArchetypeSelectionFailure
     {
-        ArchetypeDefinition archetypeDefinition = new ArchetypeDefinition();
+        ArchetypeDefinition definition = new ArchetypeDefinition();
 
         if ( interactiveMode.booleanValue() )
         {
-            if ( !archetypeDefinition.isDefined() )
+            if ( !definition.isDefined() )
             {
                 List archetypes = new ArrayList();
 
@@ -140,19 +129,19 @@
                 {
                     Archetype archetype = archetypeSelectionQueryer.selectArchetype( archetypes
);
 
-                    archetypeDefinition.setArtifactId( archetype.getArtifactId() );
+                    definition.setArtifactId( archetype.getArtifactId() );
 
-                    archetypeDefinition.setName( archetype.getArtifactId() );
+                    definition.setName( archetype.getArtifactId() );
 
-                    archetypeDefinition.setGroupId( archetype.getGroupId() );
+                    definition.setGroupId( archetype.getGroupId() );
 
-                    archetypeDefinition.setVersion( archetype.getVersion() );
+                    definition.setVersion( archetype.getVersion() );
 
-                    archetypeDefinition.setRepository( archetype.getRepository() );
+                    definition.setRepository( archetype.getRepository() );
 
                     String goals = StringUtils.join( archetype.getGoals().iterator(), ","
);
 
-                    archetypeDefinition.setGoals( goals );
+                    definition.setGoals( goals );
                 }
             }
         }
@@ -160,32 +149,24 @@
         // Make sure the groupId and artifactId are valid, the version may just default to
         // the latest release.
 
-        if ( !archetypeDefinition.isPartiallyDefined() )
+        if ( !definition.isPartiallyDefined() )
         {
             throw new ArchetypeSelectionFailure( "No valid archetypes could be found to choose."
);
         }
 
-        //TODO: this needs to be remove and let the generator take the selection + configuration
and do what's 
-        //      necessary. The selector should not be downloading anything.
+        request.setArchetypeGroupId( definition.getGroupId() );
 
-        repositories.add(
-            archetypeRegistryManager.createRepository( archetypeDefinition.getRepository(),
archetypeDefinition.getArtifactId() + "-repo" ) );
+        request.setArchetypeArtifactId( definition.getArtifactId() );
 
-        if ( !archetypeArtifactManager.exists(
-            archetypeDefinition,
-            localRepository,
-            repositories ) )
-        {
-            throw new UnknownArchetype(
-                "The desired archetype does not exist (" + archetypeDefinition.getGroupId()
+ ":"
-                    + archetypeDefinition.getArtifactId() + ":" + archetypeDefinition.getVersion()
-                    + ")"
-            );
-        }
-        else
-        {
-            return archetypeDefinition;
-        }
+        request.setArchetypeVersion( definition.getVersion() );
+
+        request.setArchetypeRepository( definition.getRepository() );
+
+        request.setArchetypeGoals( definition.getGoals() );
+
+        request.setArchetypeName( definition.getName() );
+
+        request.setRemoteRepository( definition.getRepository() );        
     }
 
     private Properties getArchetypeDataSourceProperties( String sourceRoleHint,
@@ -206,127 +187,5 @@
         }
 
         return p;
-    }
-
-    public void selectArchetype(
-        ArchetypeGenerationRequest request,
-        Boolean interactiveMode,
-        File archetypeRegistryFile,
-        List repositories
-    )
-        throws
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        UnknownGroup,
-        IOException,
-        PrompterException,
-        ArchetypeSelectionFailure
-    {
-        ArchetypeDefinition definition = new ArchetypeDefinition();
-
-        if ( interactiveMode.booleanValue() )
-        {
-            if ( !definition.isDefined() )
-            {
-                List archetypes = new ArrayList();
-
-                File archetypeCatalogPropertiesFile = new File( System.getProperty( "user.home"
), ".m2/archetype-catalog.properties" );
-
-                if ( archetypeCatalogPropertiesFile.exists() )
-                {
-                    Properties archetypeCatalogProperties = PropertyUtils.loadProperties(
archetypeCatalogPropertiesFile );
-
-                    getLogger().debug( "Using catalogs " + archetypeCatalogProperties );
-
-                    String[] sources = StringUtils.split( archetypeCatalogProperties.getProperty(
"sources" ), "," );
-
-                    for ( int i = 0; i < sources.length; i++ )
-                    {
-                        String sourceRoleHint = sources[i];
-
-                        getLogger().debug( "Reading catalog " + sourceRoleHint );
-
-                        try
-                        {
-                            ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get(
sourceRoleHint );
-
-                            archetypes.addAll(
-                                source.getArchetypes( getArchetypeDataSourceProperties( sourceRoleHint,
archetypeCatalogProperties ) ) );
-                        }
-                        catch ( ArchetypeDataSourceException e )
-                        {
-                            getLogger().warn( "Unable to get archetypes from " + sourceRoleHint
+ " source. [" + e.getMessage() + "]" );
-                        }
-                    }
-                }
-
-                if ( archetypes.size() == 0 )
-                {
-                    getLogger().debug( "Using wiki catalog" );
-
-                    try
-                    {
-                        ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get(
"wiki" );
-
-                        archetypes.addAll( source.getArchetypes( new Properties() ) );
-                    }
-                    catch ( ArchetypeDataSourceException e )
-                    {
-                        getLogger().warn( "Unable to get archetypes from default wiki  source.
[" + e.getMessage() + "]" );
-                    }
-                }
-
-                if ( archetypes.size() > 0 )
-                {
-                    Archetype archetype = archetypeSelectionQueryer.selectArchetype( archetypes
);
-
-                    definition.setArtifactId( archetype.getArtifactId() );
-
-                    definition.setName( archetype.getArtifactId() );
-
-                    definition.setGroupId( archetype.getGroupId() );
-
-                    definition.setVersion( archetype.getVersion() );
-
-                    definition.setRepository( archetype.getRepository() );
-
-                    String goals = StringUtils.join( archetype.getGoals().iterator(), ","
);
-
-                    definition.setGoals( goals );
-                }
-            }
-        }
-
-        // Make sure the groupId and artifactId are valid, the version may just default to
-        // the latest release.
-
-        if ( !definition.isPartiallyDefined() )
-        {
-            throw new ArchetypeSelectionFailure( "No valid archetypes could be found to choose."
);
-        }
-
-        //TODO: this needs to be remove and let the generator take the selection + configuration
and do what's 
-        //      necessary. The selector should not be downloading anything.
-
-        repositories.add(
-            archetypeRegistryManager.createRepository( definition.getRepository(), definition.getArtifactId()
+ "-repo" ) );
-
-        if ( !archetypeArtifactManager.exists( definition, request.getLocalRepository(),
repositories ) )
-        {
-            throw new UnknownArchetype(
-                "The desired archetype does not exist (" + definition.getGroupId() + ":"
-                    + definition.getArtifactId() + ":" + definition.getVersion()
-                    + ")"
-            );
-        }
-        else
-        {
-            request.setArchetypeGroupId( definition.getGroupId() );
-            request.setArchetypeArtifactId( definition.getArtifactId() );
-            request.setArchetypeVersion( definition.getVersion() );
-            request.setArchetypeRepository( definition.getRepository() );
-            request.setArchetypeGoals( definition.getGoals() );
-            request.setArchetypeName( definition.getName() );
-        }
     }
 }



Mime
View raw message