You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ra...@apache.org on 2009/03/23 22:49:05 UTC

svn commit: r757559 [6/7] - in /maven/archetype/branches/archetype-refactor-groovy: ./ grarchetype-common/ grarchetype-common/src/ grarchetype-common/src/main/ grarchetype-common/src/main/groovy/ grarchetype-common/src/main/groovy/groovy/ grarchetype-c...

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/pom.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/pom.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/pom.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.maven.grarchetype</groupId>
+        <artifactId>maven-grarchetype</artifactId>
+        <version>2.0-alpha-5-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-grarchetype-plugin</artifactId>
+
+    <name>Maven GRArchetype Plugin</name>
+    <url>http://maven.apache.org/plugins/maven-archetype-plugin</url>
+    <packaging>maven-plugin</packaging>
+
+    <prerequisites>
+        <maven>${mavenVersion}</maven>
+    </prerequisites>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/archetype-plugin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/archetype-plugin</developerConnection>
+        <url>http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin</url>
+    </scm>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.grarchetype</groupId>
+            <artifactId>grarchetype-common</artifactId>
+            <version>2.0-alpha-5-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>1.6.0</version>
+        </dependency>
+        <!--dependency>
+            <groupId>org.codehaus.groovy.maven</groupId>
+            <artifactId>gmaven-mojo</artifactId>
+            <version>1.0-rc-4</version>
+        </dependency-->
+        <dependency>
+            <groupId>org.apache.maven.shared</groupId>
+            <artifactId>maven-plugin-testing-harness</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-file</artifactId>
+            <version>1.0-beta-2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-http</artifactId>
+            <version>1.0-beta-2</version><!-- with 1.0-beta-4 some tests fail -->
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-core-api-container</artifactId>
+            <version>1.0-alpha-6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-core-api-util</artifactId>
+            <version>1.0-alpha-6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-core-api-generic</artifactId>
+            <version>1.0-alpha-6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-core-api-module</artifactId>
+            <version>1.0-alpha-6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-core-container-jetty</artifactId>
+            <version>1.0-alpha-6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>jetty</artifactId>
+            <version>6.1.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.parent.groupId}</groupId>
+            <artifactId>grarchetype-repository</artifactId>
+            <version>${project.version}</version>
+            <type>war</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.4.3</version>
+                <configuration>
+                    <goalPrefix>grarchetype</goalPrefix>
+                    <updateReleaseInfo>true</updateReleaseInfo>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>generated-descriptor</id>
+                        <goals>
+                            <goal>descriptor</goal>
+                        </goals>
+                        <phase>compile</phase>
+                    </execution>
+                    <execution>
+                        <id>generated-helpmojo</id>
+                        <goals>
+                            <goal>helpmojo</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>maven.home</name>
+                            <value>${maven.home}</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>1.0-rc-5</version>
+                <configuration>
+                    <providerSelection>1.6</providerSelection>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>generateStubs</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>compile</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>test-compile</id>
+                        <phase>test-compile</phase>
+                        <goals>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>prepareRepositories</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+log.info "Preparing Repositories"
+def dir = "${project.basedir}/target/repositories"
+ant.delete dir: dir
+ant.mkdir dir: dir
+ant.copy( toDir: dir ) {
+    fileset dir: "${project.basedir}/src/test/repositories"
+}
+
+def prepareArchetype = { archetype, archetypeVersion ->
+    if( project.packaging != 'pom' ) {
+        log.info "Preparing ${archetype}-${archetypeVersion} archetype..."
+        dir = "${project.basedir}/target/repositories/central/archetypes/${archetype}/${archetypeVersion}"
+        ant.mkdir dir: dir
+        ant.jar destFile: "${dir}/${archetype}-${archetypeVersion}.jar", basedir: "${project.basedir}/src/test/archetypes/${archetype}"
+    }
+}
+prepareArchetype 'nested-properties-main', '1.0'
+prepareArchetype 'nested-properties-inner', '1.0'
+prepareArchetype 'nested-properties-innest', '1.0'
+
+prepareArchetype 'old', '1.0'
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/wars</outputDirectory>
+                            <overWriteReleases>true</overWriteReleases>
+                            <overWriteSnapshots>true</overWriteSnapshots>
+                            <includeTypes>war</includeTypes>
+                            <stripVersion>true</stripVersion>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.4.3</version>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>report</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,125 @@
+package org.apache.maven.archetype.mojos
+import org.apache.maven.plugin.AbstractMojo
+import org.apache.maven.plugin.ContextEnabled
+import org.apache.maven.plugin.MojoExecutionException
+import org.apache.maven.plugin.MojoFailureException
+import org.apache.maven.archetype.Archetype
+import org.apache.maven.archetype.ArchetypeGenerationRequest
+
+import org.apache.maven.execution.MavenSession
+import org.apache.maven.archetype.ui.ArchetypeSelector
+import org.apache.maven.archetype.ui.ArchetypeGenerationConfigurator
+
+/**
+ *
+ * @author rafale
+ * @requiresProject false
+ * @goal generate
+ */
+class CreateProjectFromArchetypeMojo
+extends AbstractMojo
+implements ContextEnabled {
+
+    /** @component */
+    private Archetype archetype
+    /** @component */
+    private ArchetypeSelector selector
+    /** @component */
+    private ArchetypeGenerationConfigurator configurator
+
+
+    /**
+     * The archetype's artifactId.
+     *
+     * @parameter expression="${archetypeArtifactId}"
+     */
+    private String archetypeArtifactId
+
+    /**
+     * The archetype's groupId.
+     *
+     * @parameter expression="${archetypeGroupId}"
+     */
+    private String archetypeGroupId
+
+    /**
+     * The archetype's version.
+     *
+     * @parameter expression="${archetypeVersion}"
+     */
+    private String archetypeVersion
+
+    /**
+     * The archetype's catalogs.
+     * It is a comma separated list of catalogs.
+     * Catalogs use scheme:
+     * - 'file://...' with archetype-catalog.xml automatically appended when defining a directory
+     * - 'http://...' with archetype-catalog.xml always appended
+     * - 'local' which is the shortcut for 'file://~/.m2/archetype-catalog.xml'
+     * - 'remote' which is the shortcut for 'http://repo1.maven.org/maven2'
+     * - 'internal' which is an internal catalog
+     *
+     * @parameter expression="${archetypeCatalog}" default-value="internal,local"
+     */
+    private String archetypeCatalog
+
+    /**
+     * User settings use to check the interactiveMode.
+     *
+     * @parameter expression="${interactiveMode}" default-value="${settings.interactiveMode}"
+     * @required
+     */
+    private Boolean interactiveMode
+
+    /** @parameter expression="${basedir}" */
+    private File basedir
+
+    /**
+     * @parameter expression="${session}"
+     * @readonly
+     */
+    MavenSession session
+
+    public void execute()
+    throws MojoExecutionException, MojoFailureException {
+
+        println"\n\n session ${session.dump()}"
+        println"\n\n container ${session.container.dump()}"
+        println"\n\n currentProject ${session.currentProject.dump()}"
+        println"\n\n eventDispatcher ${session.eventDispatcher.dump()}"
+        println"\n\n executionProperties ${session.executionProperties.dump()}"
+        println"\n\n executionRootDir ${session.executionRootDir.dump()}"
+        println"\n\n goals ${session.goals.dump()}"
+        println"\n\n localRepository ${session.localRepository.dump()}"
+        println"\n\n reactorManager ${session.reactorManager.dump()}"
+        println"\n\n settings ${session.settings.dump()}"
+        println"\n\n startTime ${session.startTime.dump()}"
+        println"\n\n usingPOMsFromFilesystem ${session.usingPOMsFromFilesystem.dump()}"
+//        println"session ${session.dump()}"
+//        println"session ${session.dump()}"
+//        println"session ${session.dump()}"
+//        println"session ${session.dump()}"
+//        println"session ${session.dump()}"
+
+
+        def request = new ArchetypeGenerationRequest(
+            groupId : archetypeGroupId,
+            artifactId : archetypeArtifactId,
+            version : archetypeVersion,
+            outputDirectory : basedir.absolutePath,
+            repositories : session.currentProject.remoteArtifactRepositories,
+            localRepository : session.localRepository
+        )
+        selector.selectArchetype request, interactiveMode, archetypeCatalog
+        configurator.configureArchetype request, interactiveMode, session.executionProperties
+
+        def result = archetype.generateProjectFromArchetype( request )
+
+
+        println "RESULT=${result?.dump()}"
+        result?.cause?.printStackTrace()
+
+    }
+
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,13 @@
+package org.apache.maven.archetype.ui
+
+/**
+ *
+ * @author raphaelpieroni
+ */
+interface ArchetypeGenerationConfigurator {
+    String ROLE = 'org.apache.maven.archetype.ui.ArchetypeGenerationConfigurator'
+
+    void configureArchetype( request, interactiveMode, executionProperties )
+
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypePrompter.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypePrompter.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypePrompter.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypePrompter.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,135 @@
+package org.apache.maven.archetype.ui
+
+import java.io.IOException
+import java.util.List
+import org.codehaus.plexus.components.interactivity.InputHandler
+import org.codehaus.plexus.components.interactivity.OutputHandler
+import org.codehaus.plexus.components.interactivity.Prompter
+import org.codehaus.plexus.components.interactivity.PrompterException
+import org.codehaus.plexus.util.StringUtils
+
+/**
+ *
+ * @author raphaelpieroni
+ * @plexus.component role-hint="archetype"
+ */
+public class ArchetypePrompter implements Prompter {
+
+    /**
+     * @plexus.requirement
+     */
+    private OutputHandler outputHandler
+
+    /**
+     * @plexus.requirement
+     */
+    private InputHandler inputHandler
+
+    public String prompt( String message )
+    throws PrompterException {
+        try {
+            writePrompt message 
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to present prompt", e )
+        }
+
+        try {
+            return inputHandler.readLine()
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to read user response", e )
+        }
+    }
+
+    public String prompt( String message, String defaultReply )
+    throws PrompterException {
+        try {
+            writePrompt( formatMessage( message, null, defaultReply ) )
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to present prompt", e )
+        }
+
+        try {
+            def line = inputHandler.readLine()
+            if ( StringUtils.isEmpty( line ) ) {
+                line = defaultReply
+            }
+
+            return line
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to read user response", e )
+        }
+    }
+
+    public String prompt( String message, List possibleValues, String defaultReply )
+    throws PrompterException {
+        String formattedMessage = formatMessage( message, possibleValues, defaultReply )
+
+        String line
+
+        while ( !line || !possibleValues.contains( line ) ) {
+            try {
+                writePrompt formattedMessage 
+            } catch ( IOException e ) {
+                throw new PrompterException( "Failed to present prompt", e )
+            }
+
+            try {
+                line = inputHandler.readLine()
+            } catch ( IOException e ) {
+                throw new PrompterException( "Failed to read user response", e )
+            }
+
+            if ( StringUtils.isEmpty( line ) ) {
+                line = defaultReply
+            }
+
+            if ( !line && !possibleValues.contains( line ) ) {
+                try {
+                    outputHandler.writeLine "Invalid selection." 
+                } catch ( IOException e ) {
+                    throw new PrompterException( "Failed to present feedback", e )
+                }
+            }
+        } 
+
+        return line
+    }
+
+    public String prompt( String message, List possibleValues )
+    throws PrompterException {
+        return prompt( message, possibleValues, null )
+    }
+
+    public String promptForPassword( String message )
+    throws PrompterException {
+        try {
+            writePrompt message 
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to present prompt", e )
+        }
+
+        try {
+            return inputHandler.readPassword()
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to read user response", e )
+        }
+    }
+
+    private String formatMessage( String message, List possibleValues, String defaultReply ) {
+        "$message${defaultReply?:''}"
+    }
+
+    private void writePrompt( String message )
+    throws IOException {
+        outputHandler.write message + ": " 
+    }
+
+    public void showMessage( String message )
+    throws PrompterException {
+        try {
+            writePrompt message 
+        } catch ( IOException e ) {
+            throw new PrompterException( "Failed to present prompt", e )
+        }
+    }
+}

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypePrompter.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeSelector.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeSelector.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeSelector.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeSelector.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,13 @@
+package org.apache.maven.archetype.ui
+import org.apache.maven.archetype.ArchetypeGenerationRequest
+
+/**
+ *
+ * @author raphaelpieroni
+ */
+interface ArchetypeSelector {
+    String ROLE = 'org.apache.maven.archetype.ui.ArchetypeSelector'
+
+    void selectArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs )
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/ArchetypeSelector.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,187 @@
+package org.apache.maven.archetype.ui
+import org.codehaus.plexus.logging.AbstractLogEnabled
+import org.apache.maven.archetype.artifact.ArchetypeArtifactManager
+import org.codehaus.plexus.components.interactivity.Prompter
+import org.codehaus.plexus.util.StringUtils
+
+/**
+ *
+ * @author raphaelpieroni
+ * @plexus.component
+ */
+class DefaultArchetypeGenerationConfigurator
+extends AbstractLogEnabled
+implements ArchetypeGenerationConfigurator {
+
+    /** @plexus.requirement */
+    private ArchetypeArtifactManager artifactManager
+
+    /** @plexus.requirement */
+    private Prompter prompter
+
+    void configureArchetype( request, interactiveMode, executionProperties ) {
+        def requiredProperties = loadRequiredProperties( request )
+        applyIncomingProperties requiredProperties, executionProperties
+//        applyDefaultValues requiredProperties
+
+        if( !interactiveMode ) {
+            if( !configured( requiredProperties ) ) {
+                describeMissingProperties requiredProperties
+                throw new Exception( "There is some missing properties" )
+            }
+        } else {
+            def confirmed = false
+            while( !confirmed ){
+                if( !configured( requiredProperties ) ) {
+                    askForUnconfiguredProperties requiredProperties
+                }
+                if( askForConfirmation( request, requiredProperties  ) ) {
+                    confirmed = true
+                } else {
+                    resetConfiguredValues requiredProperties
+                    applyIncomingProperties requiredProperties, executionProperties
+                }
+            }
+        }
+        applyProperties requiredProperties, request
+    }
+    def loadRequiredProperties( request ) {
+        def unsorted = [:]
+        def compareProperty = { left, right ->
+            def leftDefault = unsorted[left]?.defaultValue
+            def rightDefault = unsorted[right]?.defaultValue
+            if( leftDefault?.indexOf( "\${$right}" ) ) return 1
+            if( rightDefault?.indexOf( "\${$left}" ) ) return -1
+            return comparePropertyName( left, right )
+        }
+        def requiredProperties = new TreeMap([compare:compareProperty] as Comparator)
+        def archetypeFileMap = artifactManager.getNestedArchetypeFiles(
+            [groupId:request.groupId, artifactId:request.artifactId, version:request.version],
+            request.localRepository, request.repositories )
+        archetypeFileMap.each { key, archetypeFile ->
+            if( !artifactManager.isLegacyArchetype( archetypeFile ) ) {
+                def descriptor = new XmlSlurper().parse( artifactManager.getFilesetArchetypeDescriptor( archetypeFile ) )
+                descriptor.requiredProperties.requiredProperty.each {
+                    def requiredProperty = [name:it.@key.toString(), archetype:key]
+                    if( it.defaultValue.text().toString() ) requiredProperty.defaultValue = it.defaultValue.text().toString()
+                    if( requiredProperty.defaultValue ) requiredProperty.value = requiredProperty.defaultValue
+                    else requiredProperty.defaultValue = null
+                    if( it.description.text().toString() ) {
+                        requiredProperty.description = it.description.text().toString()
+                    } else {
+                        requiredProperty.description = requiredProperty.name
+                    }
+                    unsorted[requiredProperty.name] = requiredProperty
+                    requiredProperties[requiredProperty.name] = requiredProperty
+                }
+            }
+        }
+        if( !requiredProperties.containsKey( "groupId" ) ) {
+            def requiredProperty = [name:"groupId", description:"", archetype:request, defaultValue:null]
+            unsorted[requiredProperty.name] = requiredProperty
+            requiredProperties[requiredProperty.name] = requiredProperty
+        }
+        if( !requiredProperties.containsKey( "artfactId" ) ) {
+            def requiredProperty = [name:"artifactId", description:"", archetype:request, defaultValue:null]
+            unsorted[requiredProperty.name] = requiredProperty
+            requiredProperties[requiredProperty.name] = requiredProperty
+        }
+        if( !requiredProperties.containsKey( "version" ) ) {
+            def requiredProperty = [name:"version", description:"", archetype:request, defaultValue:null]
+            unsorted[requiredProperty.name] = requiredProperty
+            requiredProperties[requiredProperty.name] = requiredProperty
+        }
+        if( !requiredProperties.containsKey( "packageName" ) ) { // package if no package name defined
+            def requiredProperty = [name:"packageName", description:"", archetype:request, defaultValue:'${groupId}']
+            unsorted[requiredProperty.name] = requiredProperty
+            requiredProperties[requiredProperty.name] = requiredProperty
+        }
+        if( !requiredProperties.containsKey( "package" ) ) {
+            def requiredProperty = [name:"package", description:"", archetype:request, defaultValue:
+            requiredProperties["packageName"]?.value?:requiredProperties["packageName"]?.defaultValue?:'${groupId}']
+            unsorted[requiredProperty.name] = requiredProperty
+            requiredProperties[requiredProperty.name] = requiredProperty
+        }
+        unsorted["packageName"] = null //package removed in favor of packageName
+        unsorted.remove "packageName" //package removed in favor of packageName
+        requiredProperties["packageName"] = null //package removed in favor of packageName
+        requiredProperties.remove "packageName"//package removed in favor of packageName
+println"DDD ${requiredProperties?.keySet()}"
+        return requiredProperties
+    }
+    def comparePropertyName( left, right ){
+        if( "groupId" == left ) return -1
+        if( "groupId" == right ) return 1
+        if( "artifactId" == left ) return -1
+        if( "artifactId" == right ) return 1
+        if( "version" == left ) return -1
+        if( "version" == right ) return 1
+        if( "package" == left ) return -1
+        if( "package" == right ) return 1
+        return left.compareTo( right )
+    }
+    def applyIncomingProperties( requiredProperties, executionProperties ) {
+        requiredProperties.each { key, property ->
+            if( executionProperties.containsKey( key ) ) {
+                property.value = executionProperties[key]
+            }
+        }
+    }
+    def configured( requiredProperties ) {
+        def configured = true
+        requiredProperties.each { key, property ->
+            if( !property?.value ) configured = false
+        }
+        return configured
+    }
+    def describeMissingProperties( requiredProperties ) {
+        requiredProperties.each { key, property ->
+            if( !property.value ) logger.warn "Property '${key}' is missing. Add -D${key}=someValue"
+        }
+    }
+    def askForUnconfiguredProperties( requiredProperties ) {
+        requiredProperties.each { key, property ->
+            if( !property.value ) {
+                property.value = askForUnconfiguredProperty( key, property.description, getDefaultValue( property.defaultValue, requiredProperties ) )
+            }
+        }
+    }
+    def getDefaultValue( initialDefault, requiredProperties ) {
+        String defaultValue = initialDefault
+        requiredProperties.each { key, property ->
+            defaultValue = StringUtils.replace( defaultValue, '${' + key + '}', property.value )
+        }
+        return defaultValue
+    }
+    def askForUnconfiguredProperty( name, description, defaultValue ) {
+        def query = "Define value for property '$name${description ? '(' + description + ')' : ''}': "
+        if ( defaultValue ) {
+            return prompter.prompt( query, defaultValue )
+        } else {
+            return prompter.prompt( query )
+        }
+    }
+    def askForConfirmation( request, requiredProperties  ) {
+        def query = "Confirm properties configuration:\n"
+        requiredProperties.each { key, property ->
+            query += "$key: ${property.value}\n"
+        }
+        return "Y" == prompter.prompt( query, "Y" ).toString().toUpperCase()
+    }
+    def applyDefaultValues( requiredProperties ) {
+//dont reset default!!!
+    }
+    def resetConfiguredValues( requiredProperties ) {
+        requiredProperties.each { key, property ->
+            property.value = null
+        }
+    }
+    def applyProperties( requiredProperties, request ) {
+      def requestProperties = [:]
+      requiredProperties.each { key, property ->
+            if(key == 'package') key = 'packageName'
+            requestProperties[key] = property.value
+        }
+      request.generationFilterProperties = requestProperties as Properties
+    }
+}

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelector.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelector.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelector.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelector.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,146 @@
+package org.apache.maven.archetype.ui
+import org.apache.maven.archetype.ArchetypeGenerationRequest
+import org.apache.maven.archetype.catalog.ArchetypeCataloger
+import org.codehaus.plexus.logging.AbstractLogEnabled
+import org.codehaus.plexus.components.interactivity.Prompter
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout
+import org.apache.maven.artifact.repository.DefaultArtifactRepository
+import org.apache.maven.archetype.util.RepositoryCreator
+
+/**
+ *
+ * @author raphaelpieroni
+ * @plexus.component
+ */
+class DefaultArchetypeSelector
+extends AbstractLogEnabled
+implements ArchetypeSelector {
+    static DEFAULT_ARCHETYPE = [groupId:"org.apache.maven.archetypes", artifactId:"maven-archetype-quickstart"]
+
+    /** @plexus.requirement */
+    private RepositoryCreator repositoryCreator
+
+    /** @plexus.requirement */
+    private ArchetypeCataloger archetypeCataloger
+
+    /** @plexus.requirement role-hint="archetype" */
+    private Prompter prompter
+    
+    void selectArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs ) {
+        def definition = [groupId:request.groupId, artifactId:request.artifactId, version:request.version]
+
+        def archetypeCatalogs = archetypeCataloger.getArchetypesByCatalog( catalogs )
+        def catalogArchetype
+        def repositories = request.repositories.clone()
+
+        if( archetypeDefined( definition ) ) {
+            catalogArchetype = archetypeCataloger.searchArchetype( definition, archetypeCatalogs )
+            if( catalogArchetype ) repositories.add repositoryCreator.createRepository( catalogArchetype.repository )
+            if( archetypeCataloger.archetypeRecursivelyExists( catalogArchetype, archetypeCatalogs, request.localRepository, repositories ) ) {
+                request.repositories = repositories
+                logger.info "Using defined archetype $definition"
+                return
+            } else {
+                logger.error "Defined archetype $definition not found"
+                throw new RuntimeException( "Defined archetype $definition not found" )
+            }
+        } else if( !interactiveMode ) {
+            catalogArchetype = archetypeCataloger.searchArchetype( DEFAULT_ARCHETYPE, archetypeCatalogs )
+            if( catalogArchetype ) repositories.add repositoryCreator.createRepository( catalogArchetype.repository )
+            if( archetypeCataloger.archetypeRecursivelyExists( catalogArchetype, archetypeCatalogs, request.localRepository, request.repositories ) ) {
+                request.repositories = repositories
+                def archetype = archetypeCataloger.searchArchetype( catalogArchetype, archetypeCatalogs )
+                request.groupId = archetype.groupId
+                request.artifactId = archetype.artifactId
+                request.version = archetype.version
+                logger.info "Using default archetype $DEFAULT_ARCHETYPE"
+                return
+            } else {
+                logger.error "Default archetype $DEFAULT_ARCHETYPE not found"
+                throw new RuntimeException( "Default archetype $DEFAULT_ARCHETYPE not found" )
+            }
+        } else {
+            catalogArchetype = askForDefinition( archetypeCatalogs )
+            if( catalogArchetype ) repositories.add repositoryCreator.createRepository( catalogArchetype.repository )
+            if( archetypeCataloger.archetypeRecursivelyExists( catalogArchetype, archetypeCatalogs, request.localRepository, request.repositories ) ) {
+                request.repositories = repositories
+                def archetype = archetypeCataloger.searchArchetype( catalogArchetype, archetypeCatalogs )
+                request.groupId = archetype.groupId
+                request.artifactId = archetype.artifactId
+                request.version = archetype.version
+                logger.info "Using selected archetype $catalogArchetype"
+                return
+            } else {
+                logger.error "Selected archetype $catalogArchetype not found"
+                throw new RuntimeException( "Selected archetype $catalogArchetype not found" )
+            }
+        }
+    }
+
+    def archetypeDefined( definition ) {
+        return definition?.groupId && definition?.artifactId && definition?.version
+    }
+    def askForDefinition( archetypeCatalogs ) {
+        def chooseArchetypeQuery = "Choose archetype:\n"
+        def chooseArchetypeList =[]
+        def archetypeAnswerMap = [:]
+        def archetypeReverseAnswerMap = [:]
+        def archetypeVersions
+        def counter = 1
+        def defaultArchetype = 0
+        archetypeCatalogs.each { key, archetype ->
+            def archetypeKey = "${archetype.groupId}:${archetype.artifactId}".toString()
+            def answerKey = "$counter".toString()
+            if( archetypeReverseAnswerMap.containsKey( archetypeKey ) ) {
+                archetypeVersions = archetypeAnswerMap[ archetypeReverseAnswerMap[archetypeKey] ]
+            } else {
+                archetypeVersions = []
+                archetypeAnswerMap[answerKey] = archetypeVersions
+                chooseArchetypeQuery += "$answerKey:${archetype.catalog} -> ${archetype.artifactId} (${archetype.description})\n"
+                chooseArchetypeList.add answerKey
+                if( archetypeKey == DEFAULT_ARCHETYPE ) {
+                    defaultArchetype = answerKey
+                }
+                archetypeReverseAnswerMap[archetypeKey] = answerKey
+                counter ++
+            }
+            archetypeVersions.add archetype
+        }
+        chooseArchetypeQuery += "choose a number: "
+
+        def chooseArchetypeAnswer
+        if( !defaultArchetype ) {
+            chooseArchetypeAnswer = prompter.prompt( chooseArchetypeQuery, chooseArchetypeList )
+        } else {
+            chooseArchetypeAnswer = prompter.prompt( chooseArchetypeQuery, chooseArchetypeList, defaultArchetype )
+        }
+
+        archetypeVersions = archetypeAnswerMap[chooseArchetypeAnswer]
+        if( archetypeVersions.size() == 1 ) {
+            return archetypeVersions[0]
+        } else {
+            return askForVersion( archetypeVersions )
+        }
+    }
+    def askForVersion( archetypes )
+    {
+        def chooseVersionQuery = "Choose version: \n"
+        List chooseVersionList = []
+        def versionAnswerMap = [:]
+
+        def counter = 1
+        archetypes.each { archetype ->
+            def answerKey = "$counter".toString()
+            versionAnswerMap.put answerKey, archetype
+            chooseVersionList.add answerKey
+            chooseVersionQuery += "$counter: ${archetype.version}\n"
+            counter++
+        }
+        chooseVersionQuery += "Choose a number: "
+
+        return versionAnswerMap[prompter.prompt( chooseVersionQuery, chooseVersionList )]
+    }
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/main/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelector.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-inner/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-inner/META-INF/maven/archetype-metadata.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-inner/META-INF/maven/archetype-metadata.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-inner/META-INF/maven/archetype-metadata.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<archetype-descriptor name="nested-properties-inner" partial="false" >
+
+    <requiredProperties>
+        <requiredProperty key="innerDefault">
+            <defaultValue>1</defaultValue>
+            <description>1</description>
+        </requiredProperty>
+        <requiredProperty key="innerNoDefault">
+            <description>1</description>
+        </requiredProperty>
+        <requiredProperty key="innerNoNothing"/>
+    </requiredProperties>
+
+    <fileSets/>
+
+    <modules>
+        <module artifactId="${rootArtifactId}-innest" nested="true" archetypeGroupId="archetypes" archetypeArtifactId="nested-properties-innest" archetypeVersion="1.0" />
+    </modules>
+
+</archetype-descriptor>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-inner/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-innest/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-innest/META-INF/maven/archetype-metadata.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-innest/META-INF/maven/archetype-metadata.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-innest/META-INF/maven/archetype-metadata.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<archetype-descriptor name="nested-properties-innest" partial="false" >
+
+    <requiredProperties>
+    <requiredProperty key="innestDefault">
+      <defaultValue>1</defaultValue>
+      <description>1</description>
+    </requiredProperty>
+    <requiredProperty key="innestNoDefault">
+      <description>1</description>
+    </requiredProperty>
+    <requiredProperty key="innestNoNothing"/>
+    </requiredProperties>
+
+    <fileSets/>
+
+    <modules/>
+
+</archetype-descriptor>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-innest/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-main/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-main/META-INF/maven/archetype-metadata.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-main/META-INF/maven/archetype-metadata.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-main/META-INF/maven/archetype-metadata.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<archetype-descriptor name="nested-properties-main" partial="false" >
+
+    <requiredProperties>
+        <requiredProperty key="mainDefault">
+            <defaultValue>1</defaultValue>
+            <description>1</description>
+        </requiredProperty>
+        <requiredProperty key="aPropertyWithInner">
+            <defaultValue>${mainNoDefault}</defaultValue>
+            <description>1</description>
+        </requiredProperty>
+        <requiredProperty key="mainNoDefault">
+            <description>1</description>
+        </requiredProperty>
+        <requiredProperty key="mainNoNothing"/>
+    </requiredProperties>
+
+    <fileSets/>
+
+    <modules>
+        <module artifactId="${rootArtifactId}-inner" nested="true" archetypeGroupId="archetypes" archetypeArtifactId="nested-properties-inner" archetypeVersion="1.0" />
+    </modules>
+
+</archetype-descriptor>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/nested-properties-main/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/META-INF/archetype.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/META-INF/archetype.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/META-INF/archetype.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/META-INF/archetype.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<archetype>
+  <id>old</id>
+  <sources>
+    <source>src/main/java/App.java</source>
+  </sources>
+  <resources>
+    <resource>src/main/resources/App.properties</resource>
+  </resources>
+  <siteResources>
+    <resource>src/site/site.xml</resource>
+  </siteResources>
+</archetype>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/META-INF/archetype.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/pom.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/pom.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/pom.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project
+  xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven archetype Test Old archetype</name>
+  <packaging>jar</packaging>
+
+</project>
\ No newline at end of file

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/java/App.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/java/App.java?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/java/App.java (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/java/App.java Mon Mar 23 21:48:57 2009
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${packageName}

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/java/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/resources/App.properties
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/resources/App.properties?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/resources/App.properties (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/resources/App.properties Mon Mar 23 21:48:57 2009
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${packageName}

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/main/resources/App.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/site/site.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/site/site.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/site/site.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,4 @@
+groupId=${groupId}
+  artifactId=${artifactId}
+  version=${version}
+  package=${packageName}

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/archetypes/old/archetype-resources/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfiguratorTest.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfiguratorTest.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfiguratorTest.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfiguratorTest.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,88 @@
+/*
+ *  Copyright 2009 raphaelpieroni.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+package org.apache.maven.archetype.ui
+import org.apache.maven.plugin.testing.AbstractMojoTestCase
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration
+import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalDeployer
+import org.codehaus.cargo.container.deployer.URLDeployableMonitor
+import org.codehaus.cargo.container.property.ServletPropertySet
+import org.codehaus.cargo.container.deployable.DeployableType
+import org.apache.maven.artifact.repository.ArtifactRepository
+import org.apache.maven.archetype.util.RepositoryCreator
+
+/**
+ *
+ * @author raphaelpieroni
+ */
+class DefaultArchetypeGenerationConfiguratorTest extends AbstractMojoTestCase {
+    def generator
+    def repositoryCreator
+    Jetty6xEmbeddedLocalContainer jettyContainer
+
+    void setUp() {
+        super.setUp()
+        generator = lookup( ArchetypeGenerationConfigurator.ROLE )
+        repositoryCreator = lookup( RepositoryCreator.ROLE )
+
+        //        Start Cargo
+
+        def configuration =
+            new Jetty6xEmbeddedStandaloneLocalConfiguration( "target/repository-webapp" )
+        configuration.setProperty ServletPropertySet.PORT, "18881"
+
+        System.setProperty "org.apache.maven.archetype.reporitory.directory",
+            getTestPath( "target/repositories/" )
+        jettyContainer = new Jetty6xEmbeddedLocalContainer( configuration )
+        jettyContainer.timeout = 180000L
+        jettyContainer.start()
+
+        def factory = new DefaultDeployableFactory()
+        def war = factory.createDeployable( jettyContainer.id,
+            "target/wars/grarchetype-repository.war",
+            DeployableType.WAR )
+
+        war.context = "/"
+
+        def deployer = new Jetty6xEmbeddedLocalDeployer( jettyContainer )
+        deployer.deploy war,
+            new URLDeployableMonitor( new URL( "http://localhost:18881/central/archetype-catalog.xml" ) )
+        deployer.start war
+    }
+    void tearDown() {
+        super.tearDown()
+        //        Stop Cargo
+        jettyContainer.stop()
+    }
+
+    void test_loadRequiredProperties(){
+        println'archetypeDefined'
+
+        println"REPO=${getBasedir()}/target/repositories/local"
+        def localRepository = repositoryCreator.createRepository( "file://${getBasedir()}/target/repositories/local".toString() )
+        def centralRepository = repositoryCreator.createRepository( "http://localhost:18881/central" )
+
+        def properties = generator.loadRequiredProperties(
+            [groupId:'archetypes', artifactId:'nested-properties-main', version:'1.0', localRepository:localRepository, repositories:[centralRepository]])
+        assertEquals 14, properties.size()
+
+    }
+
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfiguratorTest.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelectorTest.groovy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelectorTest.groovy?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelectorTest.groovy (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelectorTest.groovy Mon Mar 23 21:48:57 2009
@@ -0,0 +1,38 @@
+package org.apache.maven.archetype.ui
+import org.junit.Test
+import static org.junit.Assert.*
+import org.codehaus.plexus.PlexusTestCase
+import org.apache.maven.plugin.testing.AbstractMojoTestCase
+
+/**
+ *
+ * @author raphaelpieroni
+ */
+class DefaultArchetypeSelectorTest extends AbstractMojoTestCase {
+    def selector
+    
+    void setUp() {
+        super.setUp()
+        selector = lookup( ArchetypeSelector.ROLE )
+    }
+    void tearDown() {
+        super.tearDown()
+    }
+
+
+    @Test void test_archetypeDefined() {
+        println'archetypeDefined'
+
+        assertFalse selector.archetypeDefined([])
+        assertFalse selector.archetypeDefined([groupId:null, artifactId:null, version:null])
+        assertFalse selector.archetypeDefined([groupId:"archetypes", artifactId:null, version:null])
+        assertFalse selector.archetypeDefined([groupId:null, artifactId:"archetype", version:null])
+        assertFalse selector.archetypeDefined([groupId:null, artifactId:null, version:"1.0"])
+        assertFalse selector.archetypeDefined([groupId:"archetypes", artifactId:"archetype", version:null])
+        assertFalse selector.archetypeDefined([groupId:null, artifactId:"archetype", version:"1.0"])
+        assertFalse selector.archetypeDefined([groupId:"archetypes", artifactId:null, version:"1.0"])
+        assertTrue selector.archetypeDefined([groupId:"archetypes", artifactId:"archetype", version:"1.0"])
+    }
+    
+}
+

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/groovy/org/apache/maven/archetype/ui/DefaultArchetypeSelectorTest.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/central/archetype-catalog.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/central/archetype-catalog.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/central/archetype-catalog.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/central/archetype-catalog.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-catalog>
+  <archetypes>
+    <archetype>
+      <groupId>archetypes</groupId>
+      <artifactId>nested-properties-main</artifactId>
+      <version>1.0</version>
+    </archetype>
+    <archetype>
+      <groupId>archetypes</groupId>
+      <artifactId>nested-properties-inner</artifactId>
+      <version>1.0</version>
+    </archetype>
+    <archetype>
+      <groupId>archetypes</groupId>
+      <artifactId>nested-properties-innest</artifactId>
+      <version>1.0</version>
+    </archetype>
+  </archetypes>
+</archetype-catalog>
\ No newline at end of file

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/central/archetype-catalog.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/local/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/local/dummy?rev=757559&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-plugin/src/test/repositories/local/dummy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 23 21:48:57 2009
@@ -0,0 +1,3 @@
+target
+grarchetype-testing.iml
+nb-configuration.xml

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 23 21:48:57 2009
@@ -0,0 +1,3 @@
+target
+grarchetype-repository.iml
+nb-configuration.xml

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/pom.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/pom.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/pom.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,72 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>grarchetype-testing</artifactId>
+        <groupId>org.apache.maven.grarchetype</groupId>
+    <version>2.0-alpha-5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>grarchetype-repository</artifactId>
+
+  <name>Maven GrArchetype Webapp Repository</name>
+  <packaging>war</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>6.1.11</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <!-- Add this in settings to use No authentication is made
+          <proxies>
+            <proxy>
+              <active>true</active>
+              <id>jetty</id>
+              <host>localhost</host>
+              <port>8080</port>
+              <protocol>http</protocol>
+            </proxy>
+          </proxies>
+        -->
+        <groupId>org.mortbay.jetty</groupId>
+        <artifactId>maven-jetty-plugin</artifactId>
+        <configuration>
+          <connectors>
+            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+              <port>18882</port>
+              <maxIdleTime>60000</maxIdleTime>
+            </connector>
+          </connectors>
+          <webAppConfig>
+            <contextPath>/</contextPath>
+          </webAppConfig>
+          <systemProperties>
+            <systemProperty>
+              <name>org.apache.maven.archetype.reporitory.directory</name>
+              <value>${project.basedir}/target/repository</value>
+            </systemProperty>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/java/org/apache/maven/archetype/repository/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/java/org/apache/maven/archetype/repository/RepositoryServlet.java?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/java/org/apache/maven/archetype/repository/RepositoryServlet.java (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/java/org/apache/maven/archetype/repository/RepositoryServlet.java Mon Mar 23 21:48:57 2009
@@ -0,0 +1,257 @@
+/*
+ *  Copyright 2007 rafale.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+package org.apache.maven.archetype.repository;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.mortbay.util.IO;
+import org.mortbay.util.StringUtil;
+
+/**
+ *
+ * @author rafale
+ */
+public class RepositoryServlet
+    extends HttpServlet
+{
+    private ServletConfig config;
+
+    private ServletContext context;
+
+    /* (non-Javadoc)
+     * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
+     */
+    public void init( ServletConfig config ) throws ServletException
+    {
+        this.config = config;
+        this.context = config.getServletContext(  );
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.Servlet#getServletConfig()
+     */
+    public ServletConfig getServletConfig( )
+    {
+        return config;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
+     */
+    public void service( ServletRequest req, ServletResponse res ) throws ServletException
+    {
+        HttpServletRequest request = (HttpServletRequest) req;
+        HttpServletResponse response = (HttpServletResponse) res;
+
+        response.setHeader( "Date", null );
+        response.setHeader( "Server", null );
+
+
+        log( "Requested file = " + request.getRequestURI(  ) );
+        System.err.println( "Requested file = " + request.getRequestURI(  ) );
+        String filePath =
+            System.getProperty( "org.apache.maven.archetype.reporitory.directory" ).trim(  ) + "/" +
+            request.getRequestURI(  );
+        filePath = StringUtil.replace(filePath, "\\", File.separator);
+        filePath = StringUtil.replace(filePath, File.separator, "/");
+        filePath=filePath.replaceAll("/repo/", "/");
+        filePath=filePath.replaceAll("//", "/");
+        filePath=filePath.replaceAll("//", "/");
+        filePath=filePath.replaceAll("//", "/");
+        filePath = StringUtil.replace(filePath, "/", File.separator);
+        log( "Complete file path = " + filePath );
+        System.err.println( "Complete file path = " + filePath );
+
+        String method = request.getMethod(  );
+
+        if ( "GET".equalsIgnoreCase( method ) )
+        {
+            log( "Getting file" );
+            System.err.println( "Getting file" );
+            try
+            {
+                File requestedFile = new File( filePath );
+
+                InputStream is = new FileInputStream( requestedFile );
+
+                if ( is != null )
+                {
+                    IO.copy( is, response.getOutputStream(  ) );
+                    response.setStatus( HttpServletResponse.SC_OK );
+                    log( "File sent" );
+                    System.err.println( "File sent" );
+                }
+                else
+                {
+                    log( "Can not send file no content" );
+                    System.err.println( "Can not send file no content" );
+                }
+            }
+            catch ( FileNotFoundException fileNotFoundException )
+            {
+                response.setStatus( HttpServletResponse.SC_NOT_FOUND );
+                log( "Requested file not found ", fileNotFoundException );
+                System.err.println( "Requested file not found "+ fileNotFoundException );
+                fileNotFoundException.printStackTrace(System.err);
+            }
+            catch ( IOException iOException )
+            {
+                response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+                log( "Can not send file", iOException );
+                System.err.println( "Can not send file"+ iOException );
+                iOException.printStackTrace(System.err);
+            }
+        }
+        else if ( "PUT".equalsIgnoreCase( method ) )
+        {
+            log( "Putting file" );
+            System.err.println( "Putting file" );
+            File uploadedFile = new File( filePath );
+            if ( uploadedFile.exists(  ) )
+            {
+                uploadedFile.delete(  );
+                log( "Removed old file" );
+                System.err.println( "Removed old file" );
+            }
+            else if ( !uploadedFile.getParentFile(  ).exists(  ) )
+            {
+                uploadedFile.getParentFile(  ).mkdirs(  );
+                log( "Created directory " + uploadedFile.getParent(  ) );
+                System.err.println( "Created directory " + uploadedFile.getParent(  ) );
+            }
+
+            try
+            {
+                FileWriter fw = new FileWriter( uploadedFile );
+                IO.copy( request.getReader(  ), fw );
+                response.setStatus( HttpServletResponse.SC_OK );
+                log( "File copied" );
+                System.err.println( "File copied" );
+            }
+            catch ( IOException iOException )
+            {
+
+                response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+                log( "Can not send file", iOException );
+                System.err.println( "Can not send file"+ iOException );
+                iOException.printStackTrace(System.err);
+            }
+        }
+        else
+        {
+            response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+            try
+            {
+                log( "Method " + request.getMethod(  ) );
+                log( "ContextPath " + request.getContextPath(  ) );
+                log( "QueryString" + request.getQueryString(  ) );
+                log( "PathInfo " + request.getPathInfo(  ) );
+                log( "ServletPath " + request.getServletPath(  ) );
+                log( "AttributeNames " + request.getAttributeNames(  ).toString(  ) );
+                log( "HeaderNames " + request.getHeaderNames(  ).toString(  ) );
+                log( "RequestURL " + request.getRequestURL(  ).toString(  ) );
+                log( "ParameterNames " + request.getParameterNames(  ).toString(  ) );
+                StringWriter w = new StringWriter(  );
+                IO.copy( request.getReader(  ), w );
+                log( "Content " + w.toString(  ) );
+
+
+//                System.err.println( "Method " + request.getMethod(  ) );
+//                System.err.println( "ContextPath " + request.getContextPath(  ) );
+//                System.err.println( "QueryString" + request.getQueryString(  ) );
+//                System.err.println( "PathInfo " + request.getPathInfo(  ) );
+//                System.err.println( "ServletPath " + request.getServletPath(  ) );
+//                System.err.println( "AttributeNames " + request.getAttributeNames(  ).toString(  ) );
+//                System.err.println( "HeaderNames " + request.getHeaderNames(  ).toString(  ) );
+//                System.err.println( "RequestURL " + request.getRequestURL(  ).toString(  ) );
+//                System.err.println( "ParameterNames " + request.getParameterNames(  ).toString(  ) );
+//                System.err.println( "Content " + w.toString(  ) );
+            }
+            catch ( IOException iOException )
+            {
+                log( "Error in unnknown method", iOException );
+                System.err.println( "Error in unnknown method"+ iOException );
+                iOException.printStackTrace(System.err);
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.Servlet#getServletInfo()
+     */
+    public String getServletInfo( )
+    {
+        return "Repository Servlet";
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.Servlet#destroy()
+     */
+    public void destroy( )
+    {
+    }
+
+    /**
+     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
+     * @param request servlet request
+     * @param response servlet response
+     */
+    protected void processRequest( HttpServletRequest request,
+        HttpServletResponse response ) throws ServletException, IOException
+    {
+        response.setContentType( "text/html;charset=UTF-8" );
+        PrintWriter out = response.getWriter(  );
+        try
+        {
+            /* TODO output your page here
+            out.println("<html>");
+            out.println("<head>");
+            out.println("<title>Servlet RepositoryServlet</title>");
+            out.println("</head>");
+            out.println("<body>");
+            out.println("<h1>Servlet RepositoryServlet at " + request.getContextPath () + "</h1>");
+            out.println("</body>");
+            out.println("</html>");
+             */
+        }
+        finally
+        {
+            out.close(  );
+        }
+    }
+
+    public String getServletName()
+    {
+        return "Repository Servlet";
+    }
+
+
+}
\ No newline at end of file

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/java/org/apache/maven/archetype/repository/RepositoryServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/webapp/WEB-INF/web.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/webapp/WEB-INF/web.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/webapp/WEB-INF/web.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+  <display-name>Archetype Repository Web Application</display-name>
+  <servlet>
+    <servlet-name>RepositoryServlet</servlet-name>
+    <servlet-class>org.apache.maven.archetype.repository.RepositoryServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>RepositoryServlet</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+</web-app>

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/grarchetype-repository/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/pom.xml?rev=757559&view=auto
==============================================================================
--- maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/pom.xml (added)
+++ maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/pom.xml Mon Mar 23 21:48:57 2009
@@ -0,0 +1,21 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+        <groupId>org.apache.maven.grarchetype</groupId>
+        <artifactId>maven-grarchetype</artifactId>
+    <version>2.0-alpha-5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>grarchetype-testing</artifactId>
+
+  <packaging>pom</packaging>
+  <name>Maven GrArchetype Testing </name>
+
+  <modules>
+    <!--module>grarchetype-proxy</module-->
+    <module>grarchetype-repository</module>
+  </modules>
+
+</project>
\ No newline at end of file

Propchange: maven/archetype/branches/archetype-refactor-groovy/grarchetype-testing/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native