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 2008/03/25 23:31:37 UTC

svn commit: r641055 - in /maven/archetype/trunk: archetype-common/src/main/java/org/apache/maven/archetype/creator/ archetype-common/src/main/java/org/apache/maven/archetype/generator/ archetype-common/src/test/java/org/apache/maven/archetype/test/ arc...

Author: rafale
Date: Tue Mar 25 15:31:09 2008
New Revision: 641055

URL: http://svn.apache.org/viewvc?rev=641055&view=rev
Log:
Fix ARCHETYPE-153
in a multi module project, the creation of an archetype and the following generation of the project now ensures if the artifactId of the initial project is present in the module's directories, it is properly propagated at generation time.

Added:
    maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/api/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/api/Api.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/cli/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/cli/Cli.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/core/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/core/Core.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/model/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/model/Model.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/memory/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/memory/Memory.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/xstream/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/xstream/XStream.java   (with props)
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/site/
    maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/site/site.xml   (with props)
Modified:
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
    maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
    maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java?rev=641055&r1=641054&r2=641055&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java Tue Mar 25 15:31:09 2008
@@ -307,17 +307,23 @@
             while ( modules.hasNext() )
             {
                 String moduleId = (String) modules.next();
+                String rootArtifactId = configurationProperties.getProperty( Constants.ARTIFACT_ID );
+                String moduleIdDirectory = moduleId;
+                if ( moduleId.indexOf( rootArtifactId ) >= 0 )
+                {
+                    moduleIdDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
+                }
 
                 getLogger().debug( "Creating module " + moduleId );
 
                 ModuleDescriptor moduleDescriptor =
                     createModule(
                         reverseProperties,
-                        configurationProperties.getProperty( Constants.ARTIFACT_ID ),
+                        rootArtifactId,
                         moduleId,
                         packageName,
                         FileUtils.resolveFile( basedir, moduleId ),
-                        FileUtils.resolveFile( archetypeFilesDirectory, moduleId ),
+                        FileUtils.resolveFile( archetypeFilesDirectory, moduleIdDirectory ),
                         languages,
                         filtereds,
                         defaultEncoding,
@@ -423,13 +429,18 @@
         while ( modules.hasNext() )
         {
             String subModuleId = (String) modules.next();
+            String subModuleIdDirectory = subModuleId;
+                if ( subModuleId.indexOf( rootArtifactId ) >= 0 )
+                {
+                    subModuleIdDirectory = StringUtils.replace( subModuleId, rootArtifactId, "__rootArtifactId__" );
+                }
 
             createModulePoms(
                 pomReversedProperties,
                 rootArtifactId,
                 packageName,
                 FileUtils.resolveFile( basedir, subModuleId ),
-                FileUtils.resolveFile( archetypeFilesDirectory, subModuleId ),
+                FileUtils.resolveFile( archetypeFilesDirectory, subModuleIdDirectory ),
                 preserveCData,
                 keepParent
             );
@@ -466,13 +477,18 @@
         while ( modules.hasNext() )
         {
             String moduleId = (String) modules.next();
+            String moduleIdDirectory = moduleId;
+                if ( moduleId.indexOf( rootArtifactId ) >= 0 )
+                {
+                    moduleIdDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
+                }
 
             createModulePoms(
                 pomReversedProperties,
                 rootArtifactId,
                 moduleId,
                 FileUtils.resolveFile( basedir, moduleId ),
-                FileUtils.resolveFile( archetypeFilesDirectory, moduleId ),
+                FileUtils.resolveFile( archetypeFilesDirectory, moduleIdDirectory ),
                 preserveCData,
                 keepParent
             );
@@ -1189,18 +1205,19 @@
         Model pom =
             pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
         String replacementId = pom.getArtifactId();
+        String moduleDirectory = pom.getArtifactId();
         if ( replacementId.indexOf( rootArtifactId ) >= 0 )
         {
             replacementId = StringUtils.replace( replacementId, rootArtifactId, "${rootArtifactId}" );
-            moduleId = StringUtils.replace( moduleId, rootArtifactId, "${rootArtifactId}" );
+            moduleDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
         }
         if ( moduleId.indexOf( rootArtifactId ) >= 0 )
         {
-            moduleId = StringUtils.replace( moduleId, rootArtifactId, "${rootArtifactId}" );
+            moduleDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
         }
         archetypeDescriptor.setName( replacementId );
         archetypeDescriptor.setId( replacementId );
-        archetypeDescriptor.setDir( moduleId );
+        archetypeDescriptor.setDir( moduleDirectory );
 
         registerProject( pom );
 
@@ -1231,6 +1248,11 @@
         while ( modules.hasNext() )
         {
             String subModuleId = (String) modules.next();
+            String subModuleIdDirectory = subModuleId;
+            if ( subModuleId.indexOf( rootArtifactId ) >= 0 )
+            {
+                subModuleIdDirectory = StringUtils.replace( subModuleId, rootArtifactId, "__rootArtifactId__" );
+            }
 
             getLogger().debug( "Creating module " + subModuleId );
 
@@ -1241,7 +1263,7 @@
                     subModuleId,
                     packageName,
                     FileUtils.resolveFile( basedir, subModuleId ),
-                    FileUtils.resolveFile( archetypeFilesDirectory, subModuleId ),
+                    FileUtils.resolveFile( archetypeFilesDirectory, subModuleIdDirectory ),
                     languages,
                     filtereds,
                     defaultEncoding,

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java?rev=641055&r1=641054&r2=641055&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java Tue Mar 25 15:31:09 2008
@@ -506,7 +506,11 @@
         OutputFileExists
     {
         outputDirectoryFile.mkdirs();
-        getLogger().debug( "Processing " + artifactId );
+        getLogger().debug( "Processing module " + artifactId );
+        getLogger().debug( "Processing module rootArtifactId " + rootArtifactId );
+        getLogger().debug( "Processing module pom " + pom );
+        getLogger().debug( "Processing module moduleOffset " + moduleOffset );
+        getLogger().debug( "Processing module outputDirectoryFile " + outputDirectoryFile );
 
         processFilesetProject(
             archetypeDescriptor,
@@ -537,11 +541,11 @@
             artifactId = project.getId();
 
             File moduleOutputDirectoryFile = new File( outputDirectoryFile,
-                StringUtils.replace( project.getDir(), "${rootArtifactId}", rootArtifactId ) );
+                StringUtils.replace( project.getDir(), "__rootArtifactId__", rootArtifactId ) );
             context.put( Constants.ARTIFACT_ID, StringUtils.replace( project.getId(), "${rootArtifactId}", rootArtifactId ) );
             processFilesetModule(
                 rootArtifactId,
-                StringUtils.replace( project.getDir(), "${rootArtifactId}", rootArtifactId ),
+                StringUtils.replace( project.getDir(), "__rootArtifactId__", rootArtifactId ),
                 archetypeResources,
                 new File( moduleOutputDirectoryFile, Constants.ARCHETYPE_POM ),
                 archetypeZipFile,
@@ -579,6 +583,12 @@
         FileNotFoundException,
         OutputFileExists
     {
+        getLogger().debug( "Processing fileset project moduleId " + moduleId );
+        getLogger().debug( "Processing fileset project pom " + pom );
+        getLogger().debug( "Processing fileset project moduleOffset " + moduleOffset );
+        getLogger().debug( "Processing fileset project outputDirectoryFile " + outputDirectoryFile );
+        getLogger().debug( "Processing fileset project basedirPom " + basedirPom );
+        
         if ( basedirPom.exists() )
         {
             processPomWithParent(
@@ -702,8 +712,8 @@
     {
         templateFileName = templateFileName.replace( File.separatorChar, '/' );
         
-        if ( !velocity.getEngine ().templateExists ( templateFileName )
-            && velocity.getEngine ().templateExists (
+        if ( !velocity.getEngine ().resourceExists( templateFileName )
+            && velocity.getEngine ().resourceExists(
                 templateFileName.replace ( '/', File.separatorChar )
             )
         )

Added: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java (added)
+++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java Tue Mar 25 15:31:09 2008
@@ -0,0 +1,288 @@
+/*
+ * 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.
+ */
+package org.apache.maven.archetype.test;
+
+
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.archetype.ArchetypeCreationRequest;
+import org.apache.maven.archetype.ArchetypeCreationResult;
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
+import org.apache.maven.archetype.ArchetypeGenerationResult;
+import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.catalog.ArchetypeCatalog;
+import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.codehaus.cargo.container.deployable.DeployableType;
+import org.codehaus.cargo.container.deployable.WAR;
+import org.codehaus.cargo.container.deployer.Deployer;
+import org.codehaus.cargo.container.deployer.URLDeployableMonitor;
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer;
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalDeployer;
+import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration;
+import org.codehaus.cargo.container.property.ServletPropertySet;
+import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory;
+import org.codehaus.cargo.generic.deployable.DeployableFactory;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Properties;
+import org.apache.commons.io.FileSystemUtils;
+
+/** @author Jason van Zyl */
+public class RoundtripMultiModuleTest
+    extends PlexusTestCase
+{
+    private Jetty6xEmbeddedLocalContainer container;
+
+    public void testArchetyper()
+        throws Exception
+    {
+
+        Archetype archetype = (Archetype) lookup( Archetype.ROLE );
+
+        ArchetypeRegistryManager registryManager = (ArchetypeRegistryManager) lookup( ArchetypeRegistryManager.ROLE );
+
+        MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
+
+        ArtifactRepository localRepository = registryManager.createRepository( new File( getBasedir(),
+            "target"+File.separator+"test-classes"+File.separator+"repositories"+File.separator+"local" ).toURI().
+            toURL().
+            toExternalForm(),
+            "local-repo" );
+
+        ArtifactRepository centralRepository = registryManager.createRepository( new File( getBasedir(),
+            "target"+File.separator+"test-classes"+File.separator+"repositories"+File.separator+"central" ).toURI().
+            toURL().
+            toExternalForm(),
+            "central-repo" );
+
+        // (1) create a project from scratch
+        // (2) create an archetype from the project
+        // (3) create our own archetype catalog properties in memory
+        // (4) create our own archetype catalog describing the archetype we just created
+        // (5) deploy the archetype we just created
+        // (6) create a project form the archetype we just created
+        // ------------------------------------------------------------------------
+        //
+        // ------------------------------------------------------------------------
+        // (1) create a project from scratch
+//        File sourceProject = new File( getBasedir(  ), "target/test-classes/projects/roundtrip-1-project" );
+
+        File workingProject = new File( getBasedir(),
+            "target"+File.separator+"test-classes"+File.separator+"projects"+File.separator+"roundtrip-multi-module-project" );
+        FileUtils.forceDelete(new File(workingProject, "target"));
+
+        // (2) create an archetype from the project
+        File pom = new File( workingProject, "pom.xml" );
+
+        MavenProject project = projectBuilder.build( pom, localRepository, null );
+
+        ArchetypeCreationRequest acr = new ArchetypeCreationRequest().setProject( project ).
+            setLocalRepository( localRepository );
+
+        ArchetypeCreationResult creationResult = archetype.createArchetypeFromProject( acr );
+
+        if ( creationResult.getCause() != null )
+        {
+            fail( creationResult.getCause().getMessage() );
+        }
+        else
+        {
+            assertArchetypeCreated(workingProject);
+        }
+
+        // (3) create our own archetype catalog properties in memory
+        File catalogDirectory = new File( getBasedir(), "target"+File.separator+"catalog" );
+
+        File catalogFile = new File( catalogDirectory, "archetype-catalog.xml" );
+
+        File catalogProperties = new File( catalogDirectory,
+            "archetype-catalog.properties" );
+
+        catalogDirectory.mkdirs();
+
+        Properties p = new Properties();
+        p.setProperty( "sources", "catalog" );
+        p.setProperty( "catalog.file", catalogFile.getAbsolutePath() );
+        OutputStream os = new FileOutputStream( catalogProperties );
+        p.store( os, "Generated catalog properties" );
+
+        // (5) install the archetype we just created
+        File generatedArchetypeDirectory = new File( project.getBasedir(),
+            "target"+File.separator+"generated-sources"+File.separator+"archetype" );
+        File generatedArchetypePom = new File( generatedArchetypeDirectory, "pom.xml" );
+        MavenProject generatedArchetypeProject = projectBuilder.build( generatedArchetypePom,
+            localRepository, null );
+
+        File archetypeDirectory = new File( generatedArchetypeDirectory,
+            "src"+File.separator+"main"+File.separator+"resources" );
+
+        File archetypeArchive = archetype.archiveArchetype( archetypeDirectory,
+            new File( generatedArchetypeProject.getBuild().getDirectory() ),
+            generatedArchetypeProject.getBuild().getFinalName() );
+
+        File archetypeInRepository = new File( centralRepository.getBasedir(),
+            StringUtils.replace(
+            generatedArchetypeProject.getGroupId(), ".",
+            File.separator ) +File.separator+
+            generatedArchetypeProject.getArtifactId() +File.separator+
+            generatedArchetypeProject.getVersion() +File.separator+
+            generatedArchetypeProject.getBuild().
+            getFinalName() +
+            ".jar" );
+        archetypeInRepository.getParentFile().mkdirs();
+        FileUtils.copyFile( archetypeArchive, archetypeInRepository );
+
+        // (4) create our own archetype catalog describing the archetype we just created
+        ArchetypeCatalog catalog = new ArchetypeCatalog();
+        org.apache.maven.archetype.catalog.Archetype generatedArchetype = new org.apache.maven.archetype.catalog.Archetype();
+        generatedArchetype.setGroupId( generatedArchetypeProject.getGroupId() );
+        generatedArchetype.setArtifactId( generatedArchetypeProject.getArtifactId() );
+        generatedArchetype.setVersion( generatedArchetypeProject.getVersion() );
+        generatedArchetype.setRepository( "http://localhost:18881/repo" );
+        catalog.addArchetype( generatedArchetype );
+
+        ArchetypeCatalogXpp3Writer catalogWriter = new ArchetypeCatalogXpp3Writer();
+        Writer writer = new FileWriter( catalogFile );
+        catalogWriter.write( writer, catalog );
+        IOUtils.closeQuietly( writer );
+
+        // (6) create a project form the archetype we just created
+        String outputDirectory = new File( getBasedir(),
+            "target"+File.separator+"test-classes"+File.separator+"projects"+File.separator+"roundtrip-multi-module-recreatedproject" ).getAbsolutePath();
+        FileUtils.forceDelete(outputDirectory);
+
+        ArchetypeGenerationRequest agr =
+            new ArchetypeGenerationRequest().setArchetypeGroupId(
+            generatedArchetypeProject.getGroupId() ).
+            setArchetypeArtifactId( generatedArchetypeProject.getArtifactId() ).
+            setArchetypeVersion( generatedArchetypeProject.getVersion() ).
+            setGroupId( "com.mycompany" ).setArtifactId( "myapp" ).setVersion( "1.0-SNAPSHOT" ).
+            setPackage( "com.mycompany.myapp" ).setOutputDirectory( outputDirectory ).
+            setLocalRepository( localRepository ).setArchetypeRepository( "http://localhost:18881/repo/" );
+        ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( agr );
+
+        if ( generationResult.getCause() != null )
+        {
+            fail( generationResult.getCause().getMessage() );
+        }
+
+    }
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        //        Start Cargo
+
+        Jetty6xEmbeddedStandaloneLocalConfiguration configuration =
+            new Jetty6xEmbeddedStandaloneLocalConfiguration( "target/repository-webapp" );
+        configuration.setProperty( ServletPropertySet.PORT, "18881" );
+
+        System.setProperty( "org.apache.maven.archetype.reporitory.directory",
+            getTestPath( "target/test-classes/repositories/central" ) );
+        container = new Jetty6xEmbeddedLocalContainer( configuration );
+        container.setTimeout( 180000L );
+        container.start();
+
+        DeployableFactory factory = new DefaultDeployableFactory();
+        WAR war = (WAR) factory.createDeployable( container.getId(),
+            "target/wars/archetype-repository.war",
+            DeployableType.WAR );
+
+        war.setContext( "/repo" );
+
+        Deployer deployer = new Jetty6xEmbeddedLocalDeployer( container );
+        deployer.deploy( war,
+            new URLDeployableMonitor( new URL( "http://localhost:18881/repo/dummy" ) ) );
+        deployer.start( war );
+
+    }
+
+    public void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+        //        Stop Cargo
+
+        container.stop();
+    }
+
+    private void assertArchetypeCreated(File workingProject) {
+        File archetypeSourcesDirectory = FileUtils.resolveFile(workingProject, "target/generated-sources/archetype");
+        File archetypeResourcesDirectory = FileUtils.resolveFile(archetypeSourcesDirectory, "src/main/resources/archetype-resources");
+        File archetypeMetadataDirectory = FileUtils.resolveFile(archetypeSourcesDirectory, "src/main/resources/META-INF/maven");
+        
+        
+        Iterator i =org.apache.commons.io.FileUtils.iterateFiles(archetypeSourcesDirectory, null, true);
+        while(i.hasNext())
+        {
+            File f=(File) i.next();
+            System.err.println(f.getPath());
+        }        
+        
+        assertExistDirectory(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-api"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-api"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-cli"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-cli"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-core"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-core"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-model"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-model"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"), "__rootArtifactId__-store-memory"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"), "__rootArtifactId__-store-memory"), "pom.xml"));
+        assertExistDirectory(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"), "__rootArtifactId__-store-xstream"));
+        assertExistFile(FileUtils.resolveFile(FileUtils.resolveFile(FileUtils.resolveFile(archetypeResourcesDirectory, "__rootArtifactId__-stores"), "__rootArtifactId__-store-xstream"), "pom.xml"));
+        assertExistFile(FileUtils.resolveFile(archetypeResourcesDirectory, "pom.xml"));
+        
+        
+        assertExistDirectory(archetypeMetadataDirectory);
+        assertExistFile(FileUtils.resolveFile(archetypeMetadataDirectory, "archetype-metadata.xml"));
+        assertExistFile(FileUtils.resolveFile(archetypeMetadataDirectory, "archetype.xml"));
+        assertExistFile(FileUtils.resolveFile(archetypeSourcesDirectory, "pom.xml"));
+        
+    }
+
+    private void assertExistDirectory(File resolveFile) {
+        assertTrue("resolveFile " +resolveFile+
+            " !exists", resolveFile.exists());
+        assertTrue("resolveFile " +resolveFile+
+            " !isDirectory", resolveFile.isDirectory());
+    }
+
+    private void assertExistFile(File resolveFile) {
+        assertTrue("resolveFile " +resolveFile+
+            " !exists", resolveFile.exists());
+        assertTrue("resolveFile " +resolveFile+
+            " !isFile", resolveFile.isFile());
+    }
+}

Propchange: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml Tue Mar 25 15:31:09 2008
@@ -0,0 +1,18 @@
+<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>com.company.proficio</groupId>
+    <artifactId>proficio</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>proficio</name>
+    <packaging>pom</packaging>
+    
+    <modules>
+        <module>proficio-api</module>
+        <module>proficio-cli</module>
+        <module>proficio-core</module>
+        <module>proficio-model</module>
+        <module>proficio-stores</module>
+    </modules>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml Tue Mar 25 15:31:09 2008
@@ -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>com.company.proficio</groupId>
+        <artifactId>proficio</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-api</artifactId>
+
+    <name>proficio api</name>
+    
+  <dependencies>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-model</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/api/Api.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/api/Api.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-api/src/main/java/com/company/proficio/api/Api.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml Tue Mar 25 15:31:09 2008
@@ -0,0 +1,31 @@
+<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>com.company.proficio</groupId>
+        <artifactId>proficio</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-cli</artifactId>
+
+    <name>proficio cli</name>
+    
+  <dependencies>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-core</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-store-memory</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-store-xstream</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/cli/Cli.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/cli/Cli.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-cli/src/main/java/com/company/proficio/cli/Cli.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml Tue Mar 25 15:31:09 2008
@@ -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>com.company.proficio</groupId>
+        <artifactId>proficio</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-core</artifactId>
+
+    <name>proficio core</name>
+    
+  <dependencies>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-api</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/core/Core.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/core/Core.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-core/src/main/java/com/company/proficio/core/Core.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml Tue Mar 25 15:31:09 2008
@@ -0,0 +1,13 @@
+<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>com.company.proficio</groupId>
+        <artifactId>proficio</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-model</artifactId>
+
+    <name>proficio model</name>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/model/Model.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/model/Model.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-model/src/main/java/org/company/proficio/model/Model.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml Tue Mar 25 15:31:09 2008
@@ -0,0 +1,19 @@
+<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>com.company.proficio</groupId>
+        <artifactId>proficio</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-stores</artifactId>
+
+    <name>proficio stores</name>
+    <packaging>pom</packaging>
+    
+    <modules>
+        <module>proficio-store-memory</module>
+        <module>proficio-store-xstream</module>
+    </modules>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml Tue Mar 25 15:31:09 2008
@@ -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>com.company.proficio</groupId>
+        <artifactId>proficio-stores</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-store-memory</artifactId>
+
+    <name>proficio store memory</name>
+    
+  <dependencies>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-api</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/memory/Memory.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/memory/Memory.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-memory/src/main/java/com/company/proficio/store/memory/Memory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml?rev=641055&view=auto
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml (added)
+++ maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml Tue Mar 25 15:31:09 2008
@@ -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>com.company.proficio</groupId>
+        <artifactId>proficio-stores</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>proficio-store-xstream</artifactId>
+
+    <name>proficio store xstream</name>
+    
+  <dependencies>
+    <dependency>
+      <groupId>com.company.proficio</groupId>
+      <artifactId>proficio-api</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/xstream/XStream.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/xstream/XStream.java?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/proficio-stores/proficio-store-xstream/src/main/java/com/company/proficio/store/xstream/XStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/site/site.xml?rev=641055&view=auto
==============================================================================
    (empty)

Propchange: maven/archetype/trunk/archetype-common/src/test/resources/projects/roundtrip-multi-module-project/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java?rev=641055&r1=641054&r2=641055&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java Tue Mar 25 15:31:09 2008
@@ -202,9 +202,13 @@
 
             ArchetypeCreationResult result = archetype.createArchetypeFromProject( request );
 
-            if ( result.getCause() != null )
+            if( result.getCause() != null )
             {
-                throw new MojoExecutionException( result.getCause().getMessage(), result.getCause() );
+                throw new MojoFailureException(
+                    result.getCause(),
+                    result.getCause().getMessage(),
+                    result.getCause().getMessage()
+                );
             }
 
             getLog().info( "Archetype created in target/generated-sources/archetype" );
@@ -223,9 +227,13 @@
             }
 
         }
+        catch ( MojoFailureException ex )
+        {
+            throw ex;
+        }
         catch ( Exception ex )
         {
-            throw new MojoExecutionException( ex.getMessage(), ex );
+            throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );
         }
     }
 

Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java?rev=641055&r1=641054&r2=641055&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java Tue Mar 25 15:31:09 2008
@@ -162,11 +162,24 @@
             // TODO: it's confusing that request has fields that get populated but not accepted as input (eg, groupId)
             configurator.configureArchetype( request, interactiveMode, executionProperties );
 
-            ArchetypeGenerationResult result = archetype.generateProjectFromArchetype( request );
+            ArchetypeGenerationResult generationResult =
+                archetype.generateProjectFromArchetype( request );
+            if( generationResult.getCause() != null )
+            {
+                throw new MojoFailureException(
+                    generationResult.getCause(),
+                    generationResult.getCause().getMessage(),
+                    generationResult.getCause().getMessage()
+                );
+            }
+        }
+        catch ( MojoFailureException ex )
+        {
+            throw ex;
         }
         catch ( Exception ex )
         {
-            throw new MojoFailureException( ex.getMessage() );
+            throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );
         }
 
         String artifactId = request.getArtifactId();