[maven-scm] copy for tag maven-archetype-2.0-alpha-5

git-svn-id: https://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5@935234 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/NOTICE.txt b/NOTICE.txt
index cfd33e3..4a34232 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
-This product includes software developed by 

-The Apache Software Foundation (http://www.apache.org/).

-

-This product includes software developed by jchardet.sourceforge.net 

-jchardet is using Mozilla 1.1 license.

+This product includes software developed by 
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed by jchardet.sourceforge.net 
+jchardet is using Mozilla 1.1 license.
diff --git a/archetype-common/pom.xml b/archetype-common/pom.xml
index 30fd503..dbecf4d 100644
--- a/archetype-common/pom.xml
+++ b/archetype-common/pom.xml
@@ -1,4 +1,24 @@
 <?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/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
@@ -8,9 +28,13 @@
     <artifactId>maven-archetype</artifactId>
     <version>2.0-alpha-5</version>
   </parent>
+
   <artifactId>archetype-common</artifactId>
-  <name>Maven Archetype Common</name>
   <packaging>jar</packaging>
+
+  <name>Maven Archetype Common</name>
+  <description>Core Archetype classes.</description>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -66,10 +90,6 @@
       <artifactId>velocity</artifactId>
     </dependency>
     <dependency>
-      <groupId>dom4j</groupId>
-      <artifactId>dom4j</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>
@@ -150,72 +170,52 @@
       <plugin>
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
-        <version>1.0-alpha-21</version>
+        <version>1.3</version>
+        <configuration>
+          <version>1.0.0</version>
+          <models>
+            <model>src/main/mdo/archetype-registry.mdo</model>
+            <model>src/main/mdo/archetype-descriptor.mdo</model>
+            <model>src/main/mdo/archetype-catalog.mdo</model>
+            <model>src/main/mdo/archetype.mdo</model>
+          </models>
+        </configuration>
         <executions>
           <execution>
-            <id>archetype-common</id>
+            <id>default</id>
             <goals>
               <goal>java</goal>
-              <goal>xsd</goal>
               <goal>xpp3-reader</goal>
               <goal>xpp3-writer</goal>
             </goals>
+          </execution>
+          <execution>
+            <id>site-docs</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>xdoc</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>site-xsd</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>xsd</goal>
+            </goals>
             <configuration>
-              <version>1.0.0</version>
-              <model>src/main/mdo/archetype-common.mdo</model>
+              <outputDirectory>${basedir}/target/generated-site/resources/xsd</outputDirectory>
             </configuration>
           </execution>
           <execution>
-            <id>archetype-registry</id>
+            <id>java-only</id>
+            <configuration>
+              <models>
+                <model>src/main/mdo/archetype-common.mdo</model>
+              </models>
+            </configuration>
             <goals>
               <goal>java</goal>
-              <goal>xsd</goal>
-              <goal>xpp3-reader</goal>
-              <goal>xpp3-writer</goal>
             </goals>
-            <configuration>
-              <version>1.0.0</version>
-              <model>src/main/mdo/archetype-registry.mdo</model>
-            </configuration>
-          </execution>
-          <execution>
-            <id>archetype-descriptor</id>
-            <goals>
-              <goal>java</goal>
-              <goal>xsd</goal>
-              <goal>xpp3-reader</goal>
-              <goal>xpp3-writer</goal>
-            </goals>
-            <configuration>
-              <version>1.0.0</version>
-              <model>src/main/mdo/archetype-descriptor.mdo</model>
-            </configuration>
-          </execution>
-          <execution>
-            <id>archetype-catalog</id>
-            <goals>
-              <goal>java</goal>
-              <goal>xsd</goal>
-              <goal>xpp3-reader</goal>
-              <goal>xpp3-writer</goal>
-            </goals>
-            <configuration>
-              <version>1.0.0</version>
-              <model>src/main/mdo/archetype-catalog.mdo</model>
-            </configuration>
-          </execution>
-          <execution>
-            <id>archetype-old</id>
-            <goals>
-              <goal>java</goal>
-              <goal>xsd</goal>
-              <goal>xpp3-reader</goal>
-              <goal>xpp3-writer</goal>
-            </goals>
-            <configuration>
-              <version>1.0.0</version>
-              <model>src/main/mdo/archetype.mdo</model>
-            </configuration>
           </execution>
         </executions>
       </plugin>
@@ -392,6 +392,7 @@
       </plugin>
     </plugins>
   </build>
+
   <reporting>
     <plugins>
       <plugin>
@@ -403,22 +404,22 @@
   </reporting>
 
   <profiles>
-      <profile>
-          <id>internal-catalog</id>
-          <build>
-              <plugins>
-                  <plugin>
-                      <groupId>org.apache.maven.plugins</groupId>
-                      <artifactId>maven-surefire-plugin</artifactId>
-                      <configuration>
-                          <includes>
-                              <include>**/InternalCatalogFromWiki.java</include>
-                              <!--include>**/InternalCatalogArchetypesVerification.java</include-->
-                          </includes>
-                      </configuration>
-                  </plugin>
-              </plugins>
-          </build>
-      </profile>
+    <profile>
+      <id>internal-catalog</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <includes>
+                <include>**/InternalCatalogFromWiki.java</include>
+                <!--include>**/InternalCatalogArchetypesVerification.java</include-->
+              </includes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
index 29cda49..7a58ba0 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype;
-
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.project.MavenProject;
 
@@ -56,11 +56,13 @@
 
     private String postPhase;
 
-    public String getPostPhase() {
+    public String getPostPhase()
+    {
         return postPhase;
     }
 
-    public ArchetypeCreationRequest setPostPhase(String postPhase) {
+    public ArchetypeCreationRequest setPostPhase( String postPhase )
+    {
         this.postPhase = postPhase;
 
         return this;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationResult.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationResult.java
index d0b68df..14f9f82 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationResult.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationResult.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype;
-
 /** @author Jason van Zyl */
 public class ArchetypeCreationResult
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
index 9d912a5..e05996b 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.settings.Mirror;
@@ -43,13 +43,13 @@
 
     private ArtifactRepository localRepository;
 
-    private List remoteArtifactRepositories; 
-    
+    private List remoteArtifactRepositories;
+
     private Proxy activeProxy;
 
-    private List servers = new ArrayList(  );
+    private List servers = new ArrayList();
 
-    private List mirrors = new ArrayList(  );
+    private List mirrors = new ArrayList();
 
     // Archetype definition
     private String archetypeName;
@@ -73,24 +73,24 @@
 
     private String packageName;
 
-    private Properties properties = new Properties(  );
+    private Properties properties = new Properties();
 
-    public ArchetypeGenerationRequest( )
+    public ArchetypeGenerationRequest()
     {
     }
 
     public ArchetypeGenerationRequest( Archetype archetype )
     {
-        this.archetypeGroupId = archetype.getGroupId(  );
+        this.archetypeGroupId = archetype.getGroupId();
 
-        this.archetypeArtifactId = archetype.getArtifactId(  );
+        this.archetypeArtifactId = archetype.getArtifactId();
 
-        this.archetypeVersion = archetype.getVersion(  );
+        this.archetypeVersion = archetype.getVersion();
 
-        this.archetypeRepository = archetype.getRepository(  );
+        this.archetypeRepository = archetype.getRepository();
     }
 
-    public String getArchetypeGroupId( )
+    public String getArchetypeGroupId()
     {
         return archetypeGroupId;
     }
@@ -102,7 +102,7 @@
         return this;
     }
 
-    public String getArchetypeArtifactId( )
+    public String getArchetypeArtifactId()
     {
         return archetypeArtifactId;
     }
@@ -114,7 +114,7 @@
         return this;
     }
 
-    public String getArchetypeVersion( )
+    public String getArchetypeVersion()
     {
         return archetypeVersion;
     }
@@ -126,7 +126,7 @@
         return this;
     }
 
-    public String getArchetypeGoals( )
+    public String getArchetypeGoals()
     {
         return archetypeGoals;
     }
@@ -138,7 +138,7 @@
         return this;
     }
 
-    public String getArchetypeName( )
+    public String getArchetypeName()
     {
         return archetypeName;
     }
@@ -150,7 +150,7 @@
         return this;
     }
 
-    public String getArchetypeRepository( )
+    public String getArchetypeRepository()
     {
         return archetypeRepository;
     }
@@ -162,7 +162,7 @@
         return this;
     }
 
-    public String getArtifactId( )
+    public String getArtifactId()
     {
         return artifactId;
     }
@@ -174,7 +174,7 @@
         return this;
     }
 
-    public String getGroupId( )
+    public String getGroupId()
     {
         return groupId;
     }
@@ -186,7 +186,7 @@
         return this;
     }
 
-    public String getVersion( )
+    public String getVersion()
     {
         return version;
     }
@@ -198,7 +198,7 @@
         return this;
     }
 
-    public String getPackage( )
+    public String getPackage()
     {
         return packageName;
     }
@@ -210,7 +210,7 @@
         return this;
     }
 
-    public Properties getProperties( )
+    public Properties getProperties()
     {
         return properties;
     }
@@ -222,7 +222,7 @@
         return this;
     }
 
-    public ArtifactRepository getLocalRepository( )
+    public ArtifactRepository getLocalRepository()
     {
         return localRepository;
     }
@@ -234,7 +234,7 @@
         return this;
     }
 
-    public String getOutputDirectory( )
+    public String getOutputDirectory()
     {
         return outputDirectory;
     }
@@ -246,7 +246,7 @@
         return this;
     }
 
-    public boolean isInteractiveMode( )
+    public boolean isInteractiveMode()
     {
         return interactiveMode;
     }
@@ -258,7 +258,7 @@
         return this;
     }
 
-    public boolean isOffline( )
+    public boolean isOffline()
     {
         return offline;
     }
@@ -270,7 +270,7 @@
         return this;
     }
 
-    public TransferListener getTransferListener( )
+    public TransferListener getTransferListener()
     {
         return transferListener;
     }
@@ -282,7 +282,7 @@
         return this;
     }
 
-    public Proxy getActiveProxy( )
+    public Proxy getActiveProxy()
     {
         return activeProxy;
     }
@@ -301,7 +301,7 @@
         return this;
     }
 
-    public List getMirrors( )
+    public List getMirrors()
     {
         return mirrors;
     }
@@ -313,11 +313,11 @@
         return this;
     }
 
-    public List getServers( )
+    public List getServers()
     {
         return servers;
     }
-    
+
     public List getRemoteArtifactRepositories()
     {
         return remoteArtifactRepositories;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationResult.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationResult.java
index 6e65183..ab0d274 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationResult.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationResult.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,14 +19,12 @@
  * under the License.
  */
 
-package org.apache.maven.archetype;
-
 /** @author Jason van Zyl */
 public class ArchetypeGenerationResult
 {
     private Exception cause;
 
-    public Exception getCause( )
+    public Exception getCause()
     {
         return cause;
     }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeManager.java
similarity index 89%
rename from archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java
rename to archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeManager.java
index bf80c21..d2ae07a 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeManager.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,19 +18,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.archetype;
 
-
+import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 
 import java.io.File;
 import java.io.IOException;
-import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 
 /** @author Jason van Zyl */
-public interface Archetype
+public interface ArchetypeManager
 {
-    String ROLE = Archetype.class.getName();
+    String ROLE = ArchetypeManager.class.getName();
 
     /**
      * A command to create an OldArchetype from an existing Maven project given the suppled
@@ -94,11 +95,10 @@
      *
      * @throws java.io.IOException
      */
-    File archiveArchetype(
-        File archetypeDirectory,
-        File outputDirectory,
-        String finalName )
+    File archiveArchetype( File archetypeDirectory, File outputDirectory, String finalName )
         throws DependencyResolutionRequiredException, IOException;
-    void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype, String path);
-    void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype);
+
+    void updateLocalCatalog( Archetype archetype, String path );
+
+    void updateLocalCatalog( Archetype archetype );
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
similarity index 83%
rename from archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
rename to archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
index 8e9069b..8c4c6a2 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/DefaultArchetypeManager.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,7 @@
  * under the License.
  */
 
-package org.apache.maven.archetype;
-
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.creator.ArchetypeCreator;
 import org.apache.maven.archetype.generator.ArchetypeGenerator;
@@ -26,6 +27,7 @@
 import org.apache.maven.archetype.source.ArchetypeDataSourceException;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -40,9 +42,9 @@
  * @author Jason van Zyl
  * @plexus.component
  */
-public class DefaultArchetype
+public class DefaultArchetypeManager
     extends AbstractLogEnabled
-    implements Archetype
+    implements ArchetypeManager
 {
     /** @plexus.requirement role-hint="fileset" */
     private ArchetypeCreator creator;
@@ -119,8 +121,11 @@
             else
             {
                 String fileName = files[i].getAbsolutePath().substring( offset + 1 );
-                
-                if(File.separatorChar != '/'){ fileName = fileName.replace('\\', '/'); }
+
+                if ( File.separatorChar != '/' )
+                {
+                    fileName = fileName.replace( '\\', '/' );
+                }
 
                 ZipEntry e = new ZipEntry( fileName );
 
@@ -128,14 +133,7 @@
 
                 FileInputStream is = new FileInputStream( files[i] );
 
-                byte[] buf = new byte[4096];
-
-                int n;
-
-                while ( ( n = is.read( buf ) ) > 0 )
-                {
-                    zos.write( buf, 0, n );
-                }
+                IOUtil.copy( is, zos );
 
                 is.close();
 
@@ -162,15 +160,15 @@
 
     public ArchetypeCatalog getDefaultLocalCatalog()
     {
-        return getLocalCatalog("${user.home}/.m2/archetype-catalog.xml");
+        return getLocalCatalog( "${user.home}/.m2/archetype-catalog.xml" );
     }
 
     public ArchetypeCatalog getLocalCatalog( String path )
     {
         try
         {
-            Properties properties=new Properties();
-            properties.setProperty("file", path);
+            Properties properties = new Properties();
+            properties.setProperty( "file", path );
             ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get( "catalog" );
 
             return source.getArchetypeCatalog( properties );
@@ -183,15 +181,15 @@
 
     public ArchetypeCatalog getRemoteCatalog()
     {
-        return getRemoteCatalog("http://repo1.maven.org/maven2");
+        return getRemoteCatalog( "http://repo1.maven.org/maven2" );
     }
 
     public ArchetypeCatalog getRemoteCatalog( String url )
     {
         try
         {
-            Properties properties=new Properties();
-            properties.setProperty("repository", url);
+            Properties properties = new Properties();
+            properties.setProperty( "repository", url );
             ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get( "remote-catalog" );
 
             return source.getArchetypeCatalog( properties );
@@ -202,18 +200,20 @@
         }
     }
 
-    public void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype) {
-        updateLocalCatalog(archetype, "${user.home}/.m2/archetype-catalog.xml");
+    public void updateLocalCatalog( Archetype archetype )
+    {
+        updateLocalCatalog( archetype, "${user.home}/.m2/archetype-catalog.xml" );
     }
 
-    public void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype, String path) {
+    public void updateLocalCatalog( Archetype archetype, String path )
+    {
         try
         {
-            Properties properties=new Properties();
-            properties.setProperty("file", path);
+            Properties properties = new Properties();
+            properties.setProperty( "file", path );
             ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get( "catalog" );
 
-            source.updateCatalog(properties, archetype);
+            source.updateCatalog( properties, archetype );
         }
         catch ( ArchetypeDataSourceException e )
         {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeArtifactManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeArtifactManager.java
index 98837b2..9dad59c 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeArtifactManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeArtifactManager.java
@@ -1,145 +1,145 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.exception.UnknownArchetype;

-import org.apache.maven.archetype.metadata.ArchetypeDescriptor;

-import org.apache.maven.artifact.repository.ArtifactRepository;

-import org.apache.maven.model.Model;

-

-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

-

-import java.io.File;

-import java.io.IOException;

-

-import java.util.List;

-import java.util.zip.ZipFile;

-

-public interface ArchetypeArtifactManager

-{

-    String ROLE = ArchetypeArtifactManager.class.getName ();

-

-    Model getArchetypePom ( File jar )

-    throws XmlPullParserException, UnknownArchetype, IOException;

-

-    /**

-     */

-    File getArchetypeFile (

-        final String groupId,

-        final String artifactId,

-        final String version,

-        ArtifactRepository archetypeRepository,

-        final ArtifactRepository localRepository,

-        final List repositories

-    )

-    throws UnknownArchetype;

-

-    /**

-     */

-    ClassLoader getArchetypeJarLoader ( File archetypeFile )

-    throws UnknownArchetype;

-

-    /**

-     */

-    ZipFile getArchetypeZipFile ( File archetypeFile )

-    throws UnknownArchetype;

-

-    /**

-     */

-    boolean isFileSetArchetype ( File archetypeFile );

-

-    /**

-     */

-    boolean isFileSetArchetype (

-        String groupId,

-        String artifactId,

-        String version,

-        ArtifactRepository archetypeRepository,

-        ArtifactRepository localRepository,

-        List repositories

-    );

-

-    /**

-     */

-    boolean isOldArchetype ( File archetypeFile );

-

-    /**

-     */

-    boolean isOldArchetype (

-        String groupId,

-        String artifactId,

-        String version,

-        ArtifactRepository archetypeRepository,

-        ArtifactRepository localRepository,

-        List repositories

-    );

-

-    /**

-     */

-    boolean exists (

-        String archetypeGroupId,

-        String archetypeArtifactId,

-        String archetypeVersion,

-        ArtifactRepository archetypeRepository,

-        ArtifactRepository localRepository,

-        List repos

-    );

-

-    /**

-     */

-    ArchetypeDescriptor getFileSetArchetypeDescriptor ( File archetypeFile )

-    throws UnknownArchetype;

-

-    /**

-     */

-    org.apache.maven.archetype.metadata.ArchetypeDescriptor getFileSetArchetypeDescriptor (

-        String groupId,

-        String artifactId,

-        String version,

-        ArtifactRepository archetypeRepository,

-        ArtifactRepository localRepository,

-        List repositories

-    )

-    throws UnknownArchetype;

-

-    /**

-     */

-    List getFilesetArchetypeResources ( File archetypeFile )

-    throws UnknownArchetype;

-

-    /**

-     */

-    org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor (

-        File archetypeFile

-    )

-    throws UnknownArchetype;

-

-    /**

-     */

-    org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor (

-        String groupId,

-        String artifactId,

-        String version,

-        ArtifactRepository archetypeRepository,

-        ArtifactRepository localRepository,

-        List repositories

-    )

-    throws UnknownArchetype;

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.exception.UnknownArchetype;
+import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.List;
+import java.util.zip.ZipFile;
+
+public interface ArchetypeArtifactManager
+{
+    String ROLE = ArchetypeArtifactManager.class.getName ();
+
+    Model getArchetypePom ( File jar )
+        throws XmlPullParserException, UnknownArchetype, IOException;
+
+    /**
+     */
+    File getArchetypeFile (
+        final String groupId,
+        final String artifactId,
+        final String version,
+        ArtifactRepository archetypeRepository,
+        final ArtifactRepository localRepository,
+        final List repositories
+    )
+        throws UnknownArchetype;
+
+    /**
+     */
+    ClassLoader getArchetypeJarLoader ( File archetypeFile )
+        throws UnknownArchetype;
+
+    /**
+     */
+    ZipFile getArchetypeZipFile ( File archetypeFile )
+        throws UnknownArchetype;
+
+    /**
+     */
+    boolean isFileSetArchetype ( File archetypeFile );
+
+    /**
+     */
+    boolean isFileSetArchetype (
+        String groupId,
+        String artifactId,
+        String version,
+        ArtifactRepository archetypeRepository,
+        ArtifactRepository localRepository,
+        List repositories
+    );
+
+    /**
+     */
+    boolean isOldArchetype ( File archetypeFile );
+
+    /**
+     */
+    boolean isOldArchetype (
+        String groupId,
+        String artifactId,
+        String version,
+        ArtifactRepository archetypeRepository,
+        ArtifactRepository localRepository,
+        List repositories
+    );
+
+    /**
+     */
+    boolean exists (
+        String archetypeGroupId,
+        String archetypeArtifactId,
+        String archetypeVersion,
+        ArtifactRepository archetypeRepository,
+        ArtifactRepository localRepository,
+        List repos
+    );
+
+    /**
+     */
+    ArchetypeDescriptor getFileSetArchetypeDescriptor ( File archetypeFile )
+        throws UnknownArchetype;
+
+    /**
+     */
+    org.apache.maven.archetype.metadata.ArchetypeDescriptor getFileSetArchetypeDescriptor (
+        String groupId,
+        String artifactId,
+        String version,
+        ArtifactRepository archetypeRepository,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+        throws UnknownArchetype;
+
+    /**
+     */
+    List getFilesetArchetypeResources ( File archetypeFile )
+        throws UnknownArchetype;
+
+    /**
+     */
+    org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor (
+        File archetypeFile
+    )
+        throws UnknownArchetype;
+
+    /**
+     */
+    org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor (
+        String groupId,
+        String artifactId,
+        String version,
+        ArtifactRepository archetypeRepository,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+        throws UnknownArchetype;
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeFilesResolver.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeFilesResolver.java
index 803cb4c..51dc55b 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeFilesResolver.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeFilesResolver.java
@@ -1,87 +1,87 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.metadata.FileSet;

-

-import java.io.File;

-import java.io.IOException;

-import java.util.List;

-

-/** @author rafale */

-public interface ArchetypeFilesResolver

-{

-    String ROLE = ArchetypeFilesResolver.class.getName();

-

-    List getFilesWithExtension( List files,

-                                String extension );

-

-    List getFilteredFiles( List files,

-                           String filtered );

-

-//    List filterFiles( FileSet fileSet,

-//                      List archetypeResources );

-

-    List filterFiles( String moduleOffset,

-                      FileSet fileSet,

-                      List archetypeResources );

-

-    List findOtherResources( int level,

-                             List files,

-                             String languages );

-

-    List findOtherResources( int level,

-                             List files,

-                             List sourcesFiles,

-                             String languages );

-

-    List findOtherSources( int level,

-                           List files,

-                           String languages );

-

-    List findResourcesMainFiles( List files,

-                                 String languages );

-

-    List findResourcesTestFiles( List files,

-                                 String languages );

-

-    List findSiteFiles( List files,

-                        String languages );

-

-    List findSourcesMainFiles( List files,

-                               String languages );

-

-    List findSourcesTestFiles( List files,

-                               String languages );

-

-    List getPackagedFiles( List files,

-                           String packageName );

-

-    String resolvePackage( File file,

-                           List languages )

-        throws

-        IOException;

-

-//    List getUnfilteredFiles( List files,

-//                             String filtered );

-

-    List getUnpackagedFiles( List files,

-                             String packageName );

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.metadata.FileSet;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/** @author rafale */
+public interface ArchetypeFilesResolver
+{
+    String ROLE = ArchetypeFilesResolver.class.getName();
+
+    List getFilesWithExtension( List files,
+                                String extension );
+
+    List getFilteredFiles( List files,
+                           String filtered );
+
+//    List filterFiles( FileSet fileSet,
+//                      List archetypeResources );
+
+    List filterFiles( String moduleOffset,
+                      FileSet fileSet,
+                      List archetypeResources );
+
+    List findOtherResources( int level,
+                             List files,
+                             String languages );
+
+    List findOtherResources( int level,
+                             List files,
+                             List sourcesFiles,
+                             String languages );
+
+    List findOtherSources( int level,
+                           List files,
+                           String languages );
+
+    List findResourcesMainFiles( List files,
+                                 String languages );
+
+    List findResourcesTestFiles( List files,
+                                 String languages );
+
+    List findSiteFiles( List files,
+                        String languages );
+
+    List findSourcesMainFiles( List files,
+                               String languages );
+
+    List findSourcesTestFiles( List files,
+                               String languages );
+
+    List getPackagedFiles( List files,
+                           String packageName );
+
+    String resolvePackage( File file,
+                           List languages )
+        throws
+        IOException;
+
+//    List getUnfilteredFiles( List files,
+//                             String filtered );
+
+    List getUnpackagedFiles( List files,
+                             String packageName );
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeRegistryManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeRegistryManager.java
index 58d7ba1..aba6b8e 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeRegistryManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeRegistryManager.java
@@ -1,77 +1,77 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.registry.ArchetypeRegistry;

-import org.apache.maven.artifact.repository.ArtifactRepository;

-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

-

-import java.io.File;

-import java.io.IOException;

-import java.io.Reader;

-import java.util.List;

-

-public interface ArchetypeRegistryManager

-{

-    String ROLE = ArchetypeRegistryManager.class.getName();

-

-    List getFilteredExtensions( String archetypeFilteredExtentions,

-                                File archetypeRegistryFile )

-        throws

-        IOException;

-

-    List getLanguages( String archetypeLanguages,

-                       File archetypeRegistryFile )

-        throws

-        IOException;

-

-    ArchetypeRegistry readArchetypeRegistry( Reader reader )

-        throws

-        IOException,

-        XmlPullParserException;

-

-    ArchetypeRegistry readArchetypeRegistry( File archetypeRegistryFile )

-        throws

-        IOException,

-        XmlPullParserException;

-

-//    ArchetypeRegistry readArchetypeRegistry()

-//        throws

-//        IOException,

-//        XmlPullParserException;

-

-//    List getRepositories(

-//        List pomRemoteRepositories,

-//        String remoteRepositories,

-//        File archetypeRegistryFile

-//    )

-//        throws

-//        IOException,

-//        XmlPullParserException;

-

-    void writeArchetypeRegistry( File archetypeRegistryFile,

-                                 ArchetypeRegistry archetypeRegistry )

-        throws

-        IOException;

-

-    ArchetypeRegistry getDefaultArchetypeRegistry();

-

-    ArtifactRepository createRepository( String url, String repositoryId );

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.List;
+
+public interface ArchetypeRegistryManager
+{
+    String ROLE = ArchetypeRegistryManager.class.getName();
+
+    List getFilteredExtensions( String archetypeFilteredExtentions,
+                                File archetypeRegistryFile )
+        throws
+        IOException;
+
+    List getLanguages( String archetypeLanguages,
+                       File archetypeRegistryFile )
+        throws
+        IOException;
+
+    ArchetypeRegistry readArchetypeRegistry( Reader reader )
+        throws
+        IOException,
+        XmlPullParserException;
+
+    ArchetypeRegistry readArchetypeRegistry( File archetypeRegistryFile )
+        throws
+        IOException,
+        XmlPullParserException;
+
+//    ArchetypeRegistry readArchetypeRegistry()
+//        throws
+//        IOException,
+//        XmlPullParserException;
+
+//    List getRepositories(
+//        List pomRemoteRepositories,
+//        String remoteRepositories,
+//        File archetypeRegistryFile
+//    )
+//        throws
+//        IOException,
+//        XmlPullParserException;
+
+    void writeArchetypeRegistry( File archetypeRegistryFile,
+                                 ArchetypeRegistry archetypeRegistry )
+        throws
+        IOException;
+
+    ArchetypeRegistry getDefaultArchetypeRegistry();
+
+    ArtifactRepository createRepository( String url, String repositoryId );
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
index 804d840..b98e1d3 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
@@ -1,92 +1,92 @@
-/*

- * 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.common;

-

-import java.util.Arrays;

-import java.util.List;

-

-public interface Constants

-{

-    String ARCHETYPE_ARTIFACT_ID = "archetype.artifactId";

-

-    String ARCHETYPE_GROUP_ID = "archetype.groupId";

-

-    String ARCHETYPE_VERSION = "archetype.version";

-

-    String ARCHETYPE_REPOSITORY = "archetype.repository";

-

-    String ARCHETYPE_DESCRIPTOR = "META-INF/maven/archetype-metadata.xml";

-

-    String ARCHETYPE_POST_GENERATION_GOALS = "archetype.goals";

-

-    String ARCHETYPE_POM = "pom.xml";

-

-    String ARCHETYPE_RESOURCES = "archetype-resources";

-

-    String ARCHETYPE_SUFFIX = "-archetype";

-

-    String ARTIFACT_ID = "artifactId";

-

-    String ARCHETYPE_FILTERED_EXTENSIONS = "archetype.filteredExtensions";

-    

-    String ARCHETYPE_LANGUAGES = "archetype.languages";

-

-    List DEFAULT_FILTERED_EXTENSIONS =

-        Arrays.asList(

-            new String[]

-                {

-                    "java", "xml", "txt", "groovy", "cs", "mdo", "aj", "jsp", "gsp", "vm", "html",

-                    "xhtml", "properties", ".classpath", ".project"

-                }

-        );

-

-    List DEFAULT_LANGUAGES =

-        Arrays.asList( new String[]{"java", "groovy", "csharp", "aspectj"} );

-

-    String GROUP_ID = "groupId";

-

-    String MAIN = "main";

-

-    String OLD_ARCHETYPE_DESCRIPTOR = "META-INF/maven/archetype.xml";

-

-    String OLDER_ARCHETYPE_DESCRIPTOR = "META-INF/archetype.xml";

-

-    String PACKAGE = "package";

-

-    /*String PACKAGE_NAME = "packageName";*/

-

-    String PACKAGE_IN_PATH_FORMAT = "packageInPathFormat";

-

-    String PARENT_ARTIFACT_ID = "parentArtifactId";

-

-    String POM_PATH = Constants.ARCHETYPE_RESOURCES + "/" + Constants.ARCHETYPE_POM;

-

-    String RESOURCES = "resources";

-

-    String SITE = "site";

-

-    String SRC = "src";

-

-    String TEST = "test";

-

-    String TMP = ".tmp";

-

-    String VERSION = "version";

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import java.util.Arrays;
+import java.util.List;
+
+public interface Constants
+{
+    String ARCHETYPE_ARTIFACT_ID = "archetype.artifactId";
+
+    String ARCHETYPE_GROUP_ID = "archetype.groupId";
+
+    String ARCHETYPE_VERSION = "archetype.version";
+
+    String ARCHETYPE_REPOSITORY = "archetype.repository";
+
+    String ARCHETYPE_DESCRIPTOR = "META-INF/maven/archetype-metadata.xml";
+
+    String ARCHETYPE_POST_GENERATION_GOALS = "archetype.goals";
+
+    String ARCHETYPE_POM = "pom.xml";
+
+    String ARCHETYPE_RESOURCES = "archetype-resources";
+
+    String ARCHETYPE_SUFFIX = "-archetype";
+
+    String ARTIFACT_ID = "artifactId";
+
+    String ARCHETYPE_FILTERED_EXTENSIONS = "archetype.filteredExtensions";
+
+    String ARCHETYPE_LANGUAGES = "archetype.languages";
+
+    List DEFAULT_FILTERED_EXTENSIONS =
+        Arrays.asList(
+            new String[]
+                {
+                    "java", "xml", "txt", "groovy", "cs", "mdo", "aj", "jsp", "gsp", "vm", "html",
+                    "xhtml", "properties", ".classpath", ".project"
+                }
+        );
+
+    List DEFAULT_LANGUAGES =
+        Arrays.asList( new String[]{ "java", "groovy", "csharp", "aspectj" } );
+
+    String GROUP_ID = "groupId";
+
+    String MAIN = "main";
+
+    String OLD_ARCHETYPE_DESCRIPTOR = "META-INF/maven/archetype.xml";
+
+    String OLDER_ARCHETYPE_DESCRIPTOR = "META-INF/archetype.xml";
+
+    String PACKAGE = "package";
+
+    /*String PACKAGE_NAME = "packageName";*/
+
+    String PACKAGE_IN_PATH_FORMAT = "packageInPathFormat";
+
+    String PARENT_ARTIFACT_ID = "parentArtifactId";
+
+    String POM_PATH = Constants.ARCHETYPE_RESOURCES + "/" + Constants.ARCHETYPE_POM;
+
+    String RESOURCES = "resources";
+
+    String SITE = "site";
+
+    String SRC = "src";
+
+    String TEST = "test";
+
+    String TMP = ".tmp";
+
+    String VERSION = "version";
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
index 686ec40..dd7d2ef 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.common;
-
 import org.apache.maven.archetype.downloader.DownloadException;
 import org.apache.maven.archetype.downloader.DownloadNotFoundException;
 import org.apache.maven.archetype.downloader.Downloader;
@@ -27,17 +27,17 @@
 import org.apache.maven.archetype.metadata.io.xpp3.ArchetypeDescriptorXpp3Reader;
 import org.apache.maven.archetype.old.descriptor.ArchetypeDescriptorBuilder;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
 import org.apache.maven.model.Model;
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.Reader;
 
 import java.net.MalformedURLException;
@@ -58,7 +58,8 @@
  */
 public class DefaultArchetypeArtifactManager
     extends AbstractLogEnabled
-    implements ArchetypeArtifactManager {
+    implements ArchetypeArtifactManager
+{
     /**
      * @plexus.requirement
      */
@@ -69,641 +70,545 @@
      */
     private PomManager pomManager;
 
-    /**
-     * @plexus.requirement
-     */
-    private RepositoryMetadataManager repositoryMetadataManager;
-
     private Map archetypeCache = new TreeMap();
 
-    public File getArchetypeFile(
-        final String groupId,
-        final String artifactId,
-        final String version,
-        ArtifactRepository archetypeRepository,
-        final ArtifactRepository localRepository,
-        final List repositories
-    )
-        throws UnknownArchetype {
-        try {
-            File archetype = getArchetype(
-                groupId,
-                artifactId,
-                version );
-            if( archetype == null ) {
+    public File getArchetypeFile( final String groupId, final String artifactId, final String version,
+                                  ArtifactRepository archetypeRepository, final ArtifactRepository localRepository,
+                                  final List repositories )
+        throws UnknownArchetype
+    {
+        try
+        {
+            File archetype = getArchetype( groupId, artifactId, version );
+
+            if ( archetype == null )
+            {
                 archetype =
-                    downloader.download(
-                        groupId,
-                        artifactId,
-                        version,
-                        archetypeRepository,
-                        localRepository,
-                        repositories
-                    );
-                setArchetype(
-                    groupId,
-                    artifactId,
-                    version,
-                    archetype );
+                    downloader.download( groupId, artifactId, version, archetypeRepository, localRepository,
+                                         repositories );
+
+                setArchetype( groupId, artifactId, version, archetype );
             }
             return archetype;
         }
-        catch( DownloadNotFoundException ex ) {
+        catch ( DownloadNotFoundException ex )
+        {
             throw new UnknownArchetype( ex );
         }
-        catch( DownloadException ex ) {
+        catch ( DownloadException ex )
+        {
             throw new UnknownArchetype( ex );
         }
     }
 
     public ClassLoader getArchetypeJarLoader( File archetypeFile )
-        throws UnknownArchetype {
-        try {
+        throws UnknownArchetype
+    {
+        try
+        {
             URL[] urls = new URL[1];
 
             urls[0] = archetypeFile.toURI().toURL();
 
             return new URLClassLoader( urls );
         }
-        catch( MalformedURLException e ) {
+        catch ( MalformedURLException e )
+        {
             throw new UnknownArchetype( e );
         }
     }
 
     public Model getArchetypePom( File jar )
-        throws XmlPullParserException, UnknownArchetype, IOException {
-        String pomFileName = null;
+        throws XmlPullParserException, UnknownArchetype, IOException
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
+            String pomFileName = null;
             zipFile = getArchetypeZipFile( jar );
             Enumeration enumeration = zipFile.entries();
-            while( enumeration.hasMoreElements() ) {
+            while ( enumeration.hasMoreElements() )
+            {
                 ZipEntry el = (ZipEntry) enumeration.nextElement();
 
                 String entry = el.getName();
-                if( entry.startsWith( "META-INF" ) && entry.endsWith( "pom.xml" ) ) {
+                if ( entry.startsWith( "META-INF" ) && entry.endsWith( "pom.xml" ) )
+                {
                     pomFileName = entry;
                 }
             }
 
-            if( pomFileName == null ) {
+            if ( pomFileName == null )
+            {
                 return null;
             }
 
-            ZipEntry pom =
-                zipFile.getEntry( StringUtils.replace( pomFileName, File.separator, "/" ) );
-            if( pom == null ) {
+            ZipEntry pom = zipFile.getEntry( StringUtils.replace( pomFileName, File.separator, "/" ) );
+            if ( pom == null )
+            {
                 pom = zipFile.getEntry( StringUtils.replace( pomFileName, "/", File.separator ) );
             }
-            if( pom == null ) {
+            if ( pom == null )
+            {
                 return null;
             }
             return pomManager.readPom( zipFile.getInputStream( pom ) );
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
     public ZipFile getArchetypeZipFile( File archetypeFile )
-        throws UnknownArchetype {
-        try {
+        throws UnknownArchetype
+    {
+        try
+        {
             return new ZipFile( archetypeFile );
         }
-        catch( ZipException e ) {
+        catch ( ZipException e )
+        {
             throw new UnknownArchetype( e );
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             throw new UnknownArchetype( e );
         }
     }
 
-    public boolean isFileSetArchetype( File archetypeFile ) {
+    public boolean isFileSetArchetype( File archetypeFile )
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile = getArchetypeZipFile( archetypeFile );
 
             return isFileSetArchetype( zipFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( XmlPullParserException e )
+        {
             return false;
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             return false;
         }
-        catch( UnknownArchetype e ) {
+        catch ( UnknownArchetype e )
+        {
             return false;
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
-    public boolean isFileSetArchetype(
-        String groupId,
-        String artifactId,
-        String version,
-        ArtifactRepository archetypeRepository,
-        ArtifactRepository localRepository,
-        List repositories
-    ) {
-        ZipFile zipFile = null;
-        try {
-            zipFile =
-                getArchetypeZipFile(
-                    getArchetypeFile(
-                        groupId,
-                        artifactId,
-                        version,
-                        archetypeRepository,
-                        localRepository,
-                        repositories
-                    )
-                );
-
-            return isFileSetArchetype( zipFile );
+    public boolean isFileSetArchetype( String groupId, String artifactId, String version,
+                                       ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
+                                       List repositories )
+    {
+        try
+        {
+            File archetypeFile = getArchetypeFile( groupId, artifactId, version, archetypeRepository,
+                                                   localRepository, repositories );
+            return isFileSetArchetype( archetypeFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( UnknownArchetype e )
+        {
             return false;
         }
-        catch( IOException e ) {
-            return false;
-        }
-        catch( UnknownArchetype e ) {
-            return false;
-        }
-        finally {
-            closeZipFile( zipFile );
-        }
     }
 
-    public boolean isOldArchetype( File archetypeFile ) {
+    public boolean isOldArchetype( File archetypeFile )
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile = getArchetypeZipFile( archetypeFile );
 
             return isOldArchetype( zipFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( XmlPullParserException e )
+        {
             return false;
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             return false;
         }
-        catch( UnknownArchetype e ) {
+        catch ( UnknownArchetype e )
+        {
             return false;
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
-    public boolean isOldArchetype(
-        String groupId,
-        String artifactId,
-        String version,
-        ArtifactRepository archetypeRepository,
-        ArtifactRepository localRepository,
-        List repositories
-    ) {
+    public boolean isOldArchetype( String groupId, String artifactId, String version,
+                                   ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
+                                   List repositories )
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile =
-                getArchetypeZipFile(
-                    getArchetypeFile(
-                        groupId,
-                        artifactId,
-                        version,
-                        archetypeRepository,
-                        localRepository,
-                        repositories
-                    )
-                );
+                getArchetypeZipFile( getArchetypeFile( groupId, artifactId, version, archetypeRepository,
+                                                       localRepository, repositories ) );
 
             return isOldArchetype( zipFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( XmlPullParserException e )
+        {
             return false;
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             return false;
         }
-        catch( UnknownArchetype e ) {
+        catch ( UnknownArchetype e )
+        {
             return false;
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
-    public boolean exists(
-        String archetypeGroupId,
-        String archetypeArtifactId,
-        String archetypeVersion,
-        ArtifactRepository archetypeRepository,
-        ArtifactRepository localRepository,
-        List remoteRepositories
-    ) {
-        try {
-            File archetype = getArchetype(
-                archetypeGroupId,
-                archetypeArtifactId,
-                archetypeVersion );
-            if( archetype == null ) {
+    public boolean exists( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
+                           ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
+                           List remoteRepositories )
+    {
+        try
+        {
+            File archetype = getArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion );
+            if ( archetype == null )
+            {
                 archetype =
-                    downloader.download(
-                        archetypeGroupId,
-                        archetypeArtifactId,
-                        archetypeVersion,
-                        archetypeRepository,
-                        localRepository,
-                        remoteRepositories
-                    );
-                setArchetype(
-                    archetypeGroupId,
-                    archetypeArtifactId,
-                    archetypeVersion,
-                    archetype );
+                    downloader.download( archetypeGroupId, archetypeArtifactId, archetypeVersion, archetypeRepository,
+                                         localRepository, remoteRepositories );
+                setArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion, archetype );
             }
 
             return archetype.exists();
         }
-        catch( DownloadException e ) {
-            getLogger().debug( "Archetype don't exist", e );
+        catch ( DownloadException e )
+        {
+            getLogger().debug(
+                               "Archetype " + archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion
+                                   + " doesn't exist", e );
             return false;
         }
-        catch( DownloadNotFoundException e ) {
-            getLogger().debug( "Archetype don't exist", e );
+        catch ( DownloadNotFoundException e )
+        {
+            getLogger().debug(
+                              "Archetype " + archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion
+                                  + " doesn't exist", e );
             return false;
         }
     }
 
     public ArchetypeDescriptor getFileSetArchetypeDescriptor( File archetypeFile )
-        throws UnknownArchetype {
+        throws UnknownArchetype
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile = getArchetypeZipFile( archetypeFile );
 
             return loadFileSetArchetypeDescriptor( zipFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( XmlPullParserException e )
+        {
             throw new UnknownArchetype( e );
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             throw new UnknownArchetype( e );
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
     public org.apache.maven.archetype.metadata.ArchetypeDescriptor getFileSetArchetypeDescriptor(
-        String groupId,
-        String artifactId,
-        String version,
-        ArtifactRepository archetypeRepository,
-        ArtifactRepository localRepository,
-        List repositories
-    )
-        throws UnknownArchetype {
-        ZipFile zipFile = null;
-        try {
-            zipFile =
-                getArchetypeZipFile(
-                    getArchetypeFile(
-                        groupId,
-                        artifactId,
-                        version,
-                        archetypeRepository,
-                        localRepository,
-                        repositories
-                    )
-                );
+                                                                                                  String groupId,
+                                                                                                  String artifactId,
+                                                                                                  String version,
+                                                                                                  ArtifactRepository archetypeRepository,
+                                                                                                  ArtifactRepository localRepository,
+                                                                                                  List repositories )
+        throws UnknownArchetype
+    {
+        File archetypeFile =
+            getArchetypeFile( groupId, artifactId, version, archetypeRepository, localRepository, repositories );
 
-            return loadFileSetArchetypeDescriptor( zipFile );
-        }
-        catch( XmlPullParserException e ) {
-            throw new UnknownArchetype( e );
-        }
-        catch( IOException e ) {
-            throw new UnknownArchetype( e );
-        }
-        finally {
-            closeZipFile( zipFile );
-        }
+        return getFileSetArchetypeDescriptor( archetypeFile );
     }
 
     public List getFilesetArchetypeResources( File archetypeFile )
-        throws UnknownArchetype {
+        throws UnknownArchetype
+    {
+        getLogger().debug( "getFilesetArchetypeResources( \"" + archetypeFile.getAbsolutePath() + "\" )" );
         List archetypeResources = new ArrayList();
 
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile = getArchetypeZipFile( archetypeFile );
 
             Enumeration enumeration = zipFile.entries();
-            while( enumeration.hasMoreElements() ) {
+            while ( enumeration.hasMoreElements() )
+            {
                 ZipEntry entry = (ZipEntry) enumeration.nextElement();
 
-                if( !entry.isDirectory()
-                    && entry.getName().startsWith( Constants.ARCHETYPE_RESOURCES )
-                    ) {
+                if ( !entry.isDirectory() && entry.getName().startsWith( Constants.ARCHETYPE_RESOURCES ) )
+                {
                     // not supposed to be file.seperator
-                    String resource =
-                        StringUtils.replace(
-                            entry.getName(),
-                            Constants.ARCHETYPE_RESOURCES + "/",
-                            ""
-                        );
-                    getLogger().debug( "Found resource " + resource );
+                    String resource = entry.getName().substring( Constants.ARCHETYPE_RESOURCES.length() + 1 );
+                    getLogger().debug( "  - found resource (" + Constants.ARCHETYPE_RESOURCES + "/)" + resource );
                     // TODO:FIXME
                     archetypeResources.add( resource );
-                } else {
-                    getLogger().debug( "Not resource " + entry.getName() );
+                }
+                else
+                {
+                    getLogger().debug( "  - ignored resource " + entry.getName() );
                 }
             }
             return archetypeResources;
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
-    public org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor(
-        File archetypeFile
-    )
-        throws UnknownArchetype {
+    public org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor( File archetypeFile )
+        throws UnknownArchetype
+    {
         ZipFile zipFile = null;
-        try {
+        try
+        {
             zipFile = getArchetypeZipFile( archetypeFile );
 
             return loadOldArchetypeDescriptor( zipFile );
         }
-        catch( XmlPullParserException e ) {
+        catch ( XmlPullParserException e )
+        {
             throw new UnknownArchetype( e );
         }
-        catch( IOException e ) {
+        catch ( IOException e )
+        {
             throw new UnknownArchetype( e );
         }
-        finally {
+        finally
+        {
             closeZipFile( zipFile );
         }
     }
 
     public org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor(
-        String groupId,
-        String artifactId,
-        String version,
-        ArtifactRepository archetypeRepository,
-        ArtifactRepository localRepository,
-        List repositories
-    )
-        throws UnknownArchetype {
-        ZipFile zipFile = null;
-        try {
-            zipFile =
-                getArchetypeZipFile(
-                    getArchetypeFile(
-                        groupId,
-                        artifactId,
-                        version,
-                        archetypeRepository,
-                        localRepository,
-                        repositories
-                    )
-                );
+                                                                                                    String groupId,
+                                                                                                    String artifactId,
+                                                                                                    String version,
+                                                                                                    ArtifactRepository archetypeRepository,
+                                                                                                    ArtifactRepository localRepository,
+                                                                                                    List repositories )
+        throws UnknownArchetype
+    {
+        File archetypeFile =
+            getArchetypeFile( groupId, artifactId, version, archetypeRepository, localRepository, repositories );
 
-            return loadOldArchetypeDescriptor( zipFile );
-        }
-        catch( XmlPullParserException e ) {
-            throw new UnknownArchetype( e );
-        }
-        catch( IOException e ) {
-            throw new UnknownArchetype( e );
-        }
-        finally {
-            closeZipFile( zipFile );
-        }
+        return getOldArchetypeDescriptor( archetypeFile );
     }
 
-    private void closeZipFile( ZipFile zipFile ) {
-        try {
-            zipFile.close();
-        }
-        catch( Exception e ) {
-            getLogger().error( "Fail to close zipFile" );
-        }
-    }
-
-    private File getArchetype( String archetypeGroupId,
-                               String archetypeArtifactId,
-                               String archetypeVersion ) {
+    private File getArchetype( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion )
+    {
         String key = archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion;
-        if( archetypeCache.containsKey( key ) ) {
+
+        if ( archetypeCache.containsKey( key ) )
+        {
             getLogger().debug( "Found archetype " + key + " in cache: " + archetypeCache.get( key ) );
+
             return (File) archetypeCache.get( key );
-        } else {
-            getLogger().debug( "Not found archetype " + key + " in cache" );
-            return null;
         }
-    }
 
-    private void setArchetype( String archetypeGroupId,
-                               String archetypeArtifactId,
-                               String archetypeVersion,
-                               File archetype ) {
-        String key = archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion;
-        archetypeCache.put( key, archetype );
-    }
-
-    private ZipEntry searchEntry( ZipFile zipFile, String searchString ) {
-        getLogger().debug("Searching for "+searchString+" inside "+zipFile);
-        Enumeration enu = zipFile.entries();
-        while( enu.hasMoreElements() ) {
-            ZipEntry entryfound = (ZipEntry) enu.nextElement();
-            getLogger().debug( "An ENTRY " + entryfound.getName() );
-            if( searchString.equals( entryfound.getName() ) ) {
-                getLogger().error( "Found entry" );
-                return entryfound;
-            }
-        }
+        getLogger().debug( "Not found archetype " + key + " in cache" );
         return null;
     }
 
-    private Reader getArchetypeDescriptorReader( ZipFile zipFile )
-        throws IOException {
-        ZipEntry entry = searchEntry( zipFile,
-            StringUtils.replace( Constants.ARCHETYPE_DESCRIPTOR, File.separator, "/" ) );
+    private void setArchetype( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
+                               File archetype )
+    {
+        String key = archetypeGroupId + ":" + archetypeArtifactId + ":" + archetypeVersion;
 
-
-        if( entry == null ) {
-            getLogger().debug(
-                "Not found " + Constants.ARCHETYPE_DESCRIPTOR + " retrying with windows path"
-            );
-            entry = searchEntry( zipFile,
-                StringUtils.replace( Constants.ARCHETYPE_DESCRIPTOR, "/", File.separator )
-            );
-        }
-        if( entry == null ) {
-            throw new IOException(
-                "The " + Constants.ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
-        }
-
-        InputStream is = zipFile.getInputStream( entry );
-
-        if( is == null ) {
-            throw new IOException(
-                "The " + Constants.ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
-        }
-        return new InputStreamReader( is );
+        archetypeCache.put( key, archetype );
     }
 
     private boolean isFileSetArchetype( ZipFile zipFile )
-        throws IOException, XmlPullParserException {
-        org.apache.maven.archetype.metadata.ArchetypeDescriptor descriptor =
-            loadFileSetArchetypeDescriptor( zipFile );
+        throws IOException, XmlPullParserException
+    {
+        org.apache.maven.archetype.metadata.ArchetypeDescriptor descriptor = loadFileSetArchetypeDescriptor( zipFile );
 
         return descriptor.getName() != null;
     }
 
     private boolean isOldArchetype( ZipFile zipFile )
-        throws IOException, XmlPullParserException {
-        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor descriptor =
-            loadOldArchetypeDescriptor( zipFile );
+        throws IOException, XmlPullParserException
+    {
+        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor descriptor = loadOldArchetypeDescriptor( zipFile );
 
         return descriptor.getId() != null;
     }
 
-    private org.apache.maven.archetype.metadata.ArchetypeDescriptor loadFileSetArchetypeDescriptor(
-        ZipFile zipFile
-    )
-        throws IOException, XmlPullParserException {
+    private org.apache.maven.archetype.metadata.ArchetypeDescriptor loadFileSetArchetypeDescriptor( ZipFile zipFile )
+        throws IOException, XmlPullParserException
+    {
         Reader reader = getArchetypeDescriptorReader( zipFile );
 
         ArchetypeDescriptorXpp3Reader archetypeReader = new ArchetypeDescriptorXpp3Reader();
 
-        try {
+        try
+        {
             return archetypeReader.read( reader, true );
         }
-        catch(IOException e){
-            getLogger().debug("Cant not read archetype descriptor", e);
+        catch ( IOException e )
+        {
+            getLogger().debug( "Cannot read archetype descriptor", e );
             throw e;
         }
-        catch(XmlPullParserException e){
-            getLogger().error("Cant not parse archetype descriptor", e);
+        catch ( XmlPullParserException e )
+        {
+            getLogger().error( "Cannot parse archetype descriptor", e );
             throw e;
         }
-        finally {
+        finally
+        {
             reader.close();
         }
     }
 
-    private org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor
-    loadOldArchetypeDescriptor( ZipFile zipFile )
-        throws IOException, XmlPullParserException {
+    private org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor loadOldArchetypeDescriptor( ZipFile zipFile )
+        throws IOException, XmlPullParserException
+    {
         ArchetypeDescriptorBuilder builder = new ArchetypeDescriptorBuilder();
 
         org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor descriptor = null;
 
         Reader reader = null;
-        try {
+        try
+        {
             reader = getOldArchetypeDescriptorReader( zipFile );
 
             descriptor = builder.build( reader );
         }
-        catch( IOException ex ) {
-            getLogger().debug( "Can not load old archetype", ex );
+        catch ( IOException ex )
+        {
+            getLogger().debug( "Cannot load old archetype", ex );
         }
-        catch( XmlPullParserException ex ) {
-            getLogger().error( "Can not parse old archetype", ex );
+        catch ( XmlPullParserException ex )
+        {
+            getLogger().error( "Cannot parse old archetype", ex );
         }
-        finally {
-            if( reader != null ) {
-                reader.close();
-            }
+        finally
+        {
+            IOUtil.close( reader );
         }
 
-        if( descriptor == null ) {
-            try {
+        if ( descriptor == null )
+        {
+            try
+            {
                 reader = getOlderArchetypeDescriptorReader( zipFile );
 
                 descriptor = builder.build( reader );
             }
-            finally {
-                if( reader != null ) {
-                    reader.close();
-                }
+            finally
+            {
+                IOUtil.close( reader );
             }
         }
 
         return descriptor;
     }
 
+    private Reader getArchetypeDescriptorReader( ZipFile zipFile )
+        throws IOException
+    {
+        return getDescriptorReader( zipFile, Constants.ARCHETYPE_DESCRIPTOR );
+    }
+
     private Reader getOldArchetypeDescriptorReader( ZipFile zipFile )
-        throws IOException {
-        ZipEntry entry = searchEntry( zipFile,
-            StringUtils.replace( Constants.OLD_ARCHETYPE_DESCRIPTOR, File.separator, "/" )
-        );
-
-        if( entry == null ) {
-            getLogger().debug(
-                "No found " + Constants.OLD_ARCHETYPE_DESCRIPTOR + " retrying with windows path"
-            );
-            entry = searchEntry( zipFile,
-                StringUtils.replace( Constants.OLD_ARCHETYPE_DESCRIPTOR, "/", File.separator )
-            );
-        }
-
-        if( entry == null ) {
-            throw new IOException(
-                "The " + Constants.OLD_ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
-        }
-
-        InputStream is = zipFile.getInputStream( entry );
-
-        if( is == null ) {
-            throw new IOException(
-                "The " + Constants.OLD_ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
-        }
-        return new InputStreamReader( is );
+        throws IOException
+    {
+        return getDescriptorReader( zipFile, Constants.OLD_ARCHETYPE_DESCRIPTOR );
     }
 
     private Reader getOlderArchetypeDescriptorReader( ZipFile zipFile )
-        throws IOException {
-        ZipEntry entry = searchEntry( zipFile,
-            StringUtils.replace( Constants.OLDER_ARCHETYPE_DESCRIPTOR, File.separator, "/" )
-        );
+        throws IOException
+    {
+        return getDescriptorReader( zipFile, Constants.OLDER_ARCHETYPE_DESCRIPTOR );
+    }
 
-        if( entry == null ) {
-            getLogger().debug(
-                "No found " + Constants.OLDER_ARCHETYPE_DESCRIPTOR + " retrying with windows path"
-            );
-            entry = searchEntry( zipFile,
-                StringUtils.replace(
-                    Constants.OLDER_ARCHETYPE_DESCRIPTOR,
-                    "/",
-                    File.separator
-                )
-            );
+    private Reader getDescriptorReader( ZipFile zipFile, String descriptor )
+        throws IOException
+    {
+        ZipEntry entry = searchEntry( zipFile, StringUtils.replace( descriptor, File.separator, "/" ) );
+
+        if ( entry == null )
+        {
+            getLogger().debug( "No found " + descriptor + " retrying with windows path separator." );
+
+            entry = searchEntry( zipFile, StringUtils.replace( descriptor, "/", File.separator ) );
         }
-        if( entry == null ) {
-            throw new IOException(
-                "The " + Constants.OLDER_ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
+
+        if ( entry == null )
+        {
+            throw new IOException( "The " + descriptor + " descriptor cannot be found in " + zipFile.getName() + "." );
         }
 
         InputStream is = zipFile.getInputStream( entry );
 
-        if( is == null ) {
-            throw new IOException(
-                "The " + Constants.OLDER_ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."
-            );
+        if ( is == null )
+        {
+            throw new IOException( "The " + descriptor + " descriptor cannot be read in " + zipFile.getName() + "." );
         }
 
-        return new InputStreamReader( is );
+        return ReaderFactory.newXmlReader( is );
+    }
+
+    private ZipEntry searchEntry( ZipFile zipFile, String searchString )
+    {
+        getLogger().debug( "Searching for " + searchString + " inside " + zipFile.getName() );
+
+        Enumeration enu = zipFile.entries();
+        while ( enu.hasMoreElements() )
+        {
+            ZipEntry entryfound = (ZipEntry) enu.nextElement();
+            getLogger().debug( "  - " + entryfound.getName() );
+
+            if ( searchString.equals( entryfound.getName() ) )
+            {
+                getLogger().debug( "Entry found" );
+                return entryfound;
+            }
+        }
+        return null;
+    }
+
+    private void closeZipFile( ZipFile zipFile )
+    {
+        try
+        {
+            zipFile.close();
+        }
+        catch ( Exception e )
+        {
+            getLogger().error( "Failed to close zipFile" );
+        }
     }
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
index e8ba74a..96cd64d 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
@@ -1,482 +1,476 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.common.util.ListScanner;

-import org.apache.maven.archetype.common.util.PathUtils;

-import org.apache.maven.archetype.metadata.FileSet;

-import org.codehaus.plexus.logging.AbstractLogEnabled;

-import org.codehaus.plexus.util.FileUtils;

-import org.codehaus.plexus.util.StringUtils;

-

-import java.io.File;

-import java.io.IOException;

-import java.util.ArrayList;

-import java.util.Arrays;

-import java.util.HashSet;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Set;

-

-/** @plexus.component */

-public class DefaultArchetypeFilesResolver

-    extends AbstractLogEnabled

-    implements ArchetypeFilesResolver

-{

-    public List getFilesWithExtension( List files,

-                                       String extension )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "" );

-

-        scanner.setIncludes( "**/*." + extension );

-        scanner.setExcludes( "" );

-

-        return scanner.scan( files );

-    }

-

-    public List getFilteredFiles( List files,

-                                  String filtered )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "" );

-

-        scanner.setIncludes( filtered );

-        scanner.setExcludes( "" );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " filtered files in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List filterFiles( String moduleOffset,

-                             FileSet fileSet,

-                             List archetypeResources )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir(

-            ( StringUtils.isEmpty( moduleOffset ) ? "" : ( moduleOffset + File.separatorChar ) )

-                + fileSet.getDirectory()

-        );

-        scanner.setIncludes( fileSet.getIncludes() );

-        scanner.setExcludes( fileSet.getExcludes() );

-        scanner.setCaseSensitive( true );

-

-        return scanner.scan( archetypeResources );

-    }

-

-    public List findOtherResources( int level,

-                                    List files,

-                                    String languages )

-    {

-        ListScanner scanner = new ListScanner();

-

-        scanner.setBasedir( "" );

-

-        String includes = "";

-        for ( int i = 0; i < level; i++ )

-        {

-            includes += "*/";

-        }

-

-        scanner.setIncludes( includes + "**" );

-        scanner.setExcludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " other resources in " + files.size()

-                + " files at level " + level

-        );

-

-        return result;

-    }

-

-    public List findOtherResources( int level,

-                                    List files,

-                                    List sourcesFiles,

-                                    String languages )

-    {

-        ListScanner scanner = new ListScanner();

-

-        scanner.setBasedir( "" );

-

-        Set selectedDirectories = new HashSet();

-

-        List includes = new ArrayList();

-

-        Iterator sourcesFilesIterator = sourcesFiles.iterator();

-        while ( sourcesFilesIterator.hasNext() )

-        {

-            String sourcesFile = (String) sourcesFilesIterator.next();

-

-            String directory = PathUtils.getDirectory( sourcesFile, level - 1 );

-            if ( !selectedDirectories.contains( directory ) )

-            {

-                includes.add( directory + "/**" );

-            }

-

-            selectedDirectories.add( directory );

-        }

-

-        scanner.setExcludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " other resources in " + files.size()

-                + " files at level " + level

-        );

-

-        return result;

-    }

-

-    public List findOtherSources( int level,

-                                  List files,

-                                  String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "" );

-

-        String levelDirectory = "";

-        for ( int i = 0; i < ( level - 1 ); i++ )

-        {

-            levelDirectory += "*/";

-        }

-

-        String includes = "";

-        String[] languagesAsArray = StringUtils.split( languages );

-        for ( int i = 0; i < languagesAsArray.length; i++ )

-        {

-            includes += levelDirectory + languagesAsArray[i];

-        }

-

-        scanner.setIncludes( includes );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " other sources in " + files.size() + " files at level "

-                + level

-        );

-

-        return result;

-    }

-

-    public List findResourcesMainFiles( List files,

-                                        String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "src/main" );

-

-        scanner.setIncludes( "**" );

-        scanner.setExcludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " resources in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List findResourcesTestFiles( List files,

-                                        String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "src/test" );

-

-        scanner.setIncludes( "**" );

-        scanner.setExcludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " test resources in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List findSiteFiles( List files,

-                               String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "src/site" );

-

-        scanner.setIncludes( "**" );

-        scanner.setExcludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " site resources in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List findSourcesMainFiles( List files,

-                                      String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "src/main" );

-

-        scanner.setIncludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " sources in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List findSourcesTestFiles( List files,

-                                      String languages )

-    {

-        ListScanner scanner = new ListScanner();

-        scanner.setBasedir( "src/test" );

-

-        scanner.setIncludes( languages );

-

-        List result = scanner.scan( files );

-        getLogger().debug(

-            "Scanned " + result.size() + " test sources in " + files.size() + " files"

-        );

-

-        return result;

-    }

-

-    public List getPackagedFiles( List files,

-                                  String packageName )

-    {

-        List packagedFiles = new ArrayList();

-        Iterator filesIterator = files.iterator();

-        while ( filesIterator.hasNext() )

-        {

-            String file = (String) filesIterator.next();

-

-            if ( file.startsWith( packageName ) )

-            {

-                packagedFiles.add( file.substring( packageName.length() + 1 ) );

-            }

-        }

-        getLogger().debug(

-            "Scanned " + packagedFiles.size() + " packaged files in " + files.size() + " files"

-        );

-        return packagedFiles;

-    }

-

-    public String resolvePackage( File basedir,

-                                  List languages )

-        throws

-        IOException

-    {

-        getLogger().debug( "Resolving package in " + basedir + " using languages " + languages );

-

-        List files = resolveFiles( basedir, languages );

-

-        return resolvePackage( files );

-    }

-

-//    public List getUnfilteredFiles( List files,

-//                                    String filtered )

-//    {

-//        ListScanner scanner = new ListScanner();

-//        scanner.setBasedir( "" );

-//

-//        scanner.setIncludes( "**" );

-//        scanner.setExcludes( filtered );

-//

-//        List result = scanner.scan( files );

-//        getLogger().debug(

-//            "Scanned " + result.size() + " unfiltered files in " + files.size() + " files"

-//        );

-//

-//        return result;

-//    }

-

-    public List getUnpackagedFiles( List files,

-                                    String packageName )

-    {

-        List unpackagedFiles = new ArrayList();

-        Iterator filesIterator = files.iterator();

-        while ( filesIterator.hasNext() )

-        {

-            String file = (String) filesIterator.next();

-

-            if ( !file.startsWith( packageName ) )

-            {

-                unpackagedFiles.add( file );

-            }

-        }

-        getLogger().debug(

-            "Scanned " + unpackagedFiles.size() + " unpackaged files in " + files.size()

-                + " files"

-        );

-        return unpackagedFiles;

-    }

-

-    private String getCommonPackage( String packageName,

-                                     String templatePackage )

-    {

-        String common = "";

-

-        String difference = StringUtils.difference( packageName, templatePackage );

-        if ( StringUtils.isNotEmpty( difference ) )

-        {

-            String temporaryCommon =

-                StringUtils.substring(

-                    templatePackage,

-                    0,

-                    templatePackage.lastIndexOf( difference )

-                );

-            if ( !difference.startsWith( "." ) )

-            {

-                common =

-                    StringUtils.substring(

-                        temporaryCommon,

-                        0,

-                        temporaryCommon.lastIndexOf( "." )

-                    );

-            }

-            else

-            {

-                common = temporaryCommon;

-            }

-        }

-        else

-        {

-            common = packageName;

-        }

-

-        return common;

-    }

-

-    private List resolveFiles( File basedir,

-                               List languages )

-        throws

-        IOException

-    {

-        String[] languagesArray = (String[]) languages.toArray( new String[languages.size()] );

-        String[] languagesPathesArray = new String[languagesArray.length];

-        for ( int i = 0; i < languagesArray.length; i++ )

-        {

-            languagesPathesArray[i] = "**/src/**/" + languagesArray[i] + "/**";

-        }

-

-        String excludes = "target";

-        Iterator defaultExcludes = Arrays.asList( ListScanner.DEFAULTEXCLUDES ).iterator();

-        while ( defaultExcludes.hasNext() )

-        {

-            excludes += "," + (String) defaultExcludes.next() + "/**";

-        }

-

-        List absoluteFiles =

-            FileUtils.getFiles(

-                basedir,

-                StringUtils.join( languagesPathesArray, "," ),

-                excludes

-            );

-

-        getLogger().debug( "Found " + absoluteFiles.size() + " potential archetype files" );

-

-        List files = new ArrayList( absoluteFiles.size() );

-

-        Iterator filesIterator = absoluteFiles.iterator();

-        while ( filesIterator.hasNext() )

-        {

-            File file = (File) filesIterator.next();

-            String filePath =

-                StringUtils.prechomp(

-                    file.getAbsolutePath(),

-                    basedir.getAbsolutePath() + File.separator

-                );

-

-            String minusSrc = StringUtils.prechomp( filePath, "src" + File.separator );

-

-            for ( int i = 0; i < languagesArray.length; i++ )

-            {

-                String language = languagesArray[i];

-

-                if ( StringUtils.countMatches(

-                    minusSrc,

-                    File.separator + language + File.separator

-                )

-                    > 0

-                    )

-                {

-                    String minusLanguage =

-                        StringUtils.prechomp( minusSrc, language + File.separator );

-

-                    files.add( toUnixPath( minusLanguage ) );

-                }

-            }

-        }

-

-        getLogger().debug(

-            "Found " + files.size() + " archetype files for package resolution "

-        );

-

-        return files;

-    }

-

-    private String resolvePackage( List files )

-    {

-        String packageName = null;

-        Iterator minusLanguageIterator = files.iterator();

-        while ( minusLanguageIterator.hasNext() )

-        {

-            String minusLanguage = (String) minusLanguageIterator.next();

-

-            String filePackage;

-            if ( minusLanguage.indexOf( "/" ) >= 0 )

-            {

-                filePackage =

-                    StringUtils.replace(

-                        minusLanguage.substring( 0, minusLanguage.lastIndexOf( "/" ) ),

-                        "/",

-                        "."

-                    );

-            }

-            else

-            {

-                filePackage = "";

-            }

-

-            if ( packageName == null )

-            {

-                packageName = filePackage;

-            }

-            else

-            {

-                packageName = getCommonPackage( packageName, filePackage );

-            }

-        }

-

-        getLogger().debug( "Package resolved to " + packageName );

-

-        return packageName;

-    }

-

-    private String toUnixPath( String path )

-    {

-        return path.replace( File.separatorChar, '/' );

-    }

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.common.util.ListScanner;
+import org.apache.maven.archetype.common.util.PathUtils;
+import org.apache.maven.archetype.metadata.FileSet;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/** @plexus.component */
+public class DefaultArchetypeFilesResolver
+    extends AbstractLogEnabled
+    implements ArchetypeFilesResolver
+{
+    public List getFilesWithExtension( List files,
+                                       String extension )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "" );
+
+        scanner.setIncludes( "**/*." + extension );
+        scanner.setExcludes( "" );
+
+        return scanner.scan( files );
+    }
+
+    public List getFilteredFiles( List files,
+                                  String filtered )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "" );
+
+        scanner.setIncludes( filtered );
+        scanner.setExcludes( "" );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " filtered files in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List filterFiles( String moduleOffset,
+                             FileSet fileSet,
+                             List archetypeResources )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir(
+            ( StringUtils.isEmpty( moduleOffset ) ? "" : ( moduleOffset + File.separatorChar ) )
+                + fileSet.getDirectory()
+        );
+        scanner.setIncludes( fileSet.getIncludes() );
+        scanner.setExcludes( fileSet.getExcludes() );
+        scanner.setCaseSensitive( true );
+
+        return scanner.scan( archetypeResources );
+    }
+
+    public List findOtherResources( int level,
+                                    List files,
+                                    String languages )
+    {
+        ListScanner scanner = new ListScanner();
+
+        scanner.setBasedir( "" );
+
+        String includes = "";
+        for ( int i = 0; i < level; i++ )
+        {
+            includes += "*/";
+        }
+
+        scanner.setIncludes( includes + "**" );
+        scanner.setExcludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " other resources in " + files.size()
+                + " files at level " + level
+        );
+
+        return result;
+    }
+
+    public List findOtherResources( int level,
+                                    List files,
+                                    List sourcesFiles,
+                                    String languages )
+    {
+        ListScanner scanner = new ListScanner();
+
+        scanner.setBasedir( "" );
+
+        Set selectedDirectories = new HashSet();
+
+        List includes = new ArrayList();
+
+        Iterator sourcesFilesIterator = sourcesFiles.iterator();
+        while ( sourcesFilesIterator.hasNext() )
+        {
+            String sourcesFile = (String) sourcesFilesIterator.next();
+
+            String directory = PathUtils.getDirectory( sourcesFile, level - 1 );
+            if ( !selectedDirectories.contains( directory ) )
+            {
+                includes.add( directory + "/**" );
+            }
+
+            selectedDirectories.add( directory );
+        }
+
+        scanner.setExcludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " other resources in " + files.size()
+                + " files at level " + level
+        );
+
+        return result;
+    }
+
+    public List findOtherSources( int level,
+                                  List files,
+                                  String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "" );
+
+        String levelDirectory = "";
+        for ( int i = 0; i < ( level - 1 ); i++ )
+        {
+            levelDirectory += "*/";
+        }
+
+        String includes = "";
+        String[] languagesAsArray = StringUtils.split( languages );
+        for ( int i = 0; i < languagesAsArray.length; i++ )
+        {
+            includes += levelDirectory + languagesAsArray[i];
+        }
+
+        scanner.setIncludes( includes );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " other sources in " + files.size() + " files at level "
+                + level
+        );
+
+        return result;
+    }
+
+    public List findResourcesMainFiles( List files,
+                                        String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "src/main" );
+
+        scanner.setIncludes( "**" );
+        scanner.setExcludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " resources in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List findResourcesTestFiles( List files,
+                                        String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "src/test" );
+
+        scanner.setIncludes( "**" );
+        scanner.setExcludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " test resources in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List findSiteFiles( List files,
+                               String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "src/site" );
+
+        scanner.setIncludes( "**" );
+        scanner.setExcludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " site resources in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List findSourcesMainFiles( List files,
+                                      String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "src/main" );
+
+        scanner.setIncludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " sources in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List findSourcesTestFiles( List files,
+                                      String languages )
+    {
+        ListScanner scanner = new ListScanner();
+        scanner.setBasedir( "src/test" );
+
+        scanner.setIncludes( languages );
+
+        List result = scanner.scan( files );
+        getLogger().debug(
+            "Scanned " + result.size() + " test sources in " + files.size() + " files"
+        );
+
+        return result;
+    }
+
+    public List getPackagedFiles( List files,
+                                  String packageName )
+    {
+        List packagedFiles = new ArrayList();
+        Iterator filesIterator = files.iterator();
+        while ( filesIterator.hasNext() )
+        {
+            String file = (String) filesIterator.next();
+
+            if ( file.startsWith( packageName ) )
+            {
+                packagedFiles.add( file.substring( packageName.length() + 1 ) );
+            }
+        }
+        getLogger().debug(
+            "Scanned " + packagedFiles.size() + " packaged files in " + files.size() + " files"
+        );
+        return packagedFiles;
+    }
+
+    public String resolvePackage( File basedir,
+                                  List languages )
+        throws
+        IOException
+    {
+        getLogger().debug( "Resolving package in " + basedir + " using languages " + languages );
+
+        List files = resolveFiles( basedir, languages );
+
+        return resolvePackage( files );
+    }
+
+//    public List getUnfilteredFiles( List files,
+//                                    String filtered )
+//    {
+//        ListScanner scanner = new ListScanner();
+//        scanner.setBasedir( "" );
+//
+//        scanner.setIncludes( "**" );
+//        scanner.setExcludes( filtered );
+//
+//        List result = scanner.scan( files );
+//        getLogger().debug(
+//            "Scanned " + result.size() + " unfiltered files in " + files.size() + " files"
+//        );
+//
+//        return result;
+//    }
+
+    public List getUnpackagedFiles( List files,
+                                    String packageName )
+    {
+        List unpackagedFiles = new ArrayList();
+        Iterator filesIterator = files.iterator();
+        while ( filesIterator.hasNext() )
+        {
+            String file = (String) filesIterator.next();
+
+            if ( !file.startsWith( packageName ) )
+            {
+                unpackagedFiles.add( file );
+            }
+        }
+        getLogger().debug(
+            "Scanned " + unpackagedFiles.size() + " unpackaged files in " + files.size()
+                + " files"
+        );
+        return unpackagedFiles;
+    }
+
+    private String getCommonPackage( String packageName,
+                                     String templatePackage )
+    {
+        String common = "";
+
+        String difference = StringUtils.difference( packageName, templatePackage );
+        if ( StringUtils.isNotEmpty( difference ) )
+        {
+            String temporaryCommon =
+                StringUtils.substring(
+                    templatePackage,
+                    0,
+                    templatePackage.lastIndexOf( difference )
+                );
+            if ( !difference.startsWith( "." ) )
+            {
+                common =
+                    StringUtils.substring(
+                        temporaryCommon,
+                        0,
+                        temporaryCommon.lastIndexOf( "." )
+                    );
+            }
+            else
+            {
+                common = temporaryCommon;
+            }
+        }
+        else
+        {
+            common = packageName;
+        }
+
+        return common;
+    }
+
+    private List resolveFiles( File basedir,
+                               List languages )
+        throws IOException
+    {
+        String[] languagesArray = (String[]) languages.toArray( new String[languages.size()] );
+        String[] languagesPathesArray = new String[languagesArray.length];
+        for ( int i = 0; i < languagesArray.length; i++ )
+        {
+            languagesPathesArray[i] = "**/src/**/" + languagesArray[i] + "/**";
+        }
+
+        String excludes = "target";
+        Iterator defaultExcludes = Arrays.asList( ListScanner.DEFAULTEXCLUDES ).iterator();
+        while ( defaultExcludes.hasNext() )
+        {
+            excludes += "," + (String) defaultExcludes.next() + "/**";
+        }
+
+        List absoluteFiles =
+            FileUtils.getFiles(
+                basedir,
+                StringUtils.join( languagesPathesArray, "," ),
+                excludes
+            );
+
+        getLogger().debug( "Found " + absoluteFiles.size() + " potential archetype files" );
+
+        List files = new ArrayList( absoluteFiles.size() );
+
+        Iterator filesIterator = absoluteFiles.iterator();
+        while ( filesIterator.hasNext() )
+        {
+            File file = (File) filesIterator.next();
+            String filePath =
+                StringUtils.prechomp(
+                    file.getAbsolutePath(),
+                    basedir.getAbsolutePath() + File.separator
+                );
+
+            String minusSrc = StringUtils.prechomp( filePath, "src" + File.separator );
+
+            for ( int i = 0; i < languagesArray.length; i++ )
+            {
+                String language = languagesArray[i];
+
+                if ( StringUtils.countMatches( minusSrc, File.separator + language + File.separator ) > 0 )
+                {
+                    String minusLanguage =
+                        StringUtils.prechomp( minusSrc, language + File.separator );
+
+                    files.add( toUnixPath( minusLanguage ) );
+                }
+            }
+        }
+
+        getLogger().debug(
+            "Found " + files.size() + " archetype files for package resolution "
+        );
+
+        return files;
+    }
+
+    private String resolvePackage( List files )
+    {
+        String packageName = null;
+        Iterator minusLanguageIterator = files.iterator();
+        while ( minusLanguageIterator.hasNext() )
+        {
+            String minusLanguage = (String) minusLanguageIterator.next();
+
+            String filePackage;
+            if ( minusLanguage.indexOf( "/" ) >= 0 )
+            {
+                filePackage =
+                    StringUtils.replace(
+                        minusLanguage.substring( 0, minusLanguage.lastIndexOf( "/" ) ),
+                        "/",
+                        "."
+                    );
+            }
+            else
+            {
+                filePackage = "";
+            }
+
+            if ( packageName == null )
+            {
+                packageName = filePackage;
+            }
+            else
+            {
+                packageName = getCommonPackage( packageName, filePackage );
+            }
+        }
+
+        getLogger().debug( "Package resolved to " + packageName );
+
+        return packageName;
+    }
+
+    private String toUnixPath( String path )
+    {
+        return path.replace( File.separatorChar, '/' );
+    }
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeRegistryManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeRegistryManager.java
index 9a5a66e..3ee472d 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeRegistryManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeRegistryManager.java
@@ -1,232 +1,225 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.registry.ArchetypeRegistry;

-import org.apache.maven.archetype.registry.io.xpp3.ArchetypeRegistryXpp3Reader;

-import org.apache.maven.archetype.registry.io.xpp3.ArchetypeRegistryXpp3Writer;

-import org.apache.maven.artifact.repository.ArtifactRepository;

-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;

-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;

-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;

-import org.codehaus.plexus.logging.AbstractLogEnabled;

-import org.codehaus.plexus.util.IOUtil;

-import org.codehaus.plexus.util.StringUtils;

-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

-

-import java.io.File;

-import java.io.FileReader;

-import java.io.FileWriter;

-import java.io.IOException;

-import java.io.Reader;

-import java.util.ArrayList;

-import java.util.Arrays;

-import java.util.List;

-

-/** @plexus.component */

-public class DefaultArchetypeRegistryManager

-    extends AbstractLogEnabled

-    implements ArchetypeRegistryManager

-{

-//    private static File DEFAULT_REGISTRY = new File( System.getProperty( "user.home" ), ".m2/archetype.xml" );

-

-    /**

-     * Used to create ArtifactRepository objects given the urls of the remote repositories.

-     *

-     * @plexus.requirement

-     */

-    private ArtifactRepositoryFactory artifactRepositoryFactory;

-

-    /**

-     * Determines whether the layout is legacy or not.

-     *

-     * @plexus.requirement roleHint="default"

-     */

-    private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;

-

-    public List getFilteredExtensions(

-        String archetypeFilteredExtentions,

-        File archetypeRegistryFile

-    )

-        throws

-        IOException

-    {

-        List filteredExtensions = new ArrayList();

-

-        if ( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )

-        {

-            filteredExtensions.addAll(

-                Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) )

-            );

-        }

-

-        try

-        {

-            ArchetypeRegistry registry = readArchetypeRegistry( archetypeRegistryFile );

-

-            filteredExtensions.addAll( registry.getFilteredExtensions() );

-        }

-        catch ( IOException e )

-        {

-            getLogger().warn( "Can not read ~/m2/archetype.xml" );

-        }

-        catch ( XmlPullParserException e )

-        {

-            getLogger().warn( "Can not read ~/m2/archetype.xml" );

-        }

-

-        if ( filteredExtensions.isEmpty() )

-        {

-            filteredExtensions.addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );

-        }

-

-        return filteredExtensions;

-    }

-

-    public List getLanguages( String archetypeLanguages,

-                              File archetypeRegistryFile )

-        throws

-        IOException

-    {

-        List languages = new ArrayList();

-

-        if ( StringUtils.isNotEmpty( archetypeLanguages ) )

-        {

-            languages.addAll( Arrays.asList( StringUtils.split( archetypeLanguages, "," ) ) );

-        }

-

-        try

-        {

-            ArchetypeRegistry registry = readArchetypeRegistry( archetypeRegistryFile );

-

-            languages.addAll( registry.getLanguages() );

-        }

-        catch ( IOException e )

-        {

-            getLogger().warn( "Can not read ~/m2/archetype.xml" );

-        }

-        catch ( XmlPullParserException e )

-        {

-            getLogger().warn( "Can not read ~/m2/archetype.xml" );

-        }

-

-        if ( languages.isEmpty() )

-        {

-            languages.addAll( Constants.DEFAULT_LANGUAGES );

-        }

-

-        return languages;

-    }

-

-    public ArchetypeRegistry readArchetypeRegistry( File archetypeRegistryFile )

-        throws

-        IOException,

-        XmlPullParserException

-    {

-        if ( !archetypeRegistryFile.exists() )

-        {

-            return getDefaultArchetypeRegistry();

-        }

-        else

-        {

-            return readArchetypeRegistry( new FileReader( archetypeRegistryFile ) );

-        }

-    }

-

-    public ArchetypeRegistry readArchetypeRegistry( Reader reader )

-        throws

-        IOException,

-        XmlPullParserException

-    {

-        ArchetypeRegistryXpp3Reader xpp3Reader = new ArchetypeRegistryXpp3Reader();

-

-        try

-        {

-            return xpp3Reader.read( reader );

-        }

-        finally

-        {

-            IOUtil.close( reader );

-        }

-    }

-

-    public void writeArchetypeRegistry(

-        File archetypeRegistryFile,

-        ArchetypeRegistry archetypeRegistry

-    )

-        throws

-        IOException

-    {

-        ArchetypeRegistryXpp3Writer writer = new ArchetypeRegistryXpp3Writer();

-        FileWriter fileWriter = new FileWriter( archetypeRegistryFile );

-

-        try

-        {

-            writer.write( fileWriter, archetypeRegistry );

-        }

-        finally

-        {

-            IOUtil.close( fileWriter );

-        }

-    }

-

-    /**

-     * Code stealed from MavenArchetypeMojo

-     * (org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha4).

-     */

-    public ArtifactRepository createRepository( String url,

-                                                String repositoryId )

-    {

-        // snapshots vs releases

-        // offline = to turning the update policy off

-

-        // TODO: we'll need to allow finer grained creation of repositories but this will do for now

-

-        String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;

-

-        String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;

-

-        ArtifactRepositoryPolicy snapshotsPolicy =

-            new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );

-

-        ArtifactRepositoryPolicy releasesPolicy =

-            new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );

-

-        return

-            artifactRepositoryFactory.createArtifactRepository(

-                repositoryId,

-                url,

-                defaultArtifactRepositoryLayout,

-                snapshotsPolicy,

-                releasesPolicy

-            );

-    }

-

-    public ArchetypeRegistry getDefaultArchetypeRegistry()

-    {

-        ArchetypeRegistry registry = new ArchetypeRegistry();

-

-        registry.getLanguages().addAll( Constants.DEFAULT_LANGUAGES );

-

-        registry.getFilteredExtensions().addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );

-

-        return registry;

-    }

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.archetype.registry.io.xpp3.ArchetypeRegistryXpp3Reader;
+import org.apache.maven.archetype.registry.io.xpp3.ArchetypeRegistryXpp3Writer;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** @plexus.component */
+public class DefaultArchetypeRegistryManager
+    extends AbstractLogEnabled
+    implements ArchetypeRegistryManager
+{
+//    private static File DEFAULT_REGISTRY = new File( System.getProperty( "user.home" ), ".m2/archetype.xml" );
+
+    /**
+     * Used to create ArtifactRepository objects given the urls of the remote repositories.
+     *
+     * @plexus.requirement
+     */
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
+
+    /**
+     * Determines whether the layout is legacy or not.
+     *
+     * @plexus.requirement roleHint="default"
+     */
+    private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
+
+    public List getFilteredExtensions(
+        String archetypeFilteredExtentions,
+        File archetypeRegistryFile
+    )
+        throws IOException
+    {
+        List filteredExtensions = new ArrayList();
+
+        if ( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )
+        {
+            filteredExtensions.addAll(
+                Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) )
+            );
+        }
+
+        try
+        {
+            ArchetypeRegistry registry = readArchetypeRegistry( archetypeRegistryFile );
+
+            filteredExtensions.addAll( registry.getFilteredExtensions() );
+        }
+        catch ( IOException e )
+        {
+            getLogger().warn( "Can not read ~/m2/archetype.xml" );
+        }
+        catch ( XmlPullParserException e )
+        {
+            getLogger().warn( "Can not read ~/m2/archetype.xml" );
+        }
+
+        if ( filteredExtensions.isEmpty() )
+        {
+            filteredExtensions.addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );
+        }
+
+        return filteredExtensions;
+    }
+
+    public List getLanguages( String archetypeLanguages,
+                              File archetypeRegistryFile )
+        throws IOException
+    {
+        List languages = new ArrayList();
+
+        if ( StringUtils.isNotEmpty( archetypeLanguages ) )
+        {
+            languages.addAll( Arrays.asList( StringUtils.split( archetypeLanguages, "," ) ) );
+        }
+
+        try
+        {
+            ArchetypeRegistry registry = readArchetypeRegistry( archetypeRegistryFile );
+
+            languages.addAll( registry.getLanguages() );
+        }
+        catch ( IOException e )
+        {
+            getLogger().warn( "Can not read ~/.m2/archetype.xml" );
+        }
+        catch ( XmlPullParserException e )
+        {
+            getLogger().warn( "Can not read ~/.m2/archetype.xml" );
+        }
+
+        if ( languages.isEmpty() )
+        {
+            languages.addAll( Constants.DEFAULT_LANGUAGES );
+        }
+
+        return languages;
+    }
+
+    public ArchetypeRegistry readArchetypeRegistry( File archetypeRegistryFile )
+        throws IOException, XmlPullParserException
+    {
+        if ( !archetypeRegistryFile.exists() )
+        {
+            return getDefaultArchetypeRegistry();
+        }
+        else
+        {
+            return readArchetypeRegistry( new FileReader( archetypeRegistryFile ) );
+        }
+    }
+
+    public ArchetypeRegistry readArchetypeRegistry( Reader reader )
+        throws IOException, XmlPullParserException
+    {
+        ArchetypeRegistryXpp3Reader xpp3Reader = new ArchetypeRegistryXpp3Reader();
+
+        try
+        {
+            return xpp3Reader.read( reader );
+        }
+        finally
+        {
+            IOUtil.close( reader );
+        }
+    }
+
+    public void writeArchetypeRegistry(
+        File archetypeRegistryFile,
+        ArchetypeRegistry archetypeRegistry
+    )
+        throws IOException
+    {
+        ArchetypeRegistryXpp3Writer writer = new ArchetypeRegistryXpp3Writer();
+        FileWriter fileWriter = new FileWriter( archetypeRegistryFile );
+
+        try
+        {
+            writer.write( fileWriter, archetypeRegistry );
+        }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
+    }
+
+    /**
+     * Code stealed from MavenArchetypeMojo
+     * (org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha4).
+     */
+    public ArtifactRepository createRepository( String url,
+                                                String repositoryId )
+    {
+        // snapshots vs releases
+        // offline = to turning the update policy off
+
+        // TODO: we'll need to allow finer grained creation of repositories but this will do for now
+
+        String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
+
+        String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
+
+        ArtifactRepositoryPolicy snapshotsPolicy =
+            new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
+
+        ArtifactRepositoryPolicy releasesPolicy =
+            new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
+
+        return
+            artifactRepositoryFactory.createArtifactRepository(
+                repositoryId,
+                url,
+                defaultArtifactRepositoryLayout,
+                snapshotsPolicy,
+                releasesPolicy
+            );
+    }
+
+    public ArchetypeRegistry getDefaultArchetypeRegistry()
+    {
+        ArchetypeRegistry registry = new ArchetypeRegistry();
+
+        registry.getLanguages().addAll( Constants.DEFAULT_LANGUAGES );
+
+        registry.getFilteredExtensions().addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );
+
+        return registry;
+    }
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
index 3c18042..aad5dca 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
@@ -1,576 +1,521 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.common.util.FileCharsetDetector;

-import org.apache.maven.archetype.common.util.Format;

-import org.apache.maven.archetype.exception.InvalidPackaging;

-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;

-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;

-import org.apache.maven.model.Model;

-import org.apache.maven.model.Parent;

-import org.apache.maven.model.Dependency;

-import org.apache.maven.model.Build;

-import org.apache.maven.model.Profile;

-import org.apache.maven.model.ModelBase;

-import org.apache.maven.model.Reporting;

-import org.apache.maven.model.ReportPlugin;

-import org.apache.maven.model.BuildBase;

-import org.apache.maven.model.Plugin;

-import org.codehaus.plexus.logging.AbstractLogEnabled;

-import org.codehaus.plexus.util.FileUtils;

-import org.codehaus.plexus.util.IOUtil;

-import org.codehaus.plexus.util.StringUtils;

-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

-import org.codehaus.plexus.util.xml.Xpp3DomUtils;

-import org.codehaus.plexus.util.xml.Xpp3Dom;

-import org.dom4j.Document;

-import org.dom4j.DocumentException;

-import org.dom4j.Element;

-import org.dom4j.Node;

-import org.dom4j.io.SAXReader;

-import org.dom4j.io.XMLWriter;

-import org.jdom.JDOMException;

-import org.jdom.input.SAXBuilder;

-

-import java.io.File;

-import java.io.FileInputStream;

-import java.io.FileNotFoundException;

-import java.io.FileOutputStream;

-import java.io.FileReader;

-import java.io.IOException;

-import java.io.InputStream;

-import java.io.InputStreamReader;

-import java.io.OutputStreamWriter;

-import java.io.Reader;

-import java.io.StringWriter;

-import java.io.Writer;

-import java.util.*;

-

-/** @plexus.component */

-public class DefaultPomManager

-    extends AbstractLogEnabled

-    implements PomManager

-{

-    public void addModule( File pom,

-                           String artifactId )

-        throws

-        IOException,

-        XmlPullParserException,

-        DocumentException,

-        InvalidPackaging

-    {

-        boolean found = false;

-

-        StringWriter writer = new StringWriter();

-        Reader fileReader = new FileReader( pom );

-

-        try

-        {

-            fileReader = new FileReader( pom );

-

-            SAXReader reader = new SAXReader();

-            Document document = reader.read( fileReader );

-            Element project = document.getRootElement();

-

-            String packaging = null;

-            Element packagingElement = project.element( "packaging" );

-            if ( packagingElement != null )

-            {

-                packaging = packagingElement.getStringValue();

-            }

-            if ( !"pom".equals( packaging ) )

-            {

-                throw new InvalidPackaging(

-                    "Unable to add module to the current project as it is not of packaging type 'pom'"

-                );

-            }

-

-            Element modules = project.element( "modules" );

-            if ( modules == null )

-            {

-                modules = project.addText( "  " ).addElement( "modules" );

-                modules.setText( "\n  " );

-                project.addText( "\n" );

-            }

-            // TODO: change to while loop

-            for ( Iterator i = modules.elementIterator( "module" ); i.hasNext() && !found; )

-            {

-                Element module = (Element) i.next();

-                if ( module.getText().equals( artifactId ) )

-                {

-                    found = true;

-                }

-            }

-            if ( !found )

-            {

-                Node lastTextNode = null;

-                for ( Iterator i = modules.nodeIterator(); i.hasNext(); )

-                {

-                    Node node = (Node) i.next();

-                    if ( node.getNodeType() == Node.ELEMENT_NODE )

-                    {

-                        lastTextNode = null;

-                    }

-                    else if ( node.getNodeType() == Node.TEXT_NODE )

-                    {

-                        lastTextNode = node;

-                    }

-                }

-

-                if ( lastTextNode != null )

-                {

-                    modules.remove( lastTextNode );

-                }

-

-                modules.addText( "\n    " );

-                modules.addElement( "module" ).setText( artifactId );

-                modules.addText( "\n  " );

-

-                XMLWriter xmlWriter = new XMLWriter( writer );

-                xmlWriter.write( document );

-

-                FileUtils.fileWrite( pom.getAbsolutePath(), writer.toString() );

-            } // end if

-        }

-        finally

-        {

-            IOUtil.close( fileReader );

-        }

-    }

-

-    public void addParent( File pom,

-                           File parentPom )

-        throws

-        IOException,

-        XmlPullParserException

-    {

-        Model generatedModel = readPom( pom );

-        if( null != generatedModel.getParent() )

-        {

-            getLogger().info( "Parent element not overwrited in " + pom );

-            return;

-        }

-

-        Model parentModel = readPom( parentPom );

-

-        Parent parent = new Parent();

-        parent.setGroupId( parentModel.getGroupId() );

-        if ( parent.getGroupId() == null )

-        {

-            parent.setGroupId( parentModel.getParent().getGroupId() );

-        }

-        parent.setArtifactId( parentModel.getArtifactId() );

-        parent.setVersion( parentModel.getVersion() );

-        if ( parent.getVersion() == null )

-        {

-            parent.setVersion( parentModel.getParent().getVersion() );

-        }

-        generatedModel.setParent( parent );

-

-        writePom( generatedModel, pom, pom );

-    }

-

-    public void mergePoms( File pom,

-                           File temporaryPom )

-        throws

-        IOException,

-        XmlPullParserException

-    {

-        Model model = readPom( pom );

-        Model generatedModel = readPom( temporaryPom );

-

-        model.getProperties().putAll( generatedModel.getProperties() );

-

-        mergeModelBase( model, generatedModel );

-        mergeModelBuild( model, generatedModel );

-        mergeProfiles( model, generatedModel );

-        mergeReportPlugins( model, generatedModel );

-

-//

-//        // Potential merging

-//

-//        model.getModelEncoding ();

-//        model.getModelVersion ();

-//

-//        model.getGroupId ();

-//        model.getArtifactId ();

-//        model.getVersion ();

-//        model.getParent ();

-//

-//        model.getId ();

-//        model.getName ();

-//        model.getInceptionYear ();

-//        model.getDescription ();

-//        model.getUrl ();

-//        model.getLicenses ();

-//        model.getProperties ();

-//

-//        model.getOrganization ();

-//        model.getMailingLists ();

-//        model.getContributors ();

-//        model.getDevelopers ();

-//

-//        model.getScm ();

-//        model.getCiManagement ();

-//        model.getDistributionManagement ();

-//        model.getIssueManagement ();

-//

-//        model.getPackaging ();

-////        model.getDependencies (); // done

-//        model.getDependencyManagement ();

-//        model.getPrerequisites ().getMaven ();

-//        model.getPrerequisites ().getModelEncoding ();

-//

-//        model.getProfiles ();

-//        model.getModules ();

-//        model.getRepositories ();

-//        model.getPluginRepositories ();

-//

-//        model.getBuild ().getDefaultGoal ();

-//        model.getBuild ().getFinalName ();

-//        model.getBuild ().getModelEncoding ();

-//        model.getBuild ().getFilters ();

-//        model.getBuild ().getDirectory ();

-//        model.getBuild ().getOutputDirectory ();

-//        model.getBuild ().getSourceDirectory ();

-//        model.getBuild ().getResources ();

-//        model.getBuild ().getScriptSourceDirectory ();

-//        model.getBuild ().getTestOutputDirectory ();

-//        model.getBuild ().getTestResources ();

-//        model.getBuild ().getTestSourceDirectory ();

-//        model.getBuild ().getPluginManagement ();

-//        model.getBuild ().getExtensions ();

-////        model.getBuild ().getPluginsAsMap (); // done

-//

-//        model.getReporting ().getModelEncoding ();

-//        model.getReporting ().getOutputDirectory ();

-////        model.getReporting ().getReportPluginsAsMap (); // done

-//

-

-        writePom( model, pom, pom );

-    }

-

-    public Model readPom( final File pomFile )

-        throws

-        IOException,

-        XmlPullParserException

-    { // TODO ensure correct encoding by using default one from method argument !!!

-

-        Model model;

-        Reader pomReader = null;

-        try

-        {

-            FileCharsetDetector detector = new FileCharsetDetector( pomFile );

-

-            String fileEncoding = detector.isFound() ? detector.getCharset() : "UTF-8";

-

-            pomReader = new InputStreamReader( new FileInputStream( pomFile ), fileEncoding );

-

-            MavenXpp3Reader reader = new MavenXpp3Reader();

-

-            model = reader.read( pomReader );

-

-            if ( StringUtils.isEmpty( model.getModelEncoding() ) )

-            {

-                model.setModelEncoding( fileEncoding );

-            }

-        }

-        finally

-        {

-            IOUtil.close( pomReader );

-            pomReader = null;

-        }

-        return model;

-    }

-

-

-    public Model readPom( InputStream pomStream )

-        throws

-        IOException,

-        XmlPullParserException

-    { // TODO ensure correct encoding by using default one from method argument !!!

-

-        Model model;

-        Reader pomReader = null;

-        try

-        {

-//            FileCharsetDetector detector = new FileCharsetDetector( pomStream );

-

-            String fileEncoding = /*detector.isFound() ? detector.getCharset() :*/ "UTF-8";

-

-            pomReader = new InputStreamReader( pomStream, fileEncoding );

-

-            MavenXpp3Reader reader = new MavenXpp3Reader();

-

-            model = reader.read( pomReader );

-

-            if ( StringUtils.isEmpty( model.getModelEncoding() ) )

-            {

-                model.setModelEncoding( fileEncoding );

-            }

-        }

-        finally

-        {

-            IOUtil.close( pomReader );

-            pomReader = null;

-        }

-        return model;

-    }

-

-    public void writePom( final Model model,

-                          final File pomFile,

-                          final File initialPomFile )

-        throws

-        IOException

-    {

-        InputStream inputStream = null;

-        Writer outputStreamWriter = null;

-//        FileCharsetDetector detector = new FileCharsetDetector ( pomFile );

-

-        String fileEncoding =

-            StringUtils.isEmpty( model.getModelEncoding() ) ? model.getModelEncoding() : "UTF-8";

-

-        try

-        {

-            inputStream = new FileInputStream( initialPomFile );

-

-            SAXBuilder builder = new SAXBuilder();

-            org.jdom.Document doc = builder.build( inputStream );

-            inputStream.close();

-            inputStream = null;

-

-            // The cdata parts of the pom are not preserved from initial to target

-            MavenJDOMWriter writer = new MavenJDOMWriter();

-

-            outputStreamWriter =

-                new OutputStreamWriter( new FileOutputStream( pomFile ), fileEncoding );

-

-            Format form = Format.getRawFormat().setEncoding( fileEncoding );

-            writer.write( model, doc, outputStreamWriter, form );

-            outputStreamWriter.close();

-            outputStreamWriter = null;

-        }

-        catch ( JDOMException exc )

-        {

-            throw (IOException) new IOException( "Cannot parse the POM by JDOM." );

-        }

-        catch ( FileNotFoundException e )

-        {

-            getLogger().debug( "Creating pom file " + pomFile );

-

-            Writer pomWriter = null;

-

-            try

-            {

-//                pomWriter = new FileWriter ( pomFile );

-                pomWriter =

-                    new OutputStreamWriter( new FileOutputStream( pomFile ), fileEncoding );

-

-                MavenXpp3Writer writer = new MavenXpp3Writer();

-                writer.write( pomWriter, model );

-                pomWriter.close();

-                pomWriter = null;

-            }

-            finally

-            {

-                IOUtil.close( pomWriter );

-            }

-        }

-        finally

-        {

-            IOUtil.close( inputStream );

-            IOUtil.close( outputStreamWriter );

-        }

-    }

-

-    private Map createDependencyMap( List dependencies )

-    {

-        Map dependencyMap = new HashMap();

-        Iterator dependenciesIterator = dependencies.iterator();

-        while ( dependenciesIterator.hasNext() )

-        {

-            Dependency dependency = (Dependency) dependenciesIterator.next();

-

-            dependencyMap.put(

-                dependency.getManagementKey(),

-                dependency

-            );

-        }

-

-        return dependencyMap;

-    }

-

-    private void mergeModelBuild( Model model, Model generatedModel )

-    {

-        if ( generatedModel.getBuild() != null )

-        {

-            if ( model.getBuild() == null )

-            {

-                model.setBuild( new Build() );

-            }

-

-            mergeBuildPlugins( model.getBuild(), generatedModel.getBuild() );

-        }

-    }

-

-    private void mergeProfiles( Model model, Model generatedModel )

-    {

-        List generatedProfiles = generatedModel.getProfiles();

-        if ( generatedProfiles != null && generatedProfiles.size() > 0 )

-        {

-            List modelProfiles = model.getProfiles();

-            Map modelProfileIdMap = new HashMap();

-            if ( modelProfiles == null )

-            {

-                modelProfiles = new ArrayList();

-                model.setProfiles( modelProfiles );

-            }

-            else if ( modelProfiles.size() > 0 )

-            {

-                // add profile ids from the model for later lookups to the modelProfileIds set

-                Iterator modelProfilesIterator = modelProfiles.iterator();

-                while ( modelProfilesIterator.hasNext() )

-                {

-                    Profile modelProfile = (Profile) modelProfilesIterator.next();

-                    modelProfileIdMap.put( modelProfile.getId(), modelProfile );

-                }

-            }

-

-            Iterator generatedProfilesIterator = generatedProfiles.iterator();

-            while ( generatedProfilesIterator.hasNext() )

-            {

-                Profile generatedProfile = (Profile) generatedProfilesIterator.next();

-                String generatedProfileId = generatedProfile.getId();

-                if ( !modelProfileIdMap.containsKey( generatedProfileId ) )

-                {

-                    model.addProfile( generatedProfile );

-                }

-                else

-                {

-                    getLogger().warn( "Try to merge profiles with id " + generatedProfileId );

-                    mergeModelBase( (Profile) modelProfileIdMap.get( generatedProfileId ), generatedProfile );

-                    mergeProfileBuild( (Profile) modelProfileIdMap.get( generatedProfileId ), generatedProfile );

-                }

-            }

-        }

-    }

-

-    private void mergeProfileBuild( Profile modelProfile, Profile generatedProfile )

-    {

-        if ( generatedProfile.getBuild() != null )

-        {

-            if ( modelProfile.getBuild() == null )

-            {

-                modelProfile.setBuild( new Build() );

-            }

-            mergeBuildPlugins( modelProfile.getBuild(), generatedProfile.getBuild() );

-            // TODO: merge more than just plugins in the profile...

-        }

-    }

-

-    private void mergeModelBase( ModelBase model, ModelBase generatedModel )

-    {

-        // ModelBase can be a Model or a Profile...

-

-        Map dependenciesByIds = createDependencyMap( model.getDependencies() );

-        Map generatedDependenciesByIds = createDependencyMap( generatedModel.getDependencies() );

-

-        Iterator generatedDependencyIds = generatedDependenciesByIds.keySet().iterator();

-        while ( generatedDependencyIds.hasNext() )

-        {

-            String generatedDependencyId = (String) generatedDependencyIds.next();

-

-            if ( !dependenciesByIds.containsKey( generatedDependencyId ) )

-            {

-                model.addDependency(

-                    (Dependency) generatedDependenciesByIds.get( generatedDependencyId )

-                );

-            }

-            else

-            {

-                getLogger().warn( "Can not override property: " + generatedDependencyId );

-            }

-

-        // TODO: maybe warn, if a property key gets overriden?

-        model.getProperties().putAll( generatedModel.getProperties() );

-

-        // TODO: maybe merge more than just dependencies and properties...

-        }

-    }

-

-    private void mergeReportPlugins( Model model,

-                                     Model generatedModel )

-    {

-        if ( generatedModel.getReporting() != null )

-        {

-            if ( model.getReporting() == null )

-            {

-                model.setReporting( new Reporting() );

-            }

-

-            Map reportPluginsByIds = model.getReporting().getReportPluginsAsMap();

-            Map generatedReportPluginsByIds =

-                generatedModel.getReporting().getReportPluginsAsMap();

-

-            Iterator generatedReportPluginsIds = generatedReportPluginsByIds.keySet().iterator();

-            while ( generatedReportPluginsIds.hasNext() )

-            {

-                String generatedReportPluginsId = (String) generatedReportPluginsIds.next();

-

-                if ( !reportPluginsByIds.containsKey( generatedReportPluginsId ) )

-                {

-                    model.getReporting().addPlugin(

-                        (ReportPlugin) generatedReportPluginsByIds.get( generatedReportPluginsId )

-                    );

-                }

-                else

-                {

-                    getLogger().warn( "Can not override report: " + generatedReportPluginsId );

-                }

-            }

-        }

-    }

-    private void mergeBuildPlugins( BuildBase modelBuild, BuildBase generatedModelBuild )

-    {

-        Map pluginsByIds = modelBuild.getPluginsAsMap();

-        List generatedPlugins = generatedModelBuild.getPlugins();

-

-        Iterator generatedPluginsIterator = generatedPlugins.iterator();

-        while ( generatedPluginsIterator.hasNext() )

-        {

-            Plugin generatedPlugin = (Plugin) generatedPluginsIterator.next();

-            String generatedPluginsId = generatedPlugin.getKey();

-

-            if ( !pluginsByIds.containsKey( generatedPluginsId ) )

-            {

-                modelBuild.addPlugin( generatedPlugin );

-            }

-            else

-            {

-                getLogger().info( "Try to merge plugin configuration of plugins with id: " + generatedPluginsId );

-                Plugin modelPlugin = (Plugin) pluginsByIds.get( generatedPluginsId );

-

-                modelPlugin.setConfiguration( Xpp3DomUtils.mergeXpp3Dom( (Xpp3Dom) generatedPlugin.getConfiguration(),

-                                                                         (Xpp3Dom) modelPlugin.getConfiguration() ) );

-            }

-        }

-    }

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.common.util.Format;
+import org.apache.maven.archetype.exception.InvalidPackaging;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.ModelBase;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.Plugin;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.util.xml.Xpp3DomUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/** @plexus.component */
+public class DefaultPomManager
+    extends AbstractLogEnabled
+    implements PomManager
+{
+    public void addModule( File pom, String artifactId )
+        throws IOException, XmlPullParserException, DocumentException, InvalidPackaging
+    {
+        boolean found = false;
+
+        StringWriter writer = new StringWriter();
+        Reader fileReader = null;
+
+        try
+        {
+            fileReader = ReaderFactory.newXmlReader( pom );
+
+            SAXReader reader = new SAXReader();
+            Document document = reader.read( fileReader );
+            Element project = document.getRootElement();
+
+            String packaging = null;
+            Element packagingElement = project.element( "packaging" );
+            if ( packagingElement != null )
+            {
+                packaging = packagingElement.getStringValue();
+            }
+            if ( !"pom".equals( packaging ) )
+            {
+                throw new InvalidPackaging(
+                    "Unable to add module to the current project as it is not of packaging type 'pom'"
+                );
+            }
+
+            Element modules = project.element( "modules" );
+            if ( modules == null )
+            {
+                modules = project.addText( "  " ).addElement( "modules" );
+                modules.setText( "\n  " );
+                project.addText( "\n" );
+            }
+            // TODO: change to while loop
+            for ( Iterator i = modules.elementIterator( "module" ); i.hasNext() && !found; )
+            {
+                Element module = (Element) i.next();
+                if ( module.getText().equals( artifactId ) )
+                {
+                    found = true;
+                }
+            }
+            if ( !found )
+            {
+                Node lastTextNode = null;
+                for ( Iterator i = modules.nodeIterator(); i.hasNext(); )
+                {
+                    Node node = (Node) i.next();
+                    if ( node.getNodeType() == Node.ELEMENT_NODE )
+                    {
+                        lastTextNode = null;
+                    }
+                    else if ( node.getNodeType() == Node.TEXT_NODE )
+                    {
+                        lastTextNode = node;
+                    }
+                }
+
+                if ( lastTextNode != null )
+                {
+                    modules.remove( lastTextNode );
+                }
+
+                modules.addText( "\n    " );
+                modules.addElement( "module" ).setText( artifactId );
+                modules.addText( "\n  " );
+
+                XMLWriter xmlWriter = new XMLWriter( writer );
+                xmlWriter.write( document );
+
+                FileUtils.fileWrite( pom.getAbsolutePath(), writer.toString() );
+            } // end if
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+    }
+
+    public void addParent( File pom, File parentPom )
+        throws IOException, XmlPullParserException
+    {
+        Model generatedModel = readPom( pom );
+        if ( null != generatedModel.getParent() )
+        {
+            getLogger().info( "Parent element not overwritten in " + pom );
+            return;
+        }
+
+        Model parentModel = readPom( parentPom );
+
+        Parent parent = new Parent();
+        parent.setGroupId( parentModel.getGroupId() );
+        if ( parent.getGroupId() == null )
+        {
+            parent.setGroupId( parentModel.getParent().getGroupId() );
+        }
+        parent.setArtifactId( parentModel.getArtifactId() );
+        parent.setVersion( parentModel.getVersion() );
+        if ( parent.getVersion() == null )
+        {
+            parent.setVersion( parentModel.getParent().getVersion() );
+        }
+        generatedModel.setParent( parent );
+
+        writePom( generatedModel, pom, pom );
+    }
+
+    public void mergePoms( File pom, File temporaryPom )
+        throws IOException, XmlPullParserException
+    {
+        Model model = readPom( pom );
+        Model generatedModel = readPom( temporaryPom );
+
+        model.getProperties().putAll( generatedModel.getProperties() );
+
+        mergeModelBase( model, generatedModel );
+        mergeModelBuild( model, generatedModel );
+        mergeProfiles( model, generatedModel );
+        mergeReportPlugins( model, generatedModel );
+
+//
+//        // Potential merging
+//
+//        model.getModelEncoding ();
+//        model.getModelVersion ();
+//
+//        model.getGroupId ();
+//        model.getArtifactId ();
+//        model.getVersion ();
+//        model.getParent ();
+//
+//        model.getId ();
+//        model.getName ();
+//        model.getInceptionYear ();
+//        model.getDescription ();
+//        model.getUrl ();
+//        model.getLicenses ();
+//        model.getProperties ();
+//
+//        model.getOrganization ();
+//        model.getMailingLists ();
+//        model.getContributors ();
+//        model.getDevelopers ();
+//
+//        model.getScm ();
+//        model.getCiManagement ();
+//        model.getDistributionManagement ();
+//        model.getIssueManagement ();
+//
+//        model.getPackaging ();
+////        model.getDependencies (); // done
+//        model.getDependencyManagement ();
+//        model.getPrerequisites ().getMaven ();
+//        model.getPrerequisites ().getModelEncoding ();
+//
+//        model.getProfiles ();
+//        model.getModules ();
+//        model.getRepositories ();
+//        model.getPluginRepositories ();
+//
+//        model.getBuild ().getDefaultGoal ();
+//        model.getBuild ().getFinalName ();
+//        model.getBuild ().getModelEncoding ();
+//        model.getBuild ().getFilters ();
+//        model.getBuild ().getDirectory ();
+//        model.getBuild ().getOutputDirectory ();
+//        model.getBuild ().getSourceDirectory ();
+//        model.getBuild ().getResources ();
+//        model.getBuild ().getScriptSourceDirectory ();
+//        model.getBuild ().getTestOutputDirectory ();
+//        model.getBuild ().getTestResources ();
+//        model.getBuild ().getTestSourceDirectory ();
+//        model.getBuild ().getPluginManagement ();
+//        model.getBuild ().getExtensions ();
+////        model.getBuild ().getPluginsAsMap (); // done
+//
+//        model.getReporting ().getModelEncoding ();
+//        model.getReporting ().getOutputDirectory ();
+////        model.getReporting ().getReportPluginsAsMap (); // done
+//
+
+        writePom( model, pom, pom );
+    }
+
+    public Model readPom( final File pomFile )
+        throws IOException, XmlPullParserException
+    {
+        Model model;
+        Reader pomReader = null;
+        try
+        {
+            pomReader = ReaderFactory.newXmlReader( pomFile );
+
+            MavenXpp3Reader reader = new MavenXpp3Reader();
+
+            model = reader.read( pomReader );
+        }
+        finally
+        {
+            IOUtil.close( pomReader );
+        }
+        return model;
+    }
+
+
+    public Model readPom( InputStream pomStream )
+        throws IOException, XmlPullParserException
+    {
+        Reader pomReader = ReaderFactory.newXmlReader( pomStream );
+
+        MavenXpp3Reader reader = new MavenXpp3Reader();
+
+        return reader.read( pomReader );
+    }
+
+    public void writePom( final Model model, final File pomFile, final File initialPomFile )
+        throws IOException
+    {
+        InputStream inputStream = null;
+        Writer outputStreamWriter = null;
+
+        String fileEncoding =
+            StringUtils.isEmpty( model.getModelEncoding() ) ? "UTF-8" : model.getModelEncoding();
+
+        try
+        {
+            inputStream = new FileInputStream( initialPomFile );
+
+            SAXBuilder builder = new SAXBuilder();
+            org.jdom.Document doc = builder.build( inputStream );
+            inputStream.close();
+            inputStream = null;
+
+            // The cdata parts of the pom are not preserved from initial to target
+            MavenJDOMWriter writer = new MavenJDOMWriter();
+
+            outputStreamWriter =
+                new OutputStreamWriter( new FileOutputStream( pomFile ), fileEncoding );
+
+            Format form = Format.getRawFormat().setEncoding( fileEncoding );
+            writer.write( model, doc, outputStreamWriter, form );
+        }
+        catch ( JDOMException exc )
+        {
+            throw (IOException) new IOException( "Cannot parse the POM by JDOM." );
+        }
+        catch ( FileNotFoundException e )
+        {
+            getLogger().debug( "Creating pom file " + pomFile );
+
+            Writer pomWriter = null;
+
+            try
+            {
+                pomWriter =
+                    new OutputStreamWriter( new FileOutputStream( pomFile ), fileEncoding );
+
+                MavenXpp3Writer writer = new MavenXpp3Writer();
+                writer.write( pomWriter, model );
+            }
+            finally
+            {
+                IOUtil.close( pomWriter );
+            }
+        }
+        finally
+        {
+            IOUtil.close( inputStream );
+            IOUtil.close( outputStreamWriter );
+        }
+    }
+
+    private Map createDependencyMap( List dependencies )
+    {
+        Map dependencyMap = new HashMap();
+        Iterator dependenciesIterator = dependencies.iterator();
+        while ( dependenciesIterator.hasNext() )
+        {
+            Dependency dependency = (Dependency) dependenciesIterator.next();
+
+            dependencyMap.put(
+                dependency.getManagementKey(),
+                dependency
+            );
+        }
+
+        return dependencyMap;
+    }
+
+    private void mergeModelBuild( Model model, Model generatedModel )
+    {
+        if ( generatedModel.getBuild() != null )
+        {
+            if ( model.getBuild() == null )
+            {
+                model.setBuild( new Build() );
+            }
+
+            mergeBuildPlugins( model.getBuild(), generatedModel.getBuild() );
+        }
+    }
+
+    private void mergeProfiles( Model model, Model generatedModel )
+    {
+        List generatedProfiles = generatedModel.getProfiles();
+        if ( generatedProfiles != null && generatedProfiles.size() > 0 )
+        {
+            List modelProfiles = model.getProfiles();
+            Map modelProfileIdMap = new HashMap();
+            if ( modelProfiles == null )
+            {
+                modelProfiles = new ArrayList();
+                model.setProfiles( modelProfiles );
+            }
+            else if ( modelProfiles.size() > 0 )
+            {
+                // add profile ids from the model for later lookups to the modelProfileIds set
+                Iterator modelProfilesIterator = modelProfiles.iterator();
+                while ( modelProfilesIterator.hasNext() )
+                {
+                    Profile modelProfile = (Profile) modelProfilesIterator.next();
+                    modelProfileIdMap.put( modelProfile.getId(), modelProfile );
+                }
+            }
+
+            Iterator generatedProfilesIterator = generatedProfiles.iterator();
+            while ( generatedProfilesIterator.hasNext() )
+            {
+                Profile generatedProfile = (Profile) generatedProfilesIterator.next();
+                String generatedProfileId = generatedProfile.getId();
+                if ( !modelProfileIdMap.containsKey( generatedProfileId ) )
+                {
+                    model.addProfile( generatedProfile );
+                }
+                else
+                {
+                    getLogger().warn( "Try to merge profiles with id " + generatedProfileId );
+                    mergeModelBase( (Profile) modelProfileIdMap.get( generatedProfileId ), generatedProfile );
+                    mergeProfileBuild( (Profile) modelProfileIdMap.get( generatedProfileId ), generatedProfile );
+                }
+            }
+        }
+    }
+
+    private void mergeProfileBuild( Profile modelProfile, Profile generatedProfile )
+    {
+        if ( generatedProfile.getBuild() != null )
+        {
+            if ( modelProfile.getBuild() == null )
+            {
+                modelProfile.setBuild( new Build() );
+            }
+            mergeBuildPlugins( modelProfile.getBuild(), generatedProfile.getBuild() );
+            // TODO: merge more than just plugins in the profile...
+        }
+    }
+
+    private void mergeModelBase( ModelBase model, ModelBase generatedModel )
+    {
+        // ModelBase can be a Model or a Profile...
+
+        Map dependenciesByIds = createDependencyMap( model.getDependencies() );
+        Map generatedDependenciesByIds = createDependencyMap( generatedModel.getDependencies() );
+
+        Iterator generatedDependencyIds = generatedDependenciesByIds.keySet().iterator();
+        while ( generatedDependencyIds.hasNext() )
+        {
+            String generatedDependencyId = (String) generatedDependencyIds.next();
+
+            if ( !dependenciesByIds.containsKey( generatedDependencyId ) )
+            {
+                model.addDependency(
+                    (Dependency) generatedDependenciesByIds.get( generatedDependencyId )
+                );
+            }
+            else
+            {
+                getLogger().warn( "Can not override property: " + generatedDependencyId );
+            }
+
+        // TODO: maybe warn, if a property key gets overridden?
+        model.getProperties().putAll( generatedModel.getProperties() );
+
+        // TODO: maybe merge more than just dependencies and properties...
+        }
+    }
+
+    private void mergeReportPlugins( Model model, Model generatedModel )
+    {
+        if ( generatedModel.getReporting() != null )
+        {
+            if ( model.getReporting() == null )
+            {
+                model.setReporting( new Reporting() );
+            }
+
+            Map reportPluginsByIds = model.getReporting().getReportPluginsAsMap();
+            Map generatedReportPluginsByIds =
+                generatedModel.getReporting().getReportPluginsAsMap();
+
+            Iterator generatedReportPluginsIds = generatedReportPluginsByIds.keySet().iterator();
+            while ( generatedReportPluginsIds.hasNext() )
+            {
+                String generatedReportPluginsId = (String) generatedReportPluginsIds.next();
+
+                if ( !reportPluginsByIds.containsKey( generatedReportPluginsId ) )
+                {
+                    model.getReporting().addPlugin(
+                        (ReportPlugin) generatedReportPluginsByIds.get( generatedReportPluginsId )
+                    );
+                }
+                else
+                {
+                    getLogger().warn( "Can not override report: " + generatedReportPluginsId );
+                }
+            }
+        }
+    }
+    private void mergeBuildPlugins( BuildBase modelBuild, BuildBase generatedModelBuild )
+    {
+        Map pluginsByIds = modelBuild.getPluginsAsMap();
+        List generatedPlugins = generatedModelBuild.getPlugins();
+
+        Iterator generatedPluginsIterator = generatedPlugins.iterator();
+        while ( generatedPluginsIterator.hasNext() )
+        {
+            Plugin generatedPlugin = (Plugin) generatedPluginsIterator.next();
+            String generatedPluginsId = generatedPlugin.getKey();
+
+            if ( !pluginsByIds.containsKey( generatedPluginsId ) )
+            {
+                modelBuild.addPlugin( generatedPlugin );
+            }
+            else
+            {
+                getLogger().info( "Try to merge plugin configuration of plugins with id: " + generatedPluginsId );
+                Plugin modelPlugin = (Plugin) pluginsByIds.get( generatedPluginsId );
+
+                modelPlugin.setConfiguration( Xpp3DomUtils.mergeXpp3Dom( (Xpp3Dom) generatedPlugin.getConfiguration(),
+                                                                         (Xpp3Dom) modelPlugin.getConfiguration() ) );
+            }
+        }
+    }
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
index 8584f3e..c64e987 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
@@ -1,3193 +1,3193 @@
-/*

- * 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.

- */

-

-/*

- * $Id$

- */

-

-package org.apache.maven.archetype.common;

-

-// ---------------------------------/

-// - Imported classes and packages -/

-// ---------------------------------/

-

-import org.apache.maven.archetype.common.util.Format;

-import org.apache.maven.archetype.common.util.XMLOutputter;

-import org.apache.maven.model.Activation;

-import org.apache.maven.model.ActivationFile;

-import org.apache.maven.model.ActivationOS;

-import org.apache.maven.model.ActivationProperty;

-import org.apache.maven.model.Build;

-import org.apache.maven.model.BuildBase;

-import org.apache.maven.model.CiManagement;

-import org.apache.maven.model.ConfigurationContainer;

-import org.apache.maven.model.Contributor;

-import org.apache.maven.model.Dependency;

-import org.apache.maven.model.DependencyManagement;

-import org.apache.maven.model.DeploymentRepository;

-import org.apache.maven.model.Developer;

-import org.apache.maven.model.DistributionManagement;

-import org.apache.maven.model.Exclusion;

-import org.apache.maven.model.Extension;

-import org.apache.maven.model.FileSet;

-import org.apache.maven.model.IssueManagement;

-import org.apache.maven.model.License;

-import org.apache.maven.model.MailingList;

-import org.apache.maven.model.Model;

-import org.apache.maven.model.ModelBase;

-import org.apache.maven.model.Notifier;

-import org.apache.maven.model.Organization;

-import org.apache.maven.model.Parent;

-import org.apache.maven.model.PatternSet;

-import org.apache.maven.model.Plugin;

-import org.apache.maven.model.PluginConfiguration;

-import org.apache.maven.model.PluginContainer;

-import org.apache.maven.model.PluginExecution;

-import org.apache.maven.model.PluginManagement;

-import org.apache.maven.model.Prerequisites;

-import org.apache.maven.model.Profile;

-import org.apache.maven.model.Relocation;

-import org.apache.maven.model.ReportPlugin;

-import org.apache.maven.model.ReportSet;

-import org.apache.maven.model.Reporting;

-import org.apache.maven.model.Repository;

-import org.apache.maven.model.RepositoryBase;

-import org.apache.maven.model.RepositoryPolicy;

-import org.apache.maven.model.Resource;

-import org.apache.maven.model.Scm;

-import org.apache.maven.model.Site;

-import org.codehaus.plexus.util.xml.Xpp3Dom;

-import org.jdom.Content;

-import org.jdom.DefaultJDOMFactory;

-import org.jdom.Document;

-import org.jdom.Element;

-import org.jdom.Text;

-

-import java.io.OutputStream;

-import java.io.OutputStreamWriter;

-import java.io.Writer;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.ListIterator;

-import java.util.Map;

-

-/**

- * Class MavenJDOMWriter.

- *

- * @version $Revision$ $Date$

- */

-public class MavenJDOMWriter

-{

-    // --------------------------/

-    // - Class/Member Variables -/

-    // --------------------------/

-

-    /** Field factory. */

-    private DefaultJDOMFactory factory;

-

-    /** Field lineSeparator. */

-    private String lineSeparator;

-

-    // ----------------/

-    // - Constructors -/

-    // ----------------/

-

-    public MavenJDOMWriter()

-    {

-        factory = new DefaultJDOMFactory();

-        lineSeparator = "\n";

-    } // -- org.apache.maven.model.io.jdom.MavenJDOMWriter()

-

-    /**

-     * Method write.

-     *

-     * @param project

-     * @param stream

-     * @param document

-     * @deprecated

-     */

-    public void write( Model project,

-                       Document document,

-                       OutputStream stream )

-        throws

-        java.io.IOException

-    {

-        updateModel( project, "project", new Counter( 0 ), document.getRootElement() );

-

-        XMLOutputter outputter = new XMLOutputter();

-        outputter.setFormat(

-            Format.getPrettyFormat().setIndent( "    " ).setLineSeparator(

-                System.getProperty( "line.separator" )

-            )

-        );

-        outputter.output( document, stream );

-    } // -- void write(Model, Document, OutputStream)

-

-    /**

-     * Method write.

-     *

-     * @param project

-     * @param writer

-     * @param document

-     */

-    public void write( Model project,

-                       Document document,

-                       OutputStreamWriter writer )

-        throws

-        java.io.IOException

-    {

-        Format format =

-            Format.getRawFormat().setEncoding( writer.getEncoding() ).setLineSeparator(

-                System.getProperty( "line.separator" )

-            );

-        write( project, document, writer, format );

-    } // -- void write(Model, Document, OutputStreamWriter)

-

-    /**

-     * Method write.

-     *

-     * @param project

-     * @param jdomFormat

-     * @param writer

-     * @param document

-     */

-    public void write( Model project,

-                       Document document,

-                       Writer writer,

-                       Format jdomFormat )

-        throws

-        java.io.IOException

-    {

-        updateModel( project, "project", new Counter( 0 ), document.getRootElement() );

-

-        XMLOutputter outputter = new XMLOutputter();

-        outputter.setFormat( jdomFormat );

-        outputter.output( document, writer );

-    } // -- void write(Model, Document, Writer, Format)

-

-    // -----------/

-    // - Methods -/

-    // -----------/

-

-    /**

-     * Method findAndReplaceProperties.

-     *

-     * @param counter

-     * @param props

-     * @param name

-     * @param parent

-     */

-    protected Element findAndReplaceProperties(

-        Counter counter,

-        Element parent,

-        String name,

-        Map props

-    )

-    {

-        boolean shouldExist = ( props != null ) && !props.isEmpty();

-        Element element = updateElement( counter, parent, name, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = props.keySet().iterator();

-            Counter innerCounter = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                String key = (String) it.next();

-                findAndReplaceSimpleElement(

-                    innerCounter,

-                    element,

-                    key,

-                    (String) props.get( key ),

-                    null

-                );

-            }

-

-            ArrayList lst = new ArrayList( props.keySet() );

-            it = element.getChildren().iterator();

-            while ( it.hasNext() )

-            {

-                Element elem = (Element) it.next();

-                String key = elem.getName();

-                if ( !lst.contains( key ) )

-                {

-                    it.remove();

-                }

-            }

-        }

-        return element;

-    } // -- Element findAndReplaceProperties(Counter, Element, String, Map)

-

-    /**

-     * Method findAndReplaceSimpleElement.

-     *

-     * @param counter

-     * @param defaultValue

-     * @param text

-     * @param name

-     * @param parent

-     */

-    protected Element findAndReplaceSimpleElement(

-        Counter counter,

-        Element parent,

-        String name,

-        String text,

-        String defaultValue

-    )

-    {

-        if ( ( defaultValue != null ) && ( text != null ) && defaultValue.equals( text ) )

-        {

-            Element element = parent.getChild( name, parent.getNamespace() );

-            // if exist and is default value or if doesn't exist.. just keep the way it is..

-            if ( ( ( element != null ) && defaultValue.equals( element.getText() ) )

-                || ( element == null )

-                )

-            {

-                return element;

-            }

-        }

-

-        boolean shouldExist = ( text != null ) && ( text.trim().length() > 0 );

-        Element element = updateElement( counter, parent, name, shouldExist );

-        if ( shouldExist )

-        {

-            element.setText( text );

-        }

-        return element;

-    } // -- Element findAndReplaceSimpleElement(Counter, Element, String, String, String)

-

-    /**

-     * Method findAndReplaceSimpleLists.

-     *

-     * @param counter

-     * @param childName

-     * @param parentName

-     * @param list

-     * @param parent

-     */

-    protected Element findAndReplaceSimpleLists(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        String parentName,

-        String childName

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentName, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childName, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                String value = (String) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childName, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                el.setText( value );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-        return element;

-    } // -- Element findAndReplaceSimpleLists(Counter, Element, java.util.Collection, String,

-    // String)

-

-    /**

-     * Method findAndReplaceXpp3DOM.

-     *

-     * @param counter

-     * @param dom

-     * @param name

-     * @param parent

-     */

-    protected Element findAndReplaceXpp3DOM(

-        Counter counter,

-        Element parent,

-        String name,

-        Xpp3Dom dom

-    )

-    {

-        boolean shouldExist =

-            ( dom != null ) && ( ( dom.getChildCount() > 0 ) || ( dom.getValue() != null ) );

-        Element element = updateElement( counter, parent, name, shouldExist );

-        if ( shouldExist )

-        {

-            replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) );

-        }

-        return element;

-    } // -- Element findAndReplaceXpp3DOM(Counter, Element, String, Xpp3Dom)

-

-    /**

-     * Method insertAtPreferredLocation.

-     *

-     * @param parent

-     * @param counter

-     * @param child

-     */

-    protected void insertAtPreferredLocation( Element parent,

-                                              Element child,

-                                              Counter counter )

-    {

-        int contentIndex = 0;

-        int elementCounter = 0;

-        Iterator it = parent.getContent().iterator();

-        Text lastText = null;

-        int offset = 0;

-        while ( it.hasNext() && ( elementCounter <= counter.getCurrentIndex() ) )

-        {

-            Object next = it.next();

-            offset = offset + 1;

-            if ( next instanceof Element )

-            {

-                elementCounter = elementCounter + 1;

-                contentIndex = contentIndex + offset;

-                offset = 0;

-            }

-            if ( ( next instanceof Text ) && it.hasNext() )

-            {

-                lastText = (Text) next;

-            }

-        }

-        if ( ( lastText != null ) && ( lastText.getTextTrim().length() == 0 ) )

-        {

-            lastText = (Text) lastText.clone();

-        }

-        else

-        {

-            String starter = lineSeparator;

-            for ( int i = 0; i < counter.getDepth(); i++ )

-            {

-                starter = starter + "    "; // TODO make settable?

-            }

-            lastText = factory.text( starter );

-        }

-        if ( parent.getContentSize() == 0 )

-        {

-            Text finalText = (Text) lastText.clone();

-            finalText.setText(

-                finalText.getText().substring(

-                    0,

-                    finalText.getText().length() - "    ".length()

-                )

-            );

-            parent.addContent( contentIndex, finalText );

-        }

-        parent.addContent( contentIndex, child );

-        parent.addContent( contentIndex, lastText );

-    } // -- void insertAtPreferredLocation(Element, Element, Counter)

-

-    /**

-     * Method iterateContributor.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateContributor(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Contributor value = (Contributor) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateContributor( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateContributor(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateDependency.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateDependency(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Dependency value = (Dependency) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateDependency( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateDependency(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateDeveloper.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateDeveloper(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Developer value = (Developer) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateDeveloper( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateDeveloper(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateExclusion.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateExclusion(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Exclusion value = (Exclusion) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateExclusion( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateExclusion(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateExtension.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateExtension(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Extension value = (Extension) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateExtension( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateExtension(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateLicense.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateLicense(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                License value = (License) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateLicense( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateMailingList.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateMailingList(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                MailingList value = (MailingList) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateMailingList( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateMailingList(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateNotifier.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateNotifier(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Notifier value = (Notifier) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateNotifier( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateNotifier(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iteratePlugin.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iteratePlugin(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Plugin value = (Plugin) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updatePlugin( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iteratePlugin(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iteratePluginExecution.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iteratePluginExecution(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                PluginExecution value = (PluginExecution) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updatePluginExecution( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iteratePluginExecution(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateProfile.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateProfile(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Profile value = (Profile) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateProfile( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateProfile(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateReportPlugin.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateReportPlugin(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                ReportPlugin value = (ReportPlugin) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateReportPlugin( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateReportPlugin(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateReportSet.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateReportSet(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                ReportSet value = (ReportSet) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateReportSet( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateReportSet(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateRepository.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateRepository(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Repository value = (Repository) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateRepository( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateRepository(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method iterateResource.

-     *

-     * @param counter

-     * @param childTag

-     * @param parentTag

-     * @param list

-     * @param parent

-     */

-    protected void iterateResource(

-        Counter counter,

-        Element parent,

-        java.util.Collection list,

-        java.lang.String parentTag,

-        java.lang.String childTag

-    )

-    {

-        boolean shouldExist = ( list != null ) && ( list.size() > 0 );

-        Element element = updateElement( counter, parent, parentTag, shouldExist );

-        if ( shouldExist )

-        {

-            Iterator it = list.iterator();

-            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();

-            if ( !elIt.hasNext() )

-            {

-                elIt = null;

-            }

-

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            while ( it.hasNext() )

-            {

-                Resource value = (Resource) it.next();

-                Element el;

-                if ( ( elIt != null ) && elIt.hasNext() )

-                {

-                    el = (Element) elIt.next();

-                    if ( !elIt.hasNext() )

-                    {

-                        elIt = null;

-                    }

-                }

-                else

-                {

-                    el = factory.element( childTag, element.getNamespace() );

-                    insertAtPreferredLocation( element, el, innerCount );

-                }

-                updateResource( value, childTag, innerCount, el );

-                innerCount.increaseCount();

-            }

-            if ( elIt != null )

-            {

-                while ( elIt.hasNext() )

-                {

-                    elIt.next();

-                    elIt.remove();

-                }

-            }

-        }

-    } // -- void iterateResource(Counter, Element, java.util.Collection, java.lang.String,

-    // java.lang.String)

-

-    /**

-     * Method replaceXpp3DOM.

-     *

-     * @param parent

-     * @param counter

-     * @param parentDom

-     */

-    protected void replaceXpp3DOM( Element parent,

-                                   Xpp3Dom parentDom,

-                                   Counter counter )

-    {

-        if ( parentDom.getChildCount() > 0 )

-        {

-            Xpp3Dom[] childs = parentDom.getChildren();

-            Collection domChilds = new ArrayList();

-            for ( int i = 0; i < childs.length; i++ )

-            {

-                domChilds.add( childs[i] );

-            }

-

-            int domIndex = 0;

-            ListIterator it = parent.getChildren().listIterator();

-            while ( it.hasNext() )

-            {

-                Element elem = (Element) it.next();

-                Iterator it2 = domChilds.iterator();

-                Xpp3Dom corrDom = null;

-                while ( it2.hasNext() )

-                {

-                    Xpp3Dom dm = (Xpp3Dom) it2.next();

-                    if ( dm.getName().equals( elem.getName() ) )

-                    {

-                        corrDom = dm;

-                        break;

-                    }

-                }

-                if ( corrDom != null )

-                {

-                    domChilds.remove( corrDom );

-                    replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) );

-                    counter.increaseCount();

-                }

-                else

-                {

-                    parent.removeContent( elem );

-                }

-            }

-

-            Iterator it2 = domChilds.iterator();

-            while ( it2.hasNext() )

-            {

-                Xpp3Dom dm = (Xpp3Dom) it2.next();

-                Element elem = factory.element( dm.getName(), parent.getNamespace() );

-                insertAtPreferredLocation( parent, elem, counter );

-                counter.increaseCount();

-                replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) );

-            }

-        }

-        else if ( parentDom.getValue() != null )

-        {

-            parent.setText( parentDom.getValue() );

-        }

-    } // -- void replaceXpp3DOM(Element, Xpp3Dom, Counter)

-

-    /**

-     * Method updateActivation.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateActivation(

-        Activation value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "activeByDefault",

-                ( value.isActiveByDefault() == false )

-                    ? null

-                    : String.valueOf( value.isActiveByDefault() ),

-                "false"

-            );

-            findAndReplaceSimpleElement( innerCount, root, "jdk", value.getJdk(), null );

-            updateActivationOS( value.getOs(), "os", innerCount, root );

-            updateActivationProperty( value.getProperty(), "property", innerCount, root );

-            updateActivationFile( value.getFile(), "file", innerCount, root );

-        }

-    } // -- void updateActivation(Activation, String, Counter, Element)

-

-    /**

-     * Method updateActivationFile.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateActivationFile(

-        ActivationFile value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null );

-            findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null );

-        }

-    } // -- void updateActivationFile(ActivationFile, String, Counter, Element)

-

-    /**

-     * Method updateActivationOS.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateActivationOS(

-        ActivationOS value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "family", value.getFamily(), null );

-            findAndReplaceSimpleElement( innerCount, root, "arch", value.getArch(), null );

-            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-        }

-    } // -- void updateActivationOS(ActivationOS, String, Counter, Element)

-

-    /**

-     * Method updateActivationProperty.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateActivationProperty(

-        ActivationProperty value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null );

-        }

-    } // -- void updateActivationProperty(ActivationProperty, String, Counter, Element)

-

-    /**

-     * Method updateBuild.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateBuild( Build value,

-                                String xmlTag,

-                                Counter counter,

-                                Element element )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "sourceDirectory",

-                value.getSourceDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "scriptSourceDirectory",

-                value.getScriptSourceDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "testSourceDirectory",

-                value.getTestSourceDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "outputDirectory",

-                value.getOutputDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "testOutputDirectory",

-                value.getTestOutputDirectory(),

-                null

-            );

-            iterateExtension(

-                innerCount,

-                root,

-                value.getExtensions(),

-                "extensions",

-                "extension"

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "defaultGoal",

-                value.getDefaultGoal(),

-                null

-            );

-            iterateResource( innerCount, root, value.getResources(), "resources", "resource" );

-            iterateResource(

-                innerCount,

-                root,

-                value.getTestResources(),

-                "testResources",

-                "testResource"

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "directory",

-                value.getDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "finalName",

-                value.getFinalName(),

-                null

-            );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getFilters(),

-                "filters",

-                "filter"

-            );

-            updatePluginManagement(

-                value.getPluginManagement(),

-                "pluginManagement",

-                innerCount,

-                root

-            );

-            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        } // end if

-    } // -- void updateBuild(Build, String, Counter, Element)

-

-    /**

-     * Method updateBuildBase.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateBuildBase(

-        BuildBase value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "defaultGoal",

-                value.getDefaultGoal(),

-                null

-            );

-            iterateResource( innerCount, root, value.getResources(), "resources", "resource" );

-            iterateResource(

-                innerCount,

-                root,

-                value.getTestResources(),

-                "testResources",

-                "testResource"

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "directory",

-                value.getDirectory(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "finalName",

-                value.getFinalName(),

-                null

-            );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getFilters(),

-                "filters",

-                "filter"

-            );

-            updatePluginManagement(

-                value.getPluginManagement(),

-                "pluginManagement",

-                innerCount,

-                root

-            );

-            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        }

-    } // -- void updateBuildBase(BuildBase, String, Counter, Element)

-

-    /**

-     * Method updateCiManagement.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateCiManagement(

-        CiManagement value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-            iterateNotifier( innerCount, root, value.getNotifiers(), "notifiers", "notifier" );

-        }

-    } // -- void updateCiManagement(CiManagement, String, Counter, Element)

-

-    /**

-     * Method updateConfigurationContainer.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateConfigurationContainer(

-        ConfigurationContainer value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "inherited",

-                value.getInherited(),

-                null

-            );

-            findAndReplaceXpp3DOM(

-                innerCount,

-                root,

-                "configuration",

-                (Xpp3Dom) value.getConfiguration()

-            );

-        }

-    } // -- void updateConfigurationContainer(ConfigurationContainer, String, Counter, Element)

-

-    /**

-     * Method updateContributor.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateContributor(

-        Contributor value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );

-        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "organization",

-            value.getOrganization(),

-            null

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "organizationUrl",

-            value.getOrganizationUrl(),

-            null

-        );

-        findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );

-        findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );

-        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );

-    } // -- void updateContributor(Contributor, String, Counter, Element)

-

-    /**

-     * Method updateDependency.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateDependency(

-        Dependency value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-        findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "jar" );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "classifier",

-            value.getClassifier(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "scope", value.getScope(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "systemPath",

-            value.getSystemPath(),

-            null

-        );

-        iterateExclusion( innerCount, root, value.getExclusions(), "exclusions", "exclusion" );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "optional",

-            ( value.isOptional() == false ) ? null : String.valueOf( value.isOptional() ),

-            "false"

-        );

-    } // -- void updateDependency(Dependency, String, Counter, Element)

-

-    /**

-     * Method updateDependencyManagement.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateDependencyManagement(

-        DependencyManagement value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            iterateDependency(

-                innerCount,

-                root,

-                value.getDependencies(),

-                "dependencies",

-                "dependency"

-            );

-        }

-    } // -- void updateDependencyManagement(DependencyManagement, String, Counter, Element)

-

-    /**

-     * Method updateDeploymentRepository.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateDeploymentRepository(

-        DeploymentRepository value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "uniqueVersion",

-                ( value.isUniqueVersion() == true ) ? null

-                    : String.valueOf( value.isUniqueVersion() ),

-                "true"

-            );

-            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "layout",

-                value.getLayout(),

-                "default"

-            );

-        }

-    } // -- void updateDeploymentRepository(DeploymentRepository, String, Counter, Element)

-

-    /**

-     * Method updateDeveloper.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateDeveloper(

-        Developer value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );

-        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "organization",

-            value.getOrganization(),

-            null

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "organizationUrl",

-            value.getOrganizationUrl(),

-            null

-        );

-        findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );

-        findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );

-        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );

-    } // -- void updateDeveloper(Developer, String, Counter, Element)

-

-    /**

-     * Method updateDistributionManagement.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateDistributionManagement(

-        DistributionManagement value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            updateDeploymentRepository( value.getRepository(), "repository", innerCount, root );

-            updateDeploymentRepository(

-                value.getSnapshotRepository(),

-                "snapshotRepository",

-                innerCount,

-                root

-            );

-            updateSite( value.getSite(), "site", innerCount, root );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "downloadUrl",

-                value.getDownloadUrl(),

-                null

-            );

-            updateRelocation( value.getRelocation(), "relocation", innerCount, root );

-            findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null );

-        }

-    } // -- void updateDistributionManagement(DistributionManagement, String, Counter, Element)

-

-    /**

-     * Method updateElement.

-     *

-     * @param counter

-     * @param shouldExist

-     * @param name

-     * @param parent

-     */

-    protected Element updateElement(

-        Counter counter,

-        Element parent,

-        String name,

-        boolean shouldExist

-    )

-    {

-        Element element = parent.getChild( name, parent.getNamespace() );

-        if ( ( element != null ) && shouldExist )

-        {

-            counter.increaseCount();

-        }

-        if ( ( element == null ) && shouldExist )

-        {

-            element = factory.element( name, parent.getNamespace() );

-            insertAtPreferredLocation( parent, element, counter );

-            counter.increaseCount();

-        }

-        if ( !shouldExist && ( element != null ) )

-        {

-            int index = parent.indexOf( element );

-            if ( index > 0 )

-            {

-                Content previous = parent.getContent( index - 1 );

-                if ( previous instanceof Text )

-                {

-                    Text txt = (Text) previous;

-                    if ( txt.getTextTrim().length() == 0 )

-                    {

-                        parent.removeContent( txt );

-                    }

-                }

-            }

-            parent.removeContent( element );

-        }

-        return element;

-    } // -- Element updateElement(Counter, Element, String, boolean)

-

-    /**

-     * Method updateExclusion.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateExclusion(

-        Exclusion value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-    } // -- void updateExclusion(Exclusion, String, Counter, Element)

-

-    /**

-     * Method updateExtension.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateExtension(

-        Extension value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-    } // -- void updateExtension(Extension, String, Counter, Element)

-

-    /**

-     * Method updateFileSet.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateFileSet( FileSet value,

-                                  String xmlTag,

-                                  Counter counter,

-                                  Element element )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "directory",

-                value.getDirectory(),

-                null

-            );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getIncludes(),

-                "includes",

-                "include"

-            );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getExcludes(),

-                "excludes",

-                "exclude"

-            );

-        }

-    } // -- void updateFileSet(FileSet, String, Counter, Element)

-

-    /**

-     * Method updateIssueManagement.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateIssueManagement(

-        IssueManagement value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        }

-    } // -- void updateIssueManagement(IssueManagement, String, Counter, Element)

-

-    /**

-     * Method updateLicense.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateLicense( License value,

-                                  String xmlTag,

-                                  Counter counter,

-                                  Element element )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "distribution",

-            value.getDistribution(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "comments", value.getComments(), null );

-    } // -- void updateLicense(License, String, Counter, Element)

-

-    /**

-     * Method updateMailingList.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateMailingList(

-        MailingList value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "subscribe", value.getSubscribe(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "unsubscribe",

-            value.getUnsubscribe(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "post", value.getPost(), null );

-        findAndReplaceSimpleElement( innerCount, root, "archive", value.getArchive(), null );

-        findAndReplaceSimpleLists(

-            innerCount,

-            root,

-            value.getOtherArchives(),

-            "otherArchives",

-            "otherArchive"

-        );

-    } // -- void updateMailingList(MailingList, String, Counter, Element)

-

-    /**

-     * Method updateModel.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateModel( Model value,

-                                String xmlTag,

-                                Counter counter,

-                                Element element )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        updateParent( value.getParent(), "parent", innerCount, root );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "modelVersion",

-            value.getModelVersion(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "packaging", value.getPackaging(), "jar" );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "description",

-            value.getDescription(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root );

-        updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root );

-        updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "inceptionYear",

-            value.getInceptionYear(),

-            null

-        );

-        iterateMailingList(

-            innerCount,

-            root,

-            value.getMailingLists(),

-            "mailingLists",

-            "mailingList"

-        );

-        iterateDeveloper( innerCount, root, value.getDevelopers(), "developers", "developer" );

-        iterateContributor(

-            innerCount,

-            root,

-            value.getContributors(),

-            "contributors",

-            "contributor"

-        );

-        iterateLicense( innerCount, root, value.getLicenses(), "licenses", "license" );

-        updateScm( value.getScm(), "scm", innerCount, root );

-        updateOrganization( value.getOrganization(), "organization", innerCount, root );

-        updateBuild( value.getBuild(), "build", innerCount, root );

-        iterateProfile( innerCount, root, value.getProfiles(), "profiles", "profile" );

-        findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );

-        iterateRepository(

-            innerCount,

-            root,

-            value.getRepositories(),

-            "repositories",

-            "repository"

-        );

-        iterateRepository(

-            innerCount,

-            root,

-            value.getPluginRepositories(),

-            "pluginRepositories",

-            "pluginRepository"

-        );

-        iterateDependency(

-            innerCount,

-            root,

-            value.getDependencies(),

-            "dependencies",

-            "dependency"

-        );

-        findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );

-        updateReporting( value.getReporting(), "reporting", innerCount, root );

-        updateDependencyManagement(

-            value.getDependencyManagement(),

-            "dependencyManagement",

-            innerCount,

-            root

-        );

-        updateDistributionManagement(

-            value.getDistributionManagement(),

-            "distributionManagement",

-            innerCount,

-            root

-        );

-        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );

-    } // -- void updateModel(Model, String, Counter, Element)

-

-    /**

-     * Method updateModelBase.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateModelBase(

-        ModelBase value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getModules(),

-                "modules",

-                "module"

-            );

-            iterateRepository(

-                innerCount,

-                root,

-                value.getRepositories(),

-                "repositories",

-                "repository"

-            );

-            iterateRepository(

-                innerCount,

-                root,

-                value.getPluginRepositories(),

-                "pluginRepositories",

-                "pluginRepository"

-            );

-            iterateDependency(

-                innerCount,

-                root,

-                value.getDependencies(),

-                "dependencies",

-                "dependency"

-            );

-            findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );

-            updateReporting( value.getReporting(), "reporting", innerCount, root );

-            updateDependencyManagement(

-                value.getDependencyManagement(),

-                "dependencyManagement",

-                innerCount,

-                root

-            );

-            updateDistributionManagement(

-                value.getDistributionManagement(),

-                "distributionManagement",

-                innerCount,

-                root

-            );

-            findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );

-        }

-    } // -- void updateModelBase(ModelBase, String, Counter, Element)

-

-    /**

-     * Method updateNotifier.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateNotifier(

-        Notifier value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "mail" );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "sendOnError",

-            ( value.isSendOnError() == true ) ? null : String.valueOf( value.isSendOnError() ),

-            "true"

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "sendOnFailure",

-            ( value.isSendOnFailure() == true ) ? null

-                : String.valueOf( value.isSendOnFailure() ),

-            "true"

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "sendOnSuccess",

-            ( value.isSendOnSuccess() == true ) ? null

-                : String.valueOf( value.isSendOnSuccess() ),

-            "true"

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "sendOnWarning",

-            ( value.isSendOnWarning() == true ) ? null

-                : String.valueOf( value.isSendOnWarning() ),

-            "true"

-        );

-        findAndReplaceSimpleElement( innerCount, root, "address", value.getAddress(), null );

-        findAndReplaceProperties( innerCount, root, "configuration", value.getConfiguration() );

-    } // -- void updateNotifier(Notifier, String, Counter, Element)

-

-    /**

-     * Method updateOrganization.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateOrganization(

-        Organization value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        }

-    } // -- void updateOrganization(Organization, String, Counter, Element)

-

-    /**

-     * Method updateParent.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateParent( Parent value,

-                                 String xmlTag,

-                                 Counter counter,

-                                 Element element )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "artifactId",

-                value.getArtifactId(),

-                null

-            );

-            findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "relativePath",

-                value.getRelativePath(),

-                "../pom.xml"

-            );

-        }

-    } // -- void updateParent(Parent, String, Counter, Element)

-

-    /**

-     * Method updatePatternSet.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePatternSet(

-        PatternSet value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getIncludes(),

-                "includes",

-                "include"

-            );

-            findAndReplaceSimpleLists(

-                innerCount,

-                root,

-                value.getExcludes(),

-                "excludes",

-                "exclude"

-            );

-        }

-    } // -- void updatePatternSet(PatternSet, String, Counter, Element)

-

-    /**

-     * Method updatePlugin.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePlugin( Plugin value,

-                                 String xmlTag,

-                                 Counter counter,

-                                 Element element )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "groupId",

-            value.getGroupId(),

-            "org.apache.maven.plugins"

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "extensions",

-            ( value.isExtensions() == false ) ? null : String.valueOf( value.isExtensions() ),

-            "false"

-        );

-        iteratePluginExecution(

-            innerCount,

-            root,

-            value.getExecutions(),

-            "executions",

-            "execution"

-        );

-        iterateDependency(

-            innerCount,

-            root,

-            value.getDependencies(),

-            "dependencies",

-            "dependency"

-        );

-        findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() );

-        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );

-        findAndReplaceXpp3DOM(

-            innerCount,

-            root,

-            "configuration",

-            (Xpp3Dom) value.getConfiguration()

-        );

-    } // -- void updatePlugin(Plugin, String, Counter, Element)

-

-    /**

-     * Method updatePluginConfiguration.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePluginConfiguration(

-        PluginConfiguration value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            updatePluginManagement(

-                value.getPluginManagement(),

-                "pluginManagement",

-                innerCount,

-                root

-            );

-            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        }

-    } // -- void updatePluginConfiguration(PluginConfiguration, String, Counter, Element)

-

-    /**

-     * Method updatePluginContainer.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePluginContainer(

-        PluginContainer value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        }

-    } // -- void updatePluginContainer(PluginContainer, String, Counter, Element)

-

-    /**

-     * Method updatePluginExecution.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePluginExecution(

-        PluginExecution value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );

-        findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null );

-        findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" );

-        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );

-        findAndReplaceXpp3DOM(

-            innerCount,

-            root,

-            "configuration",

-            (Xpp3Dom) value.getConfiguration()

-        );

-    } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)

-

-    /**

-     * Method updatePluginManagement.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePluginManagement(

-        PluginManagement value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        }

-    } // -- void updatePluginManagement(PluginManagement, String, Counter, Element)

-

-    /**

-     * Method updatePrerequisites.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updatePrerequisites(

-        Prerequisites value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "maven", value.getMaven(), "2.0" );

-        }

-    } // -- void updatePrerequisites(Prerequisites, String, Counter, Element)

-

-    /**

-     * Method updateProfile.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateProfile( Profile value,

-                                  String xmlTag,

-                                  Counter counter,

-                                  Element element )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-        updateActivation( value.getActivation(), "activation", innerCount, root );

-        updateBuildBase( value.getBuild(), "build", innerCount, root );

-        findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );

-        iterateRepository(

-            innerCount,

-            root,

-            value.getRepositories(),

-            "repositories",

-            "repository"

-        );

-        iterateRepository(

-            innerCount,

-            root,

-            value.getPluginRepositories(),

-            "pluginRepositories",

-            "pluginRepository"

-        );

-        iterateDependency(

-            innerCount,

-            root,

-            value.getDependencies(),

-            "dependencies",

-            "dependency"

-        );

-        findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );

-        updateReporting( value.getReporting(), "reporting", innerCount, root );

-        updateDependencyManagement(

-            value.getDependencyManagement(),

-            "dependencyManagement",

-            innerCount,

-            root

-        );

-        updateDistributionManagement(

-            value.getDistributionManagement(),

-            "distributionManagement",

-            innerCount,

-            root

-        );

-        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );

-    } // -- void updateProfile(Profile, String, Counter, Element)

-

-    /**

-     * Method updateRelocation.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateRelocation(

-        Relocation value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "artifactId",

-                value.getArtifactId(),

-                null

-            );

-            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-            findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null );

-        }

-    } // -- void updateRelocation(Relocation, String, Counter, Element)

-

-    /**

-     * Method updateReporting.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateReporting(

-        Reporting value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "excludeDefaults",

-                ( value.isExcludeDefaults() == false )

-                    ? null

-                    : String.valueOf( value.isExcludeDefaults() ),

-                "false"

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "outputDirectory",

-                value.getOutputDirectory(),

-                null

-            );

-            iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );

-        }

-    } // -- void updateReporting(Reporting, String, Counter, Element)

-

-    /**

-     * Method updateReportPlugin.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateReportPlugin(

-        ReportPlugin value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "groupId",

-            value.getGroupId(),

-            "org.apache.maven.plugins"

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "artifactId",

-            value.getArtifactId(),

-            null

-        );

-        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );

-        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );

-        findAndReplaceXpp3DOM(

-            innerCount,

-            root,

-            "configuration",

-            (Xpp3Dom) value.getConfiguration()

-        );

-        iterateReportSet( innerCount, root, value.getReportSets(), "reportSets", "reportSet" );

-    } // -- void updateReportPlugin(ReportPlugin, String, Counter, Element)

-

-    /**

-     * Method updateReportSet.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateReportSet(

-        ReportSet value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );

-        findAndReplaceXpp3DOM(

-            innerCount,

-            root,

-            "configuration",

-            (Xpp3Dom) value.getConfiguration()

-        );

-        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );

-        findAndReplaceSimpleLists( innerCount, root, value.getReports(), "reports", "report" );

-    } // -- void updateReportSet(ReportSet, String, Counter, Element)

-

-    /**

-     * Method updateRepository.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateRepository(

-        Repository value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root );

-        updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root );

-        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" );

-    } // -- void updateRepository(Repository, String, Counter, Element)

-

-    /**

-     * Method updateRepositoryBase.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateRepositoryBase(

-        RepositoryBase value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "layout",

-                value.getLayout(),

-                "default"

-            );

-        }

-    } // -- void updateRepositoryBase(RepositoryBase, String, Counter, Element)

-

-    /**

-     * Method updateRepositoryPolicy.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateRepositoryPolicy(

-        RepositoryPolicy value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "enabled",

-                ( value.isEnabled() == true ) ? null : String.valueOf( value.isEnabled() ),

-                "true"

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "updatePolicy",

-                value.getUpdatePolicy(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "checksumPolicy",

-                value.getChecksumPolicy(),

-                null

-            );

-        }

-    } // -- void updateRepositoryPolicy(RepositoryPolicy, String, Counter, Element)

-

-    /**

-     * Method updateResource.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateResource(

-        Resource value,

-        String xmlTag,

-        Counter counter,

-        Element element

-    )

-    {

-        Element root = element;

-        Counter innerCount = new Counter( counter.getDepth() + 1 );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "targetPath",

-            value.getTargetPath(),

-            null

-        );

-        findAndReplaceSimpleElement(

-            innerCount,

-            root,

-            "filtering",

-            ( value.isFiltering() == false ) ? null : String.valueOf( value.isFiltering() ),

-            "false"

-        );

-        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );

-        findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" );

-        findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" );

-    } // -- void updateResource(Resource, String, Counter, Element)

-

-    /**

-     * Method updateScm.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateScm( Scm value,

-                              String xmlTag,

-                              Counter counter,

-                              Element element )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "connection",

-                value.getConnection(),

-                null

-            );

-            findAndReplaceSimpleElement(

-                innerCount,

-                root,

-                "developerConnection",

-                value.getDeveloperConnection(),

-                null

-            );

-            findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        }

-    } // -- void updateScm(Scm, String, Counter, Element)

-

-    /**

-     * Method updateSite.

-     *

-     * @param value

-     * @param element

-     * @param counter

-     * @param xmlTag

-     */

-    protected void updateSite( Site value,

-                               String xmlTag,

-                               Counter counter,

-                               Element element )

-    {

-        boolean shouldExist = value != null;

-        Element root = updateElement( counter, element, xmlTag, shouldExist );

-        if ( shouldExist )

-        {

-            Counter innerCount = new Counter( counter.getDepth() + 1 );

-            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );

-            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );

-            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

-        }

-    } // -- void updateSite(Site, String, Counter, Element)

-

-    // -----------------/

-    // - Inner Classes -/

-    // -----------------/

-

-    /**

-     * Class Counter.

-     *

-     * @version $Revision$ $Date$

-     */

-    public class Counter

-    {

-        // --------------------------/

-        // - Class/Member Variables -/

-        // --------------------------/

-

-        /** Field currentIndex. */

-        private int currentIndex = 0;

-

-        /** Field level. */

-        private int level;

-

-        // ----------------/

-        // - Constructors -/

-        // ----------------/

-

-        public Counter( int depthLevel )

-        {

-            level = depthLevel;

-        } // -- org.apache.maven.model.io.jdom.Counter(int)

-

-        // -----------/

-        // - Methods -/

-        // -----------/

-

-        /** Method getCurrentIndex. */

-        public int getCurrentIndex()

-        {

-            return currentIndex;

-        } // -- int getCurrentIndex()

-

-        /** Method getDepth. */

-        public int getDepth()

-        {

-            return level;

-        } // -- int getDepth()

-

-        /** Method increaseCount. */

-        public void increaseCount()

-        {

-            currentIndex = currentIndex + 1;

-        } // -- void increaseCount()

-    }

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+/*
+ * $Id$
+ */
+
+// ---------------------------------/
+// - Imported classes and packages -/
+// ---------------------------------/
+
+import org.apache.maven.archetype.common.util.Format;
+import org.apache.maven.archetype.common.util.XMLOutputter;
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.ActivationFile;
+import org.apache.maven.model.ActivationOS;
+import org.apache.maven.model.ActivationProperty;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.ConfigurationContainer;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.FileSet;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.ModelBase;
+import org.apache.maven.model.Notifier;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.PatternSet;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginConfiguration;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Prerequisites;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.RepositoryBase;
+import org.apache.maven.model.RepositoryPolicy;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Site;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.jdom.Content;
+import org.jdom.DefaultJDOMFactory;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Text;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Class MavenJDOMWriter.
+ *
+ * @version $Revision$ $Date$
+ */
+public class MavenJDOMWriter
+{
+    // --------------------------/
+    // - Class/Member Variables -/
+    // --------------------------/
+
+    /** Field factory. */
+    private DefaultJDOMFactory factory;
+
+    /** Field lineSeparator. */
+    private String lineSeparator;
+
+    // ----------------/
+    // - Constructors -/
+    // ----------------/
+
+    public MavenJDOMWriter()
+    {
+        factory = new DefaultJDOMFactory();
+        lineSeparator = "\n";
+    } // -- org.apache.maven.model.io.jdom.MavenJDOMWriter()
+
+    /**
+     * Method write.
+     *
+     * @param project
+     * @param stream
+     * @param document
+     * @deprecated
+     */
+    public void write( Model project,
+                       Document document,
+                       OutputStream stream )
+        throws
+        java.io.IOException
+    {
+        updateModel( project, "project", new Counter( 0 ), document.getRootElement() );
+
+        XMLOutputter outputter = new XMLOutputter();
+        outputter.setFormat(
+            Format.getPrettyFormat().setIndent( "  " ).setLineSeparator(
+                System.getProperty( "line.separator" )
+            )
+        );
+        outputter.output( document, stream );
+    } // -- void write(Model, Document, OutputStream)
+
+    /**
+     * Method write.
+     *
+     * @param project
+     * @param writer
+     * @param document
+     */
+    public void write( Model project,
+                       Document document,
+                       OutputStreamWriter writer )
+        throws
+        java.io.IOException
+    {
+        Format format =
+            Format.getRawFormat().setEncoding( writer.getEncoding() ).setLineSeparator(
+                System.getProperty( "line.separator" )
+            );
+        write( project, document, writer, format );
+    } // -- void write(Model, Document, OutputStreamWriter)
+
+    /**
+     * Method write.
+     *
+     * @param project
+     * @param jdomFormat
+     * @param writer
+     * @param document
+     */
+    public void write( Model project,
+                       Document document,
+                       Writer writer,
+                       Format jdomFormat )
+        throws
+        java.io.IOException
+    {
+        updateModel( project, "project", new Counter( 0 ), document.getRootElement() );
+
+        XMLOutputter outputter = new XMLOutputter();
+        outputter.setFormat( jdomFormat );
+        outputter.output( document, writer );
+    } // -- void write(Model, Document, Writer, Format)
+
+    // -----------/
+    // - Methods -/
+    // -----------/
+
+    /**
+     * Method findAndReplaceProperties.
+     *
+     * @param counter
+     * @param props
+     * @param name
+     * @param parent
+     */
+    protected Element findAndReplaceProperties(
+        Counter counter,
+        Element parent,
+        String name,
+        Map props
+    )
+    {
+        boolean shouldExist = ( props != null ) && !props.isEmpty();
+        Element element = updateElement( counter, parent, name, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = props.keySet().iterator();
+            Counter innerCounter = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                String key = (String) it.next();
+                findAndReplaceSimpleElement(
+                    innerCounter,
+                    element,
+                    key,
+                    (String) props.get( key ),
+                    null
+                );
+            }
+
+            ArrayList lst = new ArrayList( props.keySet() );
+            it = element.getChildren().iterator();
+            while ( it.hasNext() )
+            {
+                Element elem = (Element) it.next();
+                String key = elem.getName();
+                if ( !lst.contains( key ) )
+                {
+                    it.remove();
+                }
+            }
+        }
+        return element;
+    } // -- Element findAndReplaceProperties(Counter, Element, String, Map)
+
+    /**
+     * Method findAndReplaceSimpleElement.
+     *
+     * @param counter
+     * @param defaultValue
+     * @param text
+     * @param name
+     * @param parent
+     */
+    protected Element findAndReplaceSimpleElement(
+        Counter counter,
+        Element parent,
+        String name,
+        String text,
+        String defaultValue
+    )
+    {
+        if ( ( defaultValue != null ) && ( text != null ) && defaultValue.equals( text ) )
+        {
+            Element element = parent.getChild( name, parent.getNamespace() );
+            // if exist and is default value or if doesn't exist.. just keep the way it is..
+            if ( ( ( element != null ) && defaultValue.equals( element.getText() ) )
+                || ( element == null )
+                )
+            {
+                return element;
+            }
+        }
+
+        boolean shouldExist = ( text != null ) && ( text.trim().length() > 0 );
+        Element element = updateElement( counter, parent, name, shouldExist );
+        if ( shouldExist )
+        {
+            element.setText( text );
+        }
+        return element;
+    } // -- Element findAndReplaceSimpleElement(Counter, Element, String, String, String)
+
+    /**
+     * Method findAndReplaceSimpleLists.
+     *
+     * @param counter
+     * @param childName
+     * @param parentName
+     * @param list
+     * @param parent
+     */
+    protected Element findAndReplaceSimpleLists(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        String parentName,
+        String childName
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentName, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childName, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                String value = (String) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childName, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                el.setText( value );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+        return element;
+    } // -- Element findAndReplaceSimpleLists(Counter, Element, java.util.Collection, String,
+    // String)
+
+    /**
+     * Method findAndReplaceXpp3DOM.
+     *
+     * @param counter
+     * @param dom
+     * @param name
+     * @param parent
+     */
+    protected Element findAndReplaceXpp3DOM(
+        Counter counter,
+        Element parent,
+        String name,
+        Xpp3Dom dom
+    )
+    {
+        boolean shouldExist =
+            ( dom != null ) && ( ( dom.getChildCount() > 0 ) || ( dom.getValue() != null ) );
+        Element element = updateElement( counter, parent, name, shouldExist );
+        if ( shouldExist )
+        {
+            replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) );
+        }
+        return element;
+    } // -- Element findAndReplaceXpp3DOM(Counter, Element, String, Xpp3Dom)
+
+    /**
+     * Method insertAtPreferredLocation.
+     *
+     * @param parent
+     * @param counter
+     * @param child
+     */
+    protected void insertAtPreferredLocation( Element parent,
+                                              Element child,
+                                              Counter counter )
+    {
+        int contentIndex = 0;
+        int elementCounter = 0;
+        Iterator it = parent.getContent().iterator();
+        Text lastText = null;
+        int offset = 0;
+        while ( it.hasNext() && ( elementCounter <= counter.getCurrentIndex() ) )
+        {
+            Object next = it.next();
+            offset = offset + 1;
+            if ( next instanceof Element )
+            {
+                elementCounter = elementCounter + 1;
+                contentIndex = contentIndex + offset;
+                offset = 0;
+            }
+            if ( ( next instanceof Text ) && it.hasNext() )
+            {
+                lastText = (Text) next;
+            }
+        }
+        if ( ( lastText != null ) && ( lastText.getTextTrim().length() == 0 ) )
+        {
+            lastText = (Text) lastText.clone();
+        }
+        else
+        {
+            String starter = lineSeparator;
+            for ( int i = 0; i < counter.getDepth(); i++ )
+            {
+                starter = starter + "  "; // TODO make settable?
+            }
+            lastText = factory.text( starter );
+        }
+        if ( parent.getContentSize() == 0 )
+        {
+            Text finalText = (Text) lastText.clone();
+            finalText.setText(
+                finalText.getText().substring(
+                    0,
+                    finalText.getText().length() - "  ".length()
+                )
+            );
+            parent.addContent( contentIndex, finalText );
+        }
+        parent.addContent( contentIndex, child );
+        parent.addContent( contentIndex, lastText );
+    } // -- void insertAtPreferredLocation(Element, Element, Counter)
+
+    /**
+     * Method iterateContributor.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateContributor(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Contributor value = (Contributor) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateContributor( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateContributor(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateDependency.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateDependency(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Dependency value = (Dependency) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateDependency( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateDependency(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateDeveloper.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateDeveloper(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Developer value = (Developer) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateDeveloper( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateDeveloper(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateExclusion.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateExclusion(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Exclusion value = (Exclusion) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateExclusion( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateExclusion(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateExtension.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateExtension(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Extension value = (Extension) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateExtension( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateExtension(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateLicense.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateLicense(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                License value = (License) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateLicense( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateMailingList.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateMailingList(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                MailingList value = (MailingList) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateMailingList( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateMailingList(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateNotifier.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateNotifier(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Notifier value = (Notifier) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateNotifier( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateNotifier(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iteratePlugin.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iteratePlugin(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Plugin value = (Plugin) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updatePlugin( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iteratePlugin(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iteratePluginExecution.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iteratePluginExecution(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                PluginExecution value = (PluginExecution) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updatePluginExecution( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iteratePluginExecution(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateProfile.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateProfile(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Profile value = (Profile) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateProfile( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateProfile(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateReportPlugin.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateReportPlugin(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                ReportPlugin value = (ReportPlugin) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateReportPlugin( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateReportPlugin(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateReportSet.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateReportSet(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                ReportSet value = (ReportSet) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateReportSet( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateReportSet(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateRepository.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateRepository(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Repository value = (Repository) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateRepository( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateRepository(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method iterateResource.
+     *
+     * @param counter
+     * @param childTag
+     * @param parentTag
+     * @param list
+     * @param parent
+     */
+    protected void iterateResource(
+        Counter counter,
+        Element parent,
+        java.util.Collection list,
+        java.lang.String parentTag,
+        java.lang.String childTag
+    )
+    {
+        boolean shouldExist = ( list != null ) && ( list.size() > 0 );
+        Element element = updateElement( counter, parent, parentTag, shouldExist );
+        if ( shouldExist )
+        {
+            Iterator it = list.iterator();
+            Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
+            if ( !elIt.hasNext() )
+            {
+                elIt = null;
+            }
+
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            while ( it.hasNext() )
+            {
+                Resource value = (Resource) it.next();
+                Element el;
+                if ( ( elIt != null ) && elIt.hasNext() )
+                {
+                    el = (Element) elIt.next();
+                    if ( !elIt.hasNext() )
+                    {
+                        elIt = null;
+                    }
+                }
+                else
+                {
+                    el = factory.element( childTag, element.getNamespace() );
+                    insertAtPreferredLocation( element, el, innerCount );
+                }
+                updateResource( value, childTag, innerCount, el );
+                innerCount.increaseCount();
+            }
+            if ( elIt != null )
+            {
+                while ( elIt.hasNext() )
+                {
+                    elIt.next();
+                    elIt.remove();
+                }
+            }
+        }
+    } // -- void iterateResource(Counter, Element, java.util.Collection, java.lang.String,
+    // java.lang.String)
+
+    /**
+     * Method replaceXpp3DOM.
+     *
+     * @param parent
+     * @param counter
+     * @param parentDom
+     */
+    protected void replaceXpp3DOM( Element parent,
+                                   Xpp3Dom parentDom,
+                                   Counter counter )
+    {
+        if ( parentDom.getChildCount() > 0 )
+        {
+            Xpp3Dom[] childs = parentDom.getChildren();
+            Collection domChilds = new ArrayList();
+            for ( int i = 0; i < childs.length; i++ )
+            {
+                domChilds.add( childs[i] );
+            }
+
+            int domIndex = 0;
+            ListIterator it = parent.getChildren().listIterator();
+            while ( it.hasNext() )
+            {
+                Element elem = (Element) it.next();
+                Iterator it2 = domChilds.iterator();
+                Xpp3Dom corrDom = null;
+                while ( it2.hasNext() )
+                {
+                    Xpp3Dom dm = (Xpp3Dom) it2.next();
+                    if ( dm.getName().equals( elem.getName() ) )
+                    {
+                        corrDom = dm;
+                        break;
+                    }
+                }
+                if ( corrDom != null )
+                {
+                    domChilds.remove( corrDom );
+                    replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) );
+                    counter.increaseCount();
+                }
+                else
+                {
+                    parent.removeContent( elem );
+                }
+            }
+
+            Iterator it2 = domChilds.iterator();
+            while ( it2.hasNext() )
+            {
+                Xpp3Dom dm = (Xpp3Dom) it2.next();
+                Element elem = factory.element( dm.getName(), parent.getNamespace() );
+                insertAtPreferredLocation( parent, elem, counter );
+                counter.increaseCount();
+                replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) );
+            }
+        }
+        else if ( parentDom.getValue() != null )
+        {
+            parent.setText( parentDom.getValue() );
+        }
+    } // -- void replaceXpp3DOM(Element, Xpp3Dom, Counter)
+
+    /**
+     * Method updateActivation.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateActivation(
+        Activation value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "activeByDefault",
+                ( value.isActiveByDefault() == false )
+                    ? null
+                    : String.valueOf( value.isActiveByDefault() ),
+                "false"
+            );
+            findAndReplaceSimpleElement( innerCount, root, "jdk", value.getJdk(), null );
+            updateActivationOS( value.getOs(), "os", innerCount, root );
+            updateActivationProperty( value.getProperty(), "property", innerCount, root );
+            updateActivationFile( value.getFile(), "file", innerCount, root );
+        }
+    } // -- void updateActivation(Activation, String, Counter, Element)
+
+    /**
+     * Method updateActivationFile.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateActivationFile(
+        ActivationFile value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null );
+            findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null );
+        }
+    } // -- void updateActivationFile(ActivationFile, String, Counter, Element)
+
+    /**
+     * Method updateActivationOS.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateActivationOS(
+        ActivationOS value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "family", value.getFamily(), null );
+            findAndReplaceSimpleElement( innerCount, root, "arch", value.getArch(), null );
+            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+        }
+    } // -- void updateActivationOS(ActivationOS, String, Counter, Element)
+
+    /**
+     * Method updateActivationProperty.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateActivationProperty(
+        ActivationProperty value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null );
+        }
+    } // -- void updateActivationProperty(ActivationProperty, String, Counter, Element)
+
+    /**
+     * Method updateBuild.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateBuild( Build value,
+                                String xmlTag,
+                                Counter counter,
+                                Element element )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "sourceDirectory",
+                value.getSourceDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "scriptSourceDirectory",
+                value.getScriptSourceDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "testSourceDirectory",
+                value.getTestSourceDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "outputDirectory",
+                value.getOutputDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "testOutputDirectory",
+                value.getTestOutputDirectory(),
+                null
+            );
+            iterateExtension(
+                innerCount,
+                root,
+                value.getExtensions(),
+                "extensions",
+                "extension"
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "defaultGoal",
+                value.getDefaultGoal(),
+                null
+            );
+            iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
+            iterateResource(
+                innerCount,
+                root,
+                value.getTestResources(),
+                "testResources",
+                "testResource"
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "directory",
+                value.getDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "finalName",
+                value.getFinalName(),
+                null
+            );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getFilters(),
+                "filters",
+                "filter"
+            );
+            updatePluginManagement(
+                value.getPluginManagement(),
+                "pluginManagement",
+                innerCount,
+                root
+            );
+            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        } // end if
+    } // -- void updateBuild(Build, String, Counter, Element)
+
+    /**
+     * Method updateBuildBase.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateBuildBase(
+        BuildBase value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "defaultGoal",
+                value.getDefaultGoal(),
+                null
+            );
+            iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
+            iterateResource(
+                innerCount,
+                root,
+                value.getTestResources(),
+                "testResources",
+                "testResource"
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "directory",
+                value.getDirectory(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "finalName",
+                value.getFinalName(),
+                null
+            );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getFilters(),
+                "filters",
+                "filter"
+            );
+            updatePluginManagement(
+                value.getPluginManagement(),
+                "pluginManagement",
+                innerCount,
+                root
+            );
+            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        }
+    } // -- void updateBuildBase(BuildBase, String, Counter, Element)
+
+    /**
+     * Method updateCiManagement.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateCiManagement(
+        CiManagement value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+            iterateNotifier( innerCount, root, value.getNotifiers(), "notifiers", "notifier" );
+        }
+    } // -- void updateCiManagement(CiManagement, String, Counter, Element)
+
+    /**
+     * Method updateConfigurationContainer.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateConfigurationContainer(
+        ConfigurationContainer value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "inherited",
+                value.getInherited(),
+                null
+            );
+            findAndReplaceXpp3DOM(
+                innerCount,
+                root,
+                "configuration",
+                (Xpp3Dom) value.getConfiguration()
+            );
+        }
+    } // -- void updateConfigurationContainer(ConfigurationContainer, String, Counter, Element)
+
+    /**
+     * Method updateContributor.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateContributor(
+        Contributor value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
+        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "organization",
+            value.getOrganization(),
+            null
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "organizationUrl",
+            value.getOrganizationUrl(),
+            null
+        );
+        findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
+        findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
+        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
+    } // -- void updateContributor(Contributor, String, Counter, Element)
+
+    /**
+     * Method updateDependency.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateDependency(
+        Dependency value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+        findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "jar" );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "classifier",
+            value.getClassifier(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "scope", value.getScope(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "systemPath",
+            value.getSystemPath(),
+            null
+        );
+        iterateExclusion( innerCount, root, value.getExclusions(), "exclusions", "exclusion" );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "optional",
+            ( value.isOptional() == false ) ? null : String.valueOf( value.isOptional() ),
+            "false"
+        );
+    } // -- void updateDependency(Dependency, String, Counter, Element)
+
+    /**
+     * Method updateDependencyManagement.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateDependencyManagement(
+        DependencyManagement value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            iterateDependency(
+                innerCount,
+                root,
+                value.getDependencies(),
+                "dependencies",
+                "dependency"
+            );
+        }
+    } // -- void updateDependencyManagement(DependencyManagement, String, Counter, Element)
+
+    /**
+     * Method updateDeploymentRepository.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateDeploymentRepository(
+        DeploymentRepository value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "uniqueVersion",
+                ( value.isUniqueVersion() == true ) ? null
+                    : String.valueOf( value.isUniqueVersion() ),
+                "true"
+            );
+            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "layout",
+                value.getLayout(),
+                "default"
+            );
+        }
+    } // -- void updateDeploymentRepository(DeploymentRepository, String, Counter, Element)
+
+    /**
+     * Method updateDeveloper.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateDeveloper(
+        Developer value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
+        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "organization",
+            value.getOrganization(),
+            null
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "organizationUrl",
+            value.getOrganizationUrl(),
+            null
+        );
+        findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
+        findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
+        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
+    } // -- void updateDeveloper(Developer, String, Counter, Element)
+
+    /**
+     * Method updateDistributionManagement.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateDistributionManagement(
+        DistributionManagement value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            updateDeploymentRepository( value.getRepository(), "repository", innerCount, root );
+            updateDeploymentRepository(
+                value.getSnapshotRepository(),
+                "snapshotRepository",
+                innerCount,
+                root
+            );
+            updateSite( value.getSite(), "site", innerCount, root );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "downloadUrl",
+                value.getDownloadUrl(),
+                null
+            );
+            updateRelocation( value.getRelocation(), "relocation", innerCount, root );
+            findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null );
+        }
+    } // -- void updateDistributionManagement(DistributionManagement, String, Counter, Element)
+
+    /**
+     * Method updateElement.
+     *
+     * @param counter
+     * @param shouldExist
+     * @param name
+     * @param parent
+     */
+    protected Element updateElement(
+        Counter counter,
+        Element parent,
+        String name,
+        boolean shouldExist
+    )
+    {
+        Element element = parent.getChild( name, parent.getNamespace() );
+        if ( ( element != null ) && shouldExist )
+        {
+            counter.increaseCount();
+        }
+        if ( ( element == null ) && shouldExist )
+        {
+            element = factory.element( name, parent.getNamespace() );
+            insertAtPreferredLocation( parent, element, counter );
+            counter.increaseCount();
+        }
+        if ( !shouldExist && ( element != null ) )
+        {
+            int index = parent.indexOf( element );
+            if ( index > 0 )
+            {
+                Content previous = parent.getContent( index - 1 );
+                if ( previous instanceof Text )
+                {
+                    Text txt = (Text) previous;
+                    if ( txt.getTextTrim().length() == 0 )
+                    {
+                        parent.removeContent( txt );
+                    }
+                }
+            }
+            parent.removeContent( element );
+        }
+        return element;
+    } // -- Element updateElement(Counter, Element, String, boolean)
+
+    /**
+     * Method updateExclusion.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateExclusion(
+        Exclusion value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+    } // -- void updateExclusion(Exclusion, String, Counter, Element)
+
+    /**
+     * Method updateExtension.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateExtension(
+        Extension value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+    } // -- void updateExtension(Extension, String, Counter, Element)
+
+    /**
+     * Method updateFileSet.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateFileSet( FileSet value,
+                                  String xmlTag,
+                                  Counter counter,
+                                  Element element )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "directory",
+                value.getDirectory(),
+                null
+            );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getIncludes(),
+                "includes",
+                "include"
+            );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getExcludes(),
+                "excludes",
+                "exclude"
+            );
+        }
+    } // -- void updateFileSet(FileSet, String, Counter, Element)
+
+    /**
+     * Method updateIssueManagement.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateIssueManagement(
+        IssueManagement value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        }
+    } // -- void updateIssueManagement(IssueManagement, String, Counter, Element)
+
+    /**
+     * Method updateLicense.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateLicense( License value,
+                                  String xmlTag,
+                                  Counter counter,
+                                  Element element )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "distribution",
+            value.getDistribution(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "comments", value.getComments(), null );
+    } // -- void updateLicense(License, String, Counter, Element)
+
+    /**
+     * Method updateMailingList.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateMailingList(
+        MailingList value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "subscribe", value.getSubscribe(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "unsubscribe",
+            value.getUnsubscribe(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "post", value.getPost(), null );
+        findAndReplaceSimpleElement( innerCount, root, "archive", value.getArchive(), null );
+        findAndReplaceSimpleLists(
+            innerCount,
+            root,
+            value.getOtherArchives(),
+            "otherArchives",
+            "otherArchive"
+        );
+    } // -- void updateMailingList(MailingList, String, Counter, Element)
+
+    /**
+     * Method updateModel.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateModel( Model value,
+                                String xmlTag,
+                                Counter counter,
+                                Element element )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        updateParent( value.getParent(), "parent", innerCount, root );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "modelVersion",
+            value.getModelVersion(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "packaging", value.getPackaging(), "jar" );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "description",
+            value.getDescription(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root );
+        updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root );
+        updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "inceptionYear",
+            value.getInceptionYear(),
+            null
+        );
+        iterateMailingList(
+            innerCount,
+            root,
+            value.getMailingLists(),
+            "mailingLists",
+            "mailingList"
+        );
+        iterateDeveloper( innerCount, root, value.getDevelopers(), "developers", "developer" );
+        iterateContributor(
+            innerCount,
+            root,
+            value.getContributors(),
+            "contributors",
+            "contributor"
+        );
+        iterateLicense( innerCount, root, value.getLicenses(), "licenses", "license" );
+        updateScm( value.getScm(), "scm", innerCount, root );
+        updateOrganization( value.getOrganization(), "organization", innerCount, root );
+        updateBuild( value.getBuild(), "build", innerCount, root );
+        iterateProfile( innerCount, root, value.getProfiles(), "profiles", "profile" );
+        findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
+        iterateRepository(
+            innerCount,
+            root,
+            value.getRepositories(),
+            "repositories",
+            "repository"
+        );
+        iterateRepository(
+            innerCount,
+            root,
+            value.getPluginRepositories(),
+            "pluginRepositories",
+            "pluginRepository"
+        );
+        iterateDependency(
+            innerCount,
+            root,
+            value.getDependencies(),
+            "dependencies",
+            "dependency"
+        );
+        findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
+        updateReporting( value.getReporting(), "reporting", innerCount, root );
+        updateDependencyManagement(
+            value.getDependencyManagement(),
+            "dependencyManagement",
+            innerCount,
+            root
+        );
+        updateDistributionManagement(
+            value.getDistributionManagement(),
+            "distributionManagement",
+            innerCount,
+            root
+        );
+        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
+    } // -- void updateModel(Model, String, Counter, Element)
+
+    /**
+     * Method updateModelBase.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateModelBase(
+        ModelBase value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getModules(),
+                "modules",
+                "module"
+            );
+            iterateRepository(
+                innerCount,
+                root,
+                value.getRepositories(),
+                "repositories",
+                "repository"
+            );
+            iterateRepository(
+                innerCount,
+                root,
+                value.getPluginRepositories(),
+                "pluginRepositories",
+                "pluginRepository"
+            );
+            iterateDependency(
+                innerCount,
+                root,
+                value.getDependencies(),
+                "dependencies",
+                "dependency"
+            );
+            findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
+            updateReporting( value.getReporting(), "reporting", innerCount, root );
+            updateDependencyManagement(
+                value.getDependencyManagement(),
+                "dependencyManagement",
+                innerCount,
+                root
+            );
+            updateDistributionManagement(
+                value.getDistributionManagement(),
+                "distributionManagement",
+                innerCount,
+                root
+            );
+            findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
+        }
+    } // -- void updateModelBase(ModelBase, String, Counter, Element)
+
+    /**
+     * Method updateNotifier.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateNotifier(
+        Notifier value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "mail" );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "sendOnError",
+            ( value.isSendOnError() == true ) ? null : String.valueOf( value.isSendOnError() ),
+            "true"
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "sendOnFailure",
+            ( value.isSendOnFailure() == true ) ? null
+                : String.valueOf( value.isSendOnFailure() ),
+            "true"
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "sendOnSuccess",
+            ( value.isSendOnSuccess() == true ) ? null
+                : String.valueOf( value.isSendOnSuccess() ),
+            "true"
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "sendOnWarning",
+            ( value.isSendOnWarning() == true ) ? null
+                : String.valueOf( value.isSendOnWarning() ),
+            "true"
+        );
+        findAndReplaceSimpleElement( innerCount, root, "address", value.getAddress(), null );
+        findAndReplaceProperties( innerCount, root, "configuration", value.getConfiguration() );
+    } // -- void updateNotifier(Notifier, String, Counter, Element)
+
+    /**
+     * Method updateOrganization.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateOrganization(
+        Organization value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        }
+    } // -- void updateOrganization(Organization, String, Counter, Element)
+
+    /**
+     * Method updateParent.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateParent( Parent value,
+                                 String xmlTag,
+                                 Counter counter,
+                                 Element element )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "artifactId",
+                value.getArtifactId(),
+                null
+            );
+            findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "relativePath",
+                value.getRelativePath(),
+                "../pom.xml"
+            );
+        }
+    } // -- void updateParent(Parent, String, Counter, Element)
+
+    /**
+     * Method updatePatternSet.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePatternSet(
+        PatternSet value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getIncludes(),
+                "includes",
+                "include"
+            );
+            findAndReplaceSimpleLists(
+                innerCount,
+                root,
+                value.getExcludes(),
+                "excludes",
+                "exclude"
+            );
+        }
+    } // -- void updatePatternSet(PatternSet, String, Counter, Element)
+
+    /**
+     * Method updatePlugin.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePlugin( Plugin value,
+                                 String xmlTag,
+                                 Counter counter,
+                                 Element element )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "groupId",
+            value.getGroupId(),
+            "org.apache.maven.plugins"
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "extensions",
+            ( value.isExtensions() == false ) ? null : String.valueOf( value.isExtensions() ),
+            "false"
+        );
+        iteratePluginExecution(
+            innerCount,
+            root,
+            value.getExecutions(),
+            "executions",
+            "execution"
+        );
+        iterateDependency(
+            innerCount,
+            root,
+            value.getDependencies(),
+            "dependencies",
+            "dependency"
+        );
+        findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() );
+        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
+        findAndReplaceXpp3DOM(
+            innerCount,
+            root,
+            "configuration",
+            (Xpp3Dom) value.getConfiguration()
+        );
+    } // -- void updatePlugin(Plugin, String, Counter, Element)
+
+    /**
+     * Method updatePluginConfiguration.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePluginConfiguration(
+        PluginConfiguration value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            updatePluginManagement(
+                value.getPluginManagement(),
+                "pluginManagement",
+                innerCount,
+                root
+            );
+            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        }
+    } // -- void updatePluginConfiguration(PluginConfiguration, String, Counter, Element)
+
+    /**
+     * Method updatePluginContainer.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePluginContainer(
+        PluginContainer value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        }
+    } // -- void updatePluginContainer(PluginContainer, String, Counter, Element)
+
+    /**
+     * Method updatePluginExecution.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePluginExecution(
+        PluginExecution value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
+        findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null );
+        findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" );
+        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
+        findAndReplaceXpp3DOM(
+            innerCount,
+            root,
+            "configuration",
+            (Xpp3Dom) value.getConfiguration()
+        );
+    } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)
+
+    /**
+     * Method updatePluginManagement.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePluginManagement(
+        PluginManagement value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        }
+    } // -- void updatePluginManagement(PluginManagement, String, Counter, Element)
+
+    /**
+     * Method updatePrerequisites.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updatePrerequisites(
+        Prerequisites value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "maven", value.getMaven(), "2.0" );
+        }
+    } // -- void updatePrerequisites(Prerequisites, String, Counter, Element)
+
+    /**
+     * Method updateProfile.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateProfile( Profile value,
+                                  String xmlTag,
+                                  Counter counter,
+                                  Element element )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+        updateActivation( value.getActivation(), "activation", innerCount, root );
+        updateBuildBase( value.getBuild(), "build", innerCount, root );
+        findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
+        iterateRepository(
+            innerCount,
+            root,
+            value.getRepositories(),
+            "repositories",
+            "repository"
+        );
+        iterateRepository(
+            innerCount,
+            root,
+            value.getPluginRepositories(),
+            "pluginRepositories",
+            "pluginRepository"
+        );
+        iterateDependency(
+            innerCount,
+            root,
+            value.getDependencies(),
+            "dependencies",
+            "dependency"
+        );
+        findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
+        updateReporting( value.getReporting(), "reporting", innerCount, root );
+        updateDependencyManagement(
+            value.getDependencyManagement(),
+            "dependencyManagement",
+            innerCount,
+            root
+        );
+        updateDistributionManagement(
+            value.getDistributionManagement(),
+            "distributionManagement",
+            innerCount,
+            root
+        );
+        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
+    } // -- void updateProfile(Profile, String, Counter, Element)
+
+    /**
+     * Method updateRelocation.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateRelocation(
+        Relocation value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "artifactId",
+                value.getArtifactId(),
+                null
+            );
+            findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+            findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null );
+        }
+    } // -- void updateRelocation(Relocation, String, Counter, Element)
+
+    /**
+     * Method updateReporting.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateReporting(
+        Reporting value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "excludeDefaults",
+                ( value.isExcludeDefaults() == false )
+                    ? null
+                    : String.valueOf( value.isExcludeDefaults() ),
+                "false"
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "outputDirectory",
+                value.getOutputDirectory(),
+                null
+            );
+            iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
+        }
+    } // -- void updateReporting(Reporting, String, Counter, Element)
+
+    /**
+     * Method updateReportPlugin.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateReportPlugin(
+        ReportPlugin value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "groupId",
+            value.getGroupId(),
+            "org.apache.maven.plugins"
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "artifactId",
+            value.getArtifactId(),
+            null
+        );
+        findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
+        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
+        findAndReplaceXpp3DOM(
+            innerCount,
+            root,
+            "configuration",
+            (Xpp3Dom) value.getConfiguration()
+        );
+        iterateReportSet( innerCount, root, value.getReportSets(), "reportSets", "reportSet" );
+    } // -- void updateReportPlugin(ReportPlugin, String, Counter, Element)
+
+    /**
+     * Method updateReportSet.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateReportSet(
+        ReportSet value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
+        findAndReplaceXpp3DOM(
+            innerCount,
+            root,
+            "configuration",
+            (Xpp3Dom) value.getConfiguration()
+        );
+        findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
+        findAndReplaceSimpleLists( innerCount, root, value.getReports(), "reports", "report" );
+    } // -- void updateReportSet(ReportSet, String, Counter, Element)
+
+    /**
+     * Method updateRepository.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateRepository(
+        Repository value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root );
+        updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root );
+        findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" );
+    } // -- void updateRepository(Repository, String, Counter, Element)
+
+    /**
+     * Method updateRepositoryBase.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateRepositoryBase(
+        RepositoryBase value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "layout",
+                value.getLayout(),
+                "default"
+            );
+        }
+    } // -- void updateRepositoryBase(RepositoryBase, String, Counter, Element)
+
+    /**
+     * Method updateRepositoryPolicy.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateRepositoryPolicy(
+        RepositoryPolicy value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "enabled",
+                ( value.isEnabled() == true ) ? null : String.valueOf( value.isEnabled() ),
+                "true"
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "updatePolicy",
+                value.getUpdatePolicy(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "checksumPolicy",
+                value.getChecksumPolicy(),
+                null
+            );
+        }
+    } // -- void updateRepositoryPolicy(RepositoryPolicy, String, Counter, Element)
+
+    /**
+     * Method updateResource.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateResource(
+        Resource value,
+        String xmlTag,
+        Counter counter,
+        Element element
+    )
+    {
+        Element root = element;
+        Counter innerCount = new Counter( counter.getDepth() + 1 );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "targetPath",
+            value.getTargetPath(),
+            null
+        );
+        findAndReplaceSimpleElement(
+            innerCount,
+            root,
+            "filtering",
+            ( value.isFiltering() == false ) ? null : String.valueOf( value.isFiltering() ),
+            "false"
+        );
+        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
+        findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" );
+        findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" );
+    } // -- void updateResource(Resource, String, Counter, Element)
+
+    /**
+     * Method updateScm.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateScm( Scm value,
+                              String xmlTag,
+                              Counter counter,
+                              Element element )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "connection",
+                value.getConnection(),
+                null
+            );
+            findAndReplaceSimpleElement(
+                innerCount,
+                root,
+                "developerConnection",
+                value.getDeveloperConnection(),
+                null
+            );
+            findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        }
+    } // -- void updateScm(Scm, String, Counter, Element)
+
+    /**
+     * Method updateSite.
+     *
+     * @param value
+     * @param element
+     * @param counter
+     * @param xmlTag
+     */
+    protected void updateSite( Site value,
+                               String xmlTag,
+                               Counter counter,
+                               Element element )
+    {
+        boolean shouldExist = value != null;
+        Element root = updateElement( counter, element, xmlTag, shouldExist );
+        if ( shouldExist )
+        {
+            Counter innerCount = new Counter( counter.getDepth() + 1 );
+            findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
+            findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
+            findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
+        }
+    } // -- void updateSite(Site, String, Counter, Element)
+
+    // -----------------/
+    // - Inner Classes -/
+    // -----------------/
+
+    /**
+     * Class Counter.
+     *
+     * @version $Revision$ $Date$
+     */
+    public class Counter
+    {
+        // --------------------------/
+        // - Class/Member Variables -/
+        // --------------------------/
+
+        /** Field currentIndex. */
+        private int currentIndex = 0;
+
+        /** Field level. */
+        private int level;
+
+        // ----------------/
+        // - Constructors -/
+        // ----------------/
+
+        public Counter( int depthLevel )
+        {
+            level = depthLevel;
+        } // -- org.apache.maven.model.io.jdom.Counter(int)
+
+        // -----------/
+        // - Methods -/
+        // -----------/
+
+        /** Method getCurrentIndex. */
+        public int getCurrentIndex()
+        {
+            return currentIndex;
+        } // -- int getCurrentIndex()
+
+        /** Method getDepth. */
+        public int getDepth()
+        {
+            return level;
+        } // -- int getDepth()
+
+        /** Method increaseCount. */
+        public void increaseCount()
+        {
+            currentIndex = currentIndex + 1;
+        } // -- void increaseCount()
+    }
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java
index a712b9d..ae7e246 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java
@@ -1,70 +1,70 @@
-/*

- * 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.common;

-

-import org.apache.maven.archetype.exception.InvalidPackaging;

-import org.apache.maven.model.Model;

-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

-import org.dom4j.DocumentException;

-

-import java.io.File;

-import java.io.IOException;

-import java.io.InputStream;

-

-public interface PomManager

-{

-    String ROLE = PomManager.class.getName();

-

-    void addModule( File basedirPom,

-                    String artifactId )

-        throws

-        IOException,

-        XmlPullParserException,

-        DocumentException,

-        InvalidPackaging;

-

-    void addParent( File pom,

-                    File basedirPom )

-        throws

-        IOException,

-        XmlPullParserException;

-

-    void mergePoms( File pom,

-                    File temporaryPom )

-        throws

-        IOException,

-        XmlPullParserException;

-

-    Model readPom( File pomFile )

-        throws

-        IOException,

-        XmlPullParserException;

-    

-    Model readPom( InputStream pomStream )

-        throws

-        IOException,

-        XmlPullParserException;

-

-    void writePom( Model model,

-                   File pomFile,

-                   File initialPomFile )

-        throws

-        IOException;

-}

+package org.apache.maven.archetype.common;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.exception.InvalidPackaging;
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public interface PomManager
+{
+    String ROLE = PomManager.class.getName();
+
+    void addModule( File basedirPom,
+                    String artifactId )
+        throws
+        IOException,
+        XmlPullParserException,
+        DocumentException,
+        InvalidPackaging;
+
+    void addParent( File pom,
+                    File basedirPom )
+        throws
+        IOException,
+        XmlPullParserException;
+
+    void mergePoms( File pom,
+                    File temporaryPom )
+        throws
+        IOException,
+        XmlPullParserException;
+
+    Model readPom( File pomFile )
+        throws
+        IOException,
+        XmlPullParserException;
+
+    Model readPom( InputStream pomStream )
+        throws
+        IOException,
+        XmlPullParserException;
+
+    void writePom( Model model,
+                   File pomFile,
+                   File initialPomFile )
+        throws
+        IOException;
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/FileCharsetDetector.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/FileCharsetDetector.java
index 073a8d5..1912991 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/FileCharsetDetector.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/FileCharsetDetector.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.common.util;
-
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.mozilla.intl.chardet.nsDetector;
 import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
index 2671b82..9ac227c 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.archetype.common.util;
 
 import org.jdom.output.EscapeStrategy;
 
@@ -39,9 +40,6 @@
     implements Cloneable
 {
 
-    private static final String CVS_ID =
-        "@(#) $RCSfile: Format.java,v $ $Revision: 1.10 $ $Date: 2004/09/07 06:37:20 $ $Name: jdom_1_0 $";
-
     /**
      * Returns a new Format object that performs no whitespace changes, uses
      * the UTF-8 encoding, doesn't expand empty elements, includes the
@@ -437,18 +435,18 @@
 
         public DefaultEscapeStrategy( String encoding )
         {
-            if ( "UTF-8".equalsIgnoreCase( encoding ) ||
-                "UTF-16".equalsIgnoreCase( encoding ) )
+            if ( "UTF-8".equalsIgnoreCase( encoding )
+                || "UTF-16".equalsIgnoreCase( encoding ) )
             {
                 bits = 16;
             }
-            else if ( "ISO-8859-1".equalsIgnoreCase( encoding ) ||
-                "Latin1".equalsIgnoreCase( encoding ) )
+            else if ( "ISO-8859-1".equalsIgnoreCase( encoding )
+                || "Latin1".equalsIgnoreCase( encoding ) )
             {
                 bits = 8;
             }
-            else if ( "US-ASCII".equalsIgnoreCase( encoding ) ||
-                "ASCII".equalsIgnoreCase( encoding ) )
+            else if ( "US-ASCII".equalsIgnoreCase( encoding )
+                || "ASCII".equalsIgnoreCase( encoding ) )
             {
                 bits = 7;
             }
@@ -460,11 +458,11 @@
                 {
                     Class charsetClass = Class.forName( "java.nio.charset.Charset" );
                     Class encoderClass = Class.forName( "java.nio.charset.CharsetEncoder" );
-                    Method forName = charsetClass.getMethod( "forName", new Class[]{String.class} );
-                    Object charsetObj = forName.invoke( null, new Object[]{encoding} );
+                    Method forName = charsetClass.getMethod( "forName", new Class[] { String.class } );
+                    Object charsetObj = forName.invoke( null, new Object[] { encoding } );
                     Method newEncoder = charsetClass.getMethod( "newEncoder", null );
                     encoder = newEncoder.invoke( charsetObj, null );
-                    canEncode = encoderClass.getMethod( "canEncode", new Class[]{char.class} );
+                    canEncode = encoderClass.getMethod( "canEncode", new Class[] { char.class } );
                 }
                 catch ( Exception ignored )
                 {
@@ -480,17 +478,11 @@
             }
             if ( bits == 8 )
             {
-                if ( (int) ch > 255 )
-                    return true;
-                else
-                    return false;
+                return ( (int) ch > 255 );
             }
             if ( bits == 7 )
             {
-                if ( (int) ch > 127 )
-                    return true;
-                else
-                    return false;
+                return ( (int) ch > 127 );
             }
             else
             {
@@ -498,7 +490,7 @@
                 {
                     try
                     {
-                        Boolean val = (Boolean) canEncode.invoke( encoder, new Object[]{new Character( ch )} );
+                        Boolean val = (Boolean) canEncode.invoke( encoder, new Object[] { new Character( ch ) } );
                         return !val.booleanValue();
                     }
                     catch ( Exception ignored )
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
index 973d400..533e6ca 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.common.util;
-
 import org.codehaus.plexus.util.SelectorUtils;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -138,6 +138,12 @@
             // Bazaar
             "**/.bzr", "**/.bzr/**",
 
+            // GIT
+            "**/.git", "**/.git/**",
+
+            // Mercurial
+            "**/.hg",  "**/.hg/**",
+
             // SurroundSCM
             "**/.MySCMServerInfo",
 
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
index d2403bc..05cd8e9 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.archetype.common.util;
 
 import org.jdom.Namespace;
 
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
index 8d48234..6c53dd2 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.common.util;
-
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
index b843f42..9209993 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.common.util;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.archetype.common.util;
 
 import org.jdom.Attribute;
 import org.jdom.CDATA;
@@ -960,8 +961,8 @@
     {
         String str = ( currentFormat.mode == Format.TextMode.NORMALIZE )
             ? cdata.getTextNormalize()
-            : ( ( currentFormat.mode == Format.TextMode.TRIM ) ?
-            cdata.getText().trim() : cdata.getText() );
+            : ( ( currentFormat.mode == Format.TextMode.TRIM )
+                ? cdata.getText().trim() : cdata.getText() );
         out.write( "<![CDATA[" );
         out.write( str );
         out.write( "]]>" );
@@ -980,8 +981,8 @@
     {
         String str = ( currentFormat.mode == Format.TextMode.NORMALIZE )
             ? text.getTextNormalize()
-            : ( ( currentFormat.mode == Format.TextMode.TRIM ) ?
-            text.getText().trim() : text.getText() );
+            : ( ( currentFormat.mode == Format.TextMode.TRIM )
+                ? text.getText().trim() : text.getText() );
         out.write( escapeElementEntities( str ) );
     }
 
@@ -1061,7 +1062,9 @@
 
         // Print out attributes
         if ( attributes != null )
+        {
             printAttributes( out, attributes, element, namespaces );
+        }
 
         // Depending on the settings (newlines, textNormalize, etc), we may
         // or may not want to print all of the content, so determine the
@@ -1166,7 +1169,9 @@
                 if ( first < index )
                 {
                     if ( !firstNode )
+                    {
                         newline( out );
+                    }
                     indent( out, level );
                     printTextRange( out, content, first, index );
                 }
@@ -1259,8 +1264,7 @@
                 }
                 else
                 {
-                    throw new IllegalStateException( "Should see only " +
-                        "CDATA, Text, or EntityRef" );
+                    throw new IllegalStateException( "Should see only CDATA, Text, or EntityRef" );
                 }
 
                 // This may save a little time
@@ -1273,11 +1277,11 @@
                 // only need in trim or normalizing mode)
                 if ( previous != null )
                 { // Not 1st node
-                    if ( currentFormat.mode == Format.TextMode.NORMALIZE ||
-                        currentFormat.mode == Format.TextMode.TRIM )
+                    if ( currentFormat.mode == Format.TextMode.NORMALIZE
+                        || currentFormat.mode == Format.TextMode.TRIM )
                     {
-                        if ( ( endsWithWhite( previous ) ) ||
-                            ( startsWithWhite( next ) ) )
+                        if ( ( endsWithWhite( previous ) )
+                            || ( startsWithWhite( next ) ) )
                         {
                             out.write( " " );
                         }
@@ -1360,8 +1364,8 @@
         {
             Attribute attribute = (Attribute) attributes.get( i );
             Namespace ns = attribute.getNamespace();
-            if ( ( ns != Namespace.NO_NAMESPACE ) &&
-                ( ns != Namespace.XML_NAMESPACE ) )
+            if ( ( ns != Namespace.NO_NAMESPACE )
+                && ( ns != Namespace.XML_NAMESPACE ) )
             {
                 printNamespace( out, ns, namespaces );
             }
@@ -1391,8 +1395,8 @@
         {
             return;
         }
-        if ( !( ( ns == Namespace.NO_NAMESPACE ) &&
-            ( namespaces.getURI( "" ) == null ) ) )
+        if ( !( ( ns == Namespace.NO_NAMESPACE )
+            && ( namespaces.getURI( "" ) == null ) ) )
         {
             printNamespace( out, ns, namespaces );
         }
@@ -1446,8 +1450,8 @@
         throws
         IOException
     {
-        if ( currentFormat.indent == null ||
-            currentFormat.indent.equals( "" ) )
+        if ( currentFormat.indent == null
+            || currentFormat.indent.equals( "" ) )
         {
             return;
         }
@@ -1509,7 +1513,9 @@
             while ( index >= 0 )
             {
                 if ( !isAllWhitespace( content.get( index - 1 ) ) )
+                {
                     break;
+                }
                 --index;
             }
         }
@@ -1567,7 +1573,9 @@
         for ( int i = 0; i < str.length(); i++ )
         {
             if ( !isWhitespace( str.charAt( i ) ) )
+            {
                 return false;
+            }
         }
         return true;
     }
@@ -1575,36 +1583,20 @@
     // Determine if a string starts with a XML whitespace.
     private boolean startsWithWhite( String str )
     {
-        if ( ( str != null ) &&
-            ( str.length() > 0 ) &&
-            isWhitespace( str.charAt( 0 ) ) )
-        {
-            return true;
-        }
-        return false;
+        return ( ( str != null ) && ( str.length() > 0 ) && isWhitespace( str.charAt( 0 ) ) );
     }
 
     // Determine if a string ends with a XML whitespace.
     private boolean endsWithWhite( String str )
     {
-        if ( ( str != null ) &&
-            ( str.length() > 0 ) &&
-            isWhitespace( str.charAt( str.length() - 1 ) ) )
-        {
-            return true;
-        }
-        return false;
+        return ( ( str != null ) && ( str.length() > 0 ) && isWhitespace( str.charAt( str.length() - 1 ) ) );
     }
 
     // Determine if a character is a XML whitespace.
     // XXX should this method be in Verifier
     private static boolean isWhitespace( char c )
     {
-        if ( c == ' ' || c == '\n' || c == '\t' || c == '\r' )
-        {
-            return true;
-        }
-        return false;
+        return ( c == ' ' || c == '\n' || c == '\t' || c == '\r' );
     }
 
     /**
@@ -1711,7 +1703,10 @@
      */
     public String escapeElementEntities( String str )
     {
-        if ( escapeOutput == false ) return str;
+        if ( escapeOutput == false )
+        {
+            return str;
+        }
 
         StringBuffer buffer;
         char ch;
@@ -1834,13 +1829,13 @@
         }
 
         return (
-            "XMLOutputter[omitDeclaration = " + userFormat.omitDeclaration + ", " +
-                "encoding = " + userFormat.encoding + ", " +
-                "omitEncoding = " + userFormat.omitEncoding + ", " +
-                "indent = '" + userFormat.indent + "'" + ", " +
-                "expandEmptyElements = " + userFormat.expandEmptyElements + ", " +
-                "lineSeparator = '" + buffer.toString() + "', " +
-                "textMode = " + userFormat.mode + "]"
+            "XMLOutputter[omitDeclaration = " + userFormat.omitDeclaration + ", "
+                + "encoding = " + userFormat.encoding + ", "
+                + "omitEncoding = " + userFormat.omitEncoding + ", "
+                + "indent = '" + userFormat.indent + "'" + ", "
+                + "expandEmptyElements = " + userFormat.expandEmptyElements + ", "
+                + "lineSeparator = '" + buffer.toString() + "', "
+                + "textMode = " + userFormat.mode + "]"
         );
     }
 
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/ArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/ArchetypeCreator.java
index 0616107..749b4df 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/ArchetypeCreator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/ArchetypeCreator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.creator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,15 +19,15 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.creator;
-
 import org.apache.maven.archetype.ArchetypeCreationRequest;
 import org.apache.maven.archetype.ArchetypeCreationResult;
 
+/**
+ * Create an archetype from a project.
+ */
 public interface ArchetypeCreator
 {
     String ROLE = ArchetypeCreator.class.getName();
 
-    void createArchetype( ArchetypeCreationRequest request,
-                          ArchetypeCreationResult result );
+    void createArchetype( ArchetypeCreationRequest request, ArchetypeCreationResult result );
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
index 81f6508..4747b8a 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.creator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.creator;
-
 import org.apache.maven.archetype.ArchetypeCreationRequest;
 import org.apache.maven.archetype.ArchetypeCreationResult;
 import org.apache.maven.archetype.common.ArchetypeFilesResolver;
@@ -27,8 +27,6 @@
 import org.apache.maven.archetype.common.util.FileCharsetDetector;
 import org.apache.maven.archetype.common.util.ListScanner;
 import org.apache.maven.archetype.common.util.PathUtils;
-import org.apache.maven.archetype.creator.olddescriptor.OldArchetypeDescriptor;
-import org.apache.maven.archetype.creator.olddescriptor.OldArchetypeDescriptorXpp3Writer;
 import org.apache.maven.archetype.exception.TemplateCreationException;
 import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
 import org.apache.maven.archetype.metadata.FileSet;
@@ -42,24 +40,33 @@
 import org.apache.maven.model.Extension;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
 import org.apache.maven.model.Profile;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.DefaultInvoker;
+import org.apache.maven.shared.invoker.InvocationRequest;
+import org.apache.maven.shared.invoker.Invoker;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -70,12 +77,12 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-import org.apache.maven.shared.invoker.DefaultInvocationRequest;
-import org.apache.maven.shared.invoker.DefaultInvoker;
-import org.apache.maven.shared.invoker.InvocationRequest;
-import org.apache.maven.shared.invoker.Invoker;
 
-/** @plexus.component role-hint="fileset" */
+/**
+ * Create a 2.0.x Archetype from a project.
+ *
+ *  @plexus.component role-hint="fileset"
+ */
 public class FilesetArchetypeCreator
     extends AbstractLogEnabled
     implements ArchetypeCreator
@@ -89,8 +96,7 @@
     /** @plexus.requirement */
     private MavenProjectBuilder projectBuilder;
 
-    public void createArchetype( ArchetypeCreationRequest request,
-                                 ArchetypeCreationResult result )
+    public void createArchetype( ArchetypeCreationRequest request, ArchetypeCreationResult result )
     {
         MavenProject project = request.getProject();
         List languages = request.getLanguages();
@@ -103,65 +109,231 @@
 
         Properties properties = new Properties();
         Properties configurationProperties = new Properties();
-        if( request.getProperties() != null )
+        if ( request.getProperties() != null )
         {
             properties.putAll( request.getProperties() );
             configurationProperties.putAll( request.getProperties() );
         }
 
-        if( !properties.containsKey( Constants.GROUP_ID ) )
+        extractPropertiesFromProject( project, properties, configurationProperties, request.getPackageName() );
+
+        File basedir = project.getBasedir();
+        File generatedSourcesDirectory = FileUtils.resolveFile( basedir, getGeneratedSourcesDirectory() );
+        generatedSourcesDirectory.mkdirs();
+
+        getLogger().debug( "Creating archetype in " + generatedSourcesDirectory );
+
+        try
+        {
+            File archetypePomFile =
+                createArchetypeProjectPom( project, localRepository, configurationProperties, generatedSourcesDirectory );
+
+            File archetypeResourcesDirectory = new File( generatedSourcesDirectory, getTemplateOutputDirectory() );
+
+            File archetypeFilesDirectory = new File( archetypeResourcesDirectory, Constants.ARCHETYPE_RESOURCES );
+            getLogger().debug( "Archetype's files output directory " + archetypeFilesDirectory );
+
+            File archetypeDescriptorFile = new File( archetypeResourcesDirectory, Constants.ARCHETYPE_DESCRIPTOR );
+            archetypeDescriptorFile.getParentFile().mkdirs();
+
+            getLogger().debug( "Starting archetype's descriptor " + project.getArtifactId() );
+            ArchetypeDescriptor archetypeDescriptor = new ArchetypeDescriptor();
+
+            archetypeDescriptor.setName( project.getArtifactId() );
+            archetypeDescriptor.setPartial( partialArchetype );
+
+            addRequiredProperties( archetypeDescriptor, properties );
+
+            // TODO ensure reverseProperties contains NO dotted properties
+            Properties reverseProperties = getRequiredProperties( archetypeDescriptor, properties );
+            // reverseProperties.remove( Constants.GROUP_ID );
+
+            // TODO ensure pomReversedProperties contains NO dotted properties
+            Properties pomReversedProperties = getRequiredProperties( archetypeDescriptor, properties );
+            // pomReversedProperties.remove( Constants.PACKAGE );
+
+            String packageName = configurationProperties.getProperty( Constants.PACKAGE );
+
+            Model pom = pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
+
+            List fileNames = resolveFileNames( pom, basedir );
+            if ( getLogger().isDebugEnabled() )
+            {
+                getLogger().debug( "Scanned for files " + fileNames.size() );
+
+                for ( Iterator names = fileNames.iterator(); names.hasNext(); )
+                {
+                    getLogger().debug( "- " + names.next().toString() );
+                }
+            }
+
+            List filesets = resolveFileSets( packageName, fileNames, languages, filtereds, defaultEncoding );
+            getLogger().debug( "Resolved filesets for " + archetypeDescriptor.getName() );
+
+            archetypeDescriptor.setFileSets( filesets );
+
+            createArchetypeFiles( reverseProperties, filesets, packageName, basedir, archetypeFilesDirectory, defaultEncoding );
+            getLogger().debug( "Created files for " + archetypeDescriptor.getName() );
+
+            setParentArtifactId( reverseProperties, configurationProperties.getProperty( Constants.ARTIFACT_ID ) );
+
+            for ( Iterator modules = pom.getModules().iterator(); 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, rootArtifactId, moduleId, packageName,
+                                  FileUtils.resolveFile( basedir, moduleId ),
+                                  new File( archetypeFilesDirectory, moduleIdDirectory ), languages,
+                                  filtereds, defaultEncoding, preserveCData, keepParent );
+
+                archetypeDescriptor.addModule( moduleDescriptor );
+
+                getLogger().debug(
+                                   "Added module " + moduleDescriptor.getName() + " in "
+                                       + archetypeDescriptor.getName() );
+            }
+
+            restoreParentArtifactId( reverseProperties, null );
+            restoreArtifactId( reverseProperties, configurationProperties.getProperty( Constants.ARTIFACT_ID ) );
+
+            createPoms( pom, configurationProperties.getProperty( Constants.ARTIFACT_ID ),
+                        configurationProperties.getProperty( Constants.ARTIFACT_ID ), archetypeFilesDirectory, basedir,
+                        pomReversedProperties, preserveCData, keepParent );
+            getLogger().debug( "Created Archetype " + archetypeDescriptor.getName() + " template pom(s)" );
+
+            Writer out = null;
+            try
+            {
+                out = WriterFactory.newXmlWriter( archetypeDescriptorFile );
+
+                ArchetypeDescriptorXpp3Writer writer = new ArchetypeDescriptorXpp3Writer();
+
+                writer.write( out, archetypeDescriptor );
+
+                getLogger().debug( "Archetype " + archetypeDescriptor.getName() + " descriptor written" );
+            }
+            finally
+            {
+                IOUtil.close( out );
+            }
+
+            createArchetypeBasicIt( archetypeDescriptor, generatedSourcesDirectory );
+
+            InvocationRequest internalRequest = new DefaultInvocationRequest();
+            internalRequest.setPomFile( archetypePomFile );
+            internalRequest.setGoals( Collections.singletonList( request.getPostPhase() ) );
+
+            Invoker invoker = new DefaultInvoker();
+            invoker.execute( internalRequest );
+        }
+        catch ( Exception e )
+        {
+            result.setCause( e );
+        }
+    }
+
+    /**
+     * Create an archetype IT, ie goals.txt and archetype.properties in src/test/resources/projects/basic.
+     *
+     * @param archetypeDescriptor
+     * @param generatedSourcesDirectory
+     * @throws IOException
+     */
+    private void createArchetypeBasicIt( ArchetypeDescriptor archetypeDescriptor, File generatedSourcesDirectory )
+        throws IOException
+    {
+        String basic = Constants.SRC + File.separator + Constants.TEST + File.separator + Constants.RESOURCES
+            + File.separator + "projects" + File.separator + "basic";
+        File basicItDirectory = new File( generatedSourcesDirectory, basic );
+        basicItDirectory.mkdirs();
+
+        InputStream in = null;
+        OutputStream out = null;
+
+        try
+        {
+            in = FilesetArchetypeCreator.class.getResourceAsStream( "archetype.properties" );
+
+            Properties archetypeProperties = new Properties();
+            archetypeProperties.load( in );
+
+            for ( Iterator iter = archetypeDescriptor.getRequiredProperties().iterator(); iter.hasNext(); )
+            {
+                RequiredProperty req = (RequiredProperty) iter.next();
+
+                archetypeProperties.put( req.getKey(), req.getDefaultValue() );
+            }
+
+            out = new FileOutputStream( new File( basicItDirectory, "archetype.properties" ) );
+            archetypeProperties.store( out, null );
+        }
+        finally
+        {
+            IOUtil.close( in );
+            IOUtil.close( out );
+        }
+        copyResource( "goal.txt", new File( basicItDirectory, "goal.txt" ) );
+
+        getLogger().debug( "Added basic integration test" );
+    }
+
+    private void extractPropertiesFromProject( MavenProject project, Properties properties,
+                                               Properties configurationProperties, String packageName )
+    {
+        if ( !properties.containsKey( Constants.GROUP_ID ) )
         {
             properties.setProperty( Constants.GROUP_ID, project.getGroupId() );
         }
-        configurationProperties.setProperty(
-            Constants.GROUP_ID,
-            properties.getProperty( Constants.GROUP_ID )
-        );
+        configurationProperties.setProperty( Constants.GROUP_ID, properties.getProperty( Constants.GROUP_ID ) );
 
-        if( !properties.containsKey( Constants.ARTIFACT_ID ) )
+        if ( !properties.containsKey( Constants.ARTIFACT_ID ) )
         {
             properties.setProperty( Constants.ARTIFACT_ID, project.getArtifactId() );
         }
-        configurationProperties.setProperty(
-            Constants.ARTIFACT_ID,
-            properties.getProperty( Constants.ARTIFACT_ID )
-        );
+        configurationProperties.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );
 
-        if( !properties.containsKey( Constants.VERSION ) )
+        if ( !properties.containsKey( Constants.VERSION ) )
         {
             properties.setProperty( Constants.VERSION, project.getVersion() );
         }
-        configurationProperties.setProperty(
-            Constants.VERSION,
-            properties.getProperty( Constants.VERSION )
-        );
+        configurationProperties.setProperty( Constants.VERSION, properties.getProperty( Constants.VERSION ) );
 
-        if( request.getPackageName() != null )
+        if ( packageName != null )
         {
-            properties.setProperty( Constants.PACKAGE, request.getPackageName() );
+            properties.setProperty( Constants.PACKAGE, packageName );
         }
-        else if( !properties.containsKey( Constants.PACKAGE ) )
+        else if ( !properties.containsKey( Constants.PACKAGE ) )
         {
             properties.setProperty( Constants.PACKAGE, project.getGroupId() );
         }
-        configurationProperties.setProperty(
-            Constants.PACKAGE,
-            properties.getProperty( Constants.PACKAGE )
-        );
-           
-        File basedir = project.getBasedir();
-        File generatedSourcesDirectory =
-            FileUtils.resolveFile( basedir, getGeneratedSourcesDirectory() );
-        generatedSourcesDirectory.mkdirs();
-        getLogger().debug( "Creating archetype in " + generatedSourcesDirectory );
+        configurationProperties.setProperty( Constants.PACKAGE, properties.getProperty( Constants.PACKAGE ) );
+    }
 
+    /**
+     * Create the archetype project pom.xml file, that will be used to build the archetype.
+     */
+    private File createArchetypeProjectPom( MavenProject project, ArtifactRepository localRepository,
+                                            Properties configurationProperties, File projectDir )
+        throws TemplateCreationException, IOException
+    {
         Model model = new Model();
         model.setModelVersion( "4.0.0" );
-        model.setGroupId( configurationProperties.getProperty(Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ) );// these values should be retrieve from the requst with sensible defaults
-        model.setArtifactId( configurationProperties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) );
-        model.setVersion( configurationProperties.getProperty(Constants.ARCHETYPE_VERSION, project.getVersion() ) );
+        // these values should be retrieved from the request with sensible defaults
+        model.setGroupId( configurationProperties.getProperty( Constants.ARCHETYPE_GROUP_ID, project.getGroupId() ) );
+        model.setArtifactId( configurationProperties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) );
+        model.setVersion( configurationProperties.getProperty( Constants.ARCHETYPE_VERSION, project.getVersion() ) );
         model.setPackaging( "maven-archetype" );
-        model.setName( configurationProperties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) );
+        model.setName( configurationProperties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId() ) );
 
         Build build = new Build();
         model.setBuild( build );
@@ -199,10 +371,8 @@
             }
             catch ( ProjectBuildingException e )
             {
-                result.setCause( new TemplateCreationException(
-                    "Error reading parent POM of project: " + pa.getGroupId() + ":" + pa.getArtifactId() + ":" + pa.getVersion() ) );
-
-                return;
+                throw new TemplateCreationException( "Error reading parent POM of project: " + pa.getGroupId() + ":"
+                    + pa.getArtifactId() + ":" + pa.getVersion() );
             }
         }
 
@@ -217,155 +387,45 @@
         plugin.setArtifactId( "maven-archetype-plugin" );
         plugin.setVersion( getArchetypeVersion() );
         plugin.setExtensions( true );
-        model.getBuild().addPlugin( plugin );
+
+        PluginManagement pluginManagement = new PluginManagement();
+        pluginManagement.addPlugin( plugin );
+        model.getBuild().setPluginManagement( pluginManagement );
+
         getLogger().debug( "Creating archetype's pom" );
 
-        File archetypePomFile = FileUtils.resolveFile( basedir, getArchetypePom() );
+        File archetypePomFile = new File( projectDir, Constants.ARCHETYPE_POM );
 
         archetypePomFile.getParentFile().mkdirs();
 
-        try
-        {
-            pomManager.writePom( model, archetypePomFile, archetypePomFile );
-        }
-        catch ( IOException e )
-        {
-            result.setCause( e );
-        }
+        copyResource( "pom-prototype.xml", archetypePomFile );
 
-        File archetypeResourcesDirectory = FileUtils.resolveFile( generatedSourcesDirectory, getTemplateOutputDirectory() );
-        archetypeResourcesDirectory.mkdirs();
+        pomManager.writePom( model, archetypePomFile, archetypePomFile );
 
-        File archetypeFilesDirectory = FileUtils.resolveFile( archetypeResourcesDirectory, Constants.ARCHETYPE_RESOURCES );
-        archetypeFilesDirectory.mkdirs();
-        getLogger().debug( "Archetype's files output directory " + archetypeFilesDirectory );
+        return archetypePomFile;
+    }
 
-        File archetypeDescriptorFile = FileUtils.resolveFile( archetypeResourcesDirectory, Constants.ARCHETYPE_DESCRIPTOR );
-        archetypeDescriptorFile.getParentFile().mkdirs();
-
-        ArchetypeDescriptor archetypeDescriptor = new ArchetypeDescriptor();
-        archetypeDescriptor.setName( project.getArtifactId() );
-        getLogger().debug( "Starting archetype's descriptor " + project.getArtifactId() );
-        archetypeDescriptor.setPartial( partialArchetype );
-
-        addRequiredProperties( archetypeDescriptor, properties );
-
-        // TODO ensure reversedproperties contains NO dotted properties
-        Properties reverseProperties = getRequiredProperties( archetypeDescriptor, properties );
-        //reverseProperties.remove( Constants.GROUP_ID );
-        
-        // TODO ensure pomReversedProperties contains NO dotted properties
-        Properties pomReversedProperties = getRequiredProperties( archetypeDescriptor, properties );
-        //pomReversedProperties.remove( Constants.PACKAGE );
-
-        String packageName = configurationProperties.getProperty( Constants.PACKAGE );
+    private void copyResource( String name, File destination )
+        throws IOException
+    {
+        InputStream in = null;
+        OutputStream out = null;
 
         try
         {
-            Model pom = pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
+            in = FilesetArchetypeCreator.class.getResourceAsStream( name );
+            out = new FileOutputStream( destination );
 
-            List fileNames = resolveFileNames( pom, basedir );
-            getLogger().debug( "Scanned for files " + fileNames.size() );
-
-            Iterator names = fileNames.iterator();
-
-            while ( names.hasNext() )
-            {
-                getLogger().debug( "- " + names.next().toString() );
-            }
-
-            List filesets = resolveFileSets( packageName, fileNames, languages, filtereds, defaultEncoding );
-            getLogger().debug( "Resolved filesets for " + archetypeDescriptor.getName() );
-
-            archetypeDescriptor.setFileSets( filesets );
-
-            createArchetypeFiles( reverseProperties, filesets, packageName, basedir, archetypeFilesDirectory, defaultEncoding );
-            getLogger().debug( "Created files for " + archetypeDescriptor.getName() );
-
-            setParentArtifactId(
-                reverseProperties,
-                configurationProperties.getProperty( Constants.ARTIFACT_ID )
-            );
-
-            Iterator modules = pom.getModules().iterator();
-            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,
-                        rootArtifactId,
-                        moduleId,
-                        packageName,
-                        FileUtils.resolveFile( basedir, moduleId ),
-                        FileUtils.resolveFile( archetypeFilesDirectory, moduleIdDirectory ),
-                        languages,
-                        filtereds,
-                        defaultEncoding,
-                        preserveCData,
-                        keepParent
-                    );
-
-                archetypeDescriptor.addModule( moduleDescriptor );
-                getLogger().debug(
-                    "Added module " + moduleDescriptor.getName() + " in "
-                        + archetypeDescriptor.getName()
-                );
-            }
-            restoreParentArtifactId( reverseProperties, null );
-            restoreArtifactId(
-                reverseProperties,
-                configurationProperties.getProperty( Constants.ARTIFACT_ID )
-            );
-
-            createPoms( pom, configurationProperties.getProperty( Constants.ARTIFACT_ID ),
-                configurationProperties.getProperty( Constants.ARTIFACT_ID ),
-                archetypeFilesDirectory, basedir,
-                pomReversedProperties, preserveCData, keepParent );
-            getLogger().debug( "Created Archetype " + archetypeDescriptor.getName() + " pom" );
-
-            ArchetypeDescriptorXpp3Writer writer = new ArchetypeDescriptorXpp3Writer();
-            writer.write( new FileWriter( archetypeDescriptorFile ), archetypeDescriptor );
-            getLogger().debug( "Archetype " + archetypeDescriptor.getName() + " descriptor written" );
-
-            OldArchetypeDescriptor oldDescriptor =
-                convertToOldDescriptor( archetypeDescriptor.getName(), packageName, basedir );
-            File oldDescriptorFile =
-                FileUtils.resolveFile(
-                    archetypeResourcesDirectory,
-                    Constants.OLD_ARCHETYPE_DESCRIPTOR
-                );
-            archetypeDescriptorFile.getParentFile().mkdirs();
-            writeOldDescriptor( oldDescriptor, oldDescriptorFile );
-            getLogger().debug(
-                "Archetype " + archetypeDescriptor.getName() + " old descriptor written"
-            );
-            
-            InvocationRequest internalRequest = new DefaultInvocationRequest();
-            internalRequest.setPomFile( archetypePomFile );
-            internalRequest.setGoals( Collections.singletonList( request.getPostPhase() ) );
-
-            Invoker invoker = new DefaultInvoker();
-            invoker.execute(internalRequest);
+            IOUtil.copy( in, out );
         }
-        catch ( Exception e )
+        finally
         {
-            result.setCause( e );
+            IOUtil.close( in );
+            IOUtil.close( out );
         }
     }
 
-    private void addRequiredProperties(
-        ArchetypeDescriptor archetypeDescriptor,
-        Properties properties
-    )
+    private void addRequiredProperties( ArchetypeDescriptor archetypeDescriptor, Properties properties )
     {
         Properties requiredProperties = new Properties();
         requiredProperties.putAll( properties );
@@ -377,127 +437,85 @@
         requiredProperties.remove( Constants.VERSION );
         requiredProperties.remove( Constants.PACKAGE );
 
-        Iterator propertiesIterator = requiredProperties.keySet().iterator();
-        while ( propertiesIterator.hasNext() )
+        for ( Iterator propertiesIterator = requiredProperties.keySet().iterator(); propertiesIterator.hasNext(); )
         {
             String propertyKey = (String) propertiesIterator.next();
+
             RequiredProperty requiredProperty = new RequiredProperty();
             requiredProperty.setKey( propertyKey );
             requiredProperty.setDefaultValue( requiredProperties.getProperty( propertyKey ) );
+
             archetypeDescriptor.addRequiredProperty( requiredProperty );
 
             getLogger().debug(
-                "Adding requiredProperty " + propertyKey + "="
-                    + requiredProperties.getProperty( propertyKey ) + " to archetype's descriptor"
-            );
+                               "Adding requiredProperty " + propertyKey + "="
+                                   + requiredProperties.getProperty( propertyKey ) + " to archetype's descriptor" );
         }
     }
 
-    private void createModulePoms(
-        Properties pomReversedProperties,
-        String rootArtifactId,
-        String packageName,
-        File basedir,
-        File archetypeFilesDirectory,
-        boolean preserveCData,
-        boolean keepParent )
-        throws
-        FileNotFoundException,
-        IOException,
-        XmlPullParserException
+    private void createModulePoms( Properties pomReversedProperties, String rootArtifactId, String packageName,
+                                   File basedir, File archetypeFilesDirectory, boolean preserveCData, boolean keepParent )
+        throws FileNotFoundException, IOException, XmlPullParserException
     {
-        Model pom =
-            pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
+        Model pom = pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
 
         String parentArtifactId = pomReversedProperties.getProperty( Constants.PARENT_ARTIFACT_ID );
         String artifactId = pom.getArtifactId();
         setParentArtifactId( pomReversedProperties, pomReversedProperties.getProperty( Constants.ARTIFACT_ID ) );
         setArtifactId( pomReversedProperties, pom.getArtifactId() );
 
-        Iterator modules = pom.getModules().iterator();
-        while ( modules.hasNext() )
+        for ( Iterator modules = pom.getModules().iterator(); 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, subModuleIdDirectory ),
-                preserveCData,
-                keepParent
-            );
+            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, subModuleIdDirectory ),
+                              preserveCData, keepParent );
         }
-        createModulePom(
-            pom,
-            rootArtifactId,
-            archetypeFilesDirectory,
-            pomReversedProperties,
-            FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ),
-            preserveCData,
-            keepParent
-        );
+
+        createModulePom( pom, rootArtifactId, archetypeFilesDirectory, pomReversedProperties,
+                         FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ), preserveCData, keepParent );
+
         restoreParentArtifactId( pomReversedProperties, parentArtifactId );
         restoreArtifactId( pomReversedProperties, artifactId );
     }
 
-    private void createPoms( Model pom,
-                             String rootArtifactId,
-                             String artifactId,
-                             File archetypeFilesDirectory,
-                             File basedir,
-                             Properties pomReversedProperties,
-                             boolean preserveCData,
-                             boolean keepParent )
-        throws
-        IOException,
-        FileNotFoundException,
-        XmlPullParserException
+    private void createPoms( Model pom, String rootArtifactId, String artifactId, File archetypeFilesDirectory,
+                             File basedir, Properties pomReversedProperties, boolean preserveCData, boolean keepParent )
+        throws IOException, FileNotFoundException, XmlPullParserException
     {
         setArtifactId( pomReversedProperties, pom.getArtifactId() );
 
-        Iterator modules = pom.getModules().iterator();
-        while ( modules.hasNext() )
+        for ( Iterator modules = pom.getModules().iterator(); 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, moduleIdDirectory ),
-                preserveCData,
-                keepParent
-            );
+            String moduleIdDirectory = moduleId;
+
+            if ( moduleId.indexOf( rootArtifactId ) >= 0 )
+            {
+                moduleIdDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
+            }
+
+            createModulePoms( pomReversedProperties, rootArtifactId, moduleId,
+                              FileUtils.resolveFile( basedir, moduleId ),
+                              new File( archetypeFilesDirectory, moduleIdDirectory ),
+                              preserveCData, keepParent );
         }
+
         restoreParentArtifactId( pomReversedProperties, null );
         restoreArtifactId( pomReversedProperties, artifactId );
 
-        createArchetypePom(
-            pom,
-            archetypeFilesDirectory,
-            pomReversedProperties,
-            FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ),
-            preserveCData,
-            keepParent
-        );
-    }
-
-    private String getArchetypePom()
-    {
-        return getGeneratedSourcesDirectory() + File.separator + Constants.ARCHETYPE_POM;
+        createArchetypePom( pom, archetypeFilesDirectory, pomReversedProperties,
+                            FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ), preserveCData, keepParent );
     }
 
     private String getPackageInPathFormat( String aPackage )
@@ -505,283 +523,231 @@
         return StringUtils.replace( aPackage, ".", "/" );
     }
 
-    private void rewriteReferences( Model pom,
-                                    String rootArtifactId,
-                                    String groupId )
+    private void rewriteReferences( Model pom, String rootArtifactId, String groupId )
     {
         // rewrite Dependencies
-        if ( pom.getDependencies() != null && !pom.getDependencies().
-            isEmpty() )
+        if ( pom.getDependencies() != null && !pom.getDependencies().isEmpty() )
         {
-            Iterator dependencies = pom.getDependencies().iterator();
-            while ( dependencies.hasNext() )
+            for ( Iterator dependencies = pom.getDependencies().iterator(); dependencies.hasNext(); )
             {
-                Dependency dependency =
-                    (Dependency) dependencies.next();
+                Dependency dependency = (Dependency) dependencies.next();
 
-                if ( dependency.getArtifactId() != null &&
-                    dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
+                if ( dependency.getArtifactId() != null && dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                 {
                     if ( dependency.getGroupId() != null )
                     {
-                        dependency.setGroupId( StringUtils.replace( dependency.getGroupId(),
-                            groupId,
-                            "${" +
-                                Constants.GROUP_ID + "}" ) );
+                        dependency.setGroupId( StringUtils.replace( dependency.getGroupId(), groupId,
+                                                                    "${" + Constants.GROUP_ID + "}" ) );
                     }
-                    dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(),
-                        rootArtifactId, "${rootArtifactId}" ) );
+
+                    dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(), rootArtifactId,
+                                                                   "${rootArtifactId}" ) );
+
                     if ( dependency.getVersion() != null )
                     {
-                        dependency.setVersion( "${" +
-                            Constants.VERSION + "}" );
+                        dependency.setVersion( "${" + Constants.VERSION + "}" );
                     }
                 }
             }
         }
 
         // rewrite DependencyManagement
-        if ( pom.getDependencyManagement() != null &&
-            pom.getDependencyManagement().getDependencies() != null &&
-            !pom.getDependencyManagement().getDependencies().isEmpty() )
+        if ( pom.getDependencyManagement() != null && pom.getDependencyManagement().getDependencies() != null
+            && !pom.getDependencyManagement().getDependencies().isEmpty() )
         {
-            Iterator dependencies =
-                pom.getDependencyManagement().getDependencies().iterator();
-            while ( dependencies.hasNext() )
+            for ( Iterator dependencies = pom.getDependencyManagement().getDependencies().iterator();
+                dependencies.hasNext(); )
             {
-                Dependency dependency =
-                    (Dependency) dependencies.next();
+                Dependency dependency = (Dependency) dependencies.next();
 
-                if ( dependency.getArtifactId() != null &&
-                    dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
+                if ( dependency.getArtifactId() != null && dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                 {
                     if ( dependency.getGroupId() != null )
                     {
-                        dependency.setGroupId( StringUtils.replace( dependency.getGroupId(),
-                            groupId,
-                            "${" +
-                                Constants.GROUP_ID + "}" ) );
+                        dependency.setGroupId( StringUtils.replace( dependency.getGroupId(), groupId,
+                                                                    "${" + Constants.GROUP_ID + "}" ) );
                     }
-                    dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(),
-                        rootArtifactId, "${rootArtifactId}" ) );
+
+                    dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(), rootArtifactId,
+                                                                   "${rootArtifactId}" ) );
+
                     if ( dependency.getVersion() != null )
                     {
-                        dependency.setVersion( "${" +
-                            Constants.VERSION + "}" );
+                        dependency.setVersion( "${" + Constants.VERSION + "}" );
                     }
                 }
             }
         }
 
         // rewrite Plugins
-        if ( pom.getBuild() != null && pom.getBuild().getPlugins() !=
-            null && !pom.getBuild().getPlugins().isEmpty() )
+        if ( pom.getBuild() != null && pom.getBuild().getPlugins() != null && !pom.getBuild().getPlugins().isEmpty() )
         {
-            Iterator plugins = pom.getBuild().getPlugins().iterator();
-            while ( plugins.hasNext() )
+            for ( Iterator plugins = pom.getBuild().getPlugins().iterator(); plugins.hasNext(); )
             {
                 Plugin plugin = (Plugin) plugins.next();
 
-                if ( plugin.getArtifactId() != null &&
-                    plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
+                if ( plugin.getArtifactId() != null && plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                 {
                     if ( plugin.getGroupId() != null )
                     {
-                        plugin.setGroupId( StringUtils.replace( plugin.getGroupId(),
-                            groupId,
-                            "${" +
-                                Constants.GROUP_ID + "}" ) );
+                        plugin.setGroupId( StringUtils.replace( plugin.getGroupId(), groupId,
+                                                                "${" + Constants.GROUP_ID + "}" ) );
                     }
-                    plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(),
-                        rootArtifactId, "${rootArtifactId}" ) );
+
+                    plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(), rootArtifactId,
+                                                               "${rootArtifactId}" ) );
+
                     if ( plugin.getVersion() != null )
                     {
-                        plugin.setVersion( "${" +
-                            Constants.VERSION + "}" );
+                        plugin.setVersion( "${" + Constants.VERSION + "}" );
                     }
                 }
             }
         }
 
         // rewrite PluginManagement
-        if ( pom.getBuild() != null &&
-            pom.getBuild().getPluginManagement() != null &&
-            pom.getBuild().getPluginManagement().getPlugins() != null &&
-            !pom.getBuild().getPluginManagement().getPlugins().
-                isEmpty() )
+        if ( pom.getBuild() != null && pom.getBuild().getPluginManagement() != null
+            && pom.getBuild().getPluginManagement().getPlugins() != null
+            && !pom.getBuild().getPluginManagement().getPlugins().isEmpty() )
         {
-            Iterator plugins =
-                pom.getBuild().getPluginManagement().getPlugins().
-                    iterator();
-            while ( plugins.hasNext() )
+            for ( Iterator plugins = pom.getBuild().getPluginManagement().getPlugins().iterator(); plugins.hasNext(); )
             {
                 Plugin plugin = (Plugin) plugins.next();
 
-                if ( plugin.getArtifactId() != null &&
-                    plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
+                if ( plugin.getArtifactId() != null && plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                 {
                     if ( plugin.getGroupId() != null )
                     {
-                        plugin.setGroupId( StringUtils.replace( plugin.getGroupId(),
-                            groupId,
-                            "${" +
-                                Constants.GROUP_ID + "}" ) );
+                        plugin.setGroupId( StringUtils.replace( plugin.getGroupId(), groupId,
+                                                                "${" + Constants.GROUP_ID + "}" ) );
                     }
-                    plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(),
-                        rootArtifactId, "${rootArtifactId}" ) );
+
+                    plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(), rootArtifactId,
+                                                               "${rootArtifactId}" ) );
+
                     if ( plugin.getVersion() != null )
                     {
-                        plugin.setVersion( "${" +
-                            Constants.VERSION + "}" );
+                        plugin.setVersion( "${" + Constants.VERSION + "}" );
                     }
                 }
             }
         }
+
         // rewrite Profiles
         if ( pom.getProfiles() != null )
         {
-            Iterator profiles = pom.getProfiles().iterator();
-            while ( profiles.hasNext() )
+            for ( Iterator profiles = pom.getProfiles().iterator(); profiles.hasNext(); )
             {
                 Profile profile = (Profile) profiles.next();
 
                 // rewrite Dependencies
-                if ( profile.getDependencies() != null &&
-                    !profile.getDependencies().isEmpty() )
+                if ( profile.getDependencies() != null && !profile.getDependencies().isEmpty() )
                 {
-                    Iterator dependencies = profile.getDependencies().
-                        iterator();
-                    while ( dependencies.hasNext() )
+                    for ( Iterator dependencies = profile.getDependencies().iterator(); dependencies.hasNext(); )
                     {
-                        Dependency dependency =
-                            (Dependency) dependencies.next();
+                        Dependency dependency = (Dependency) dependencies.next();
 
-                        if ( dependency.getArtifactId() != null &&
-                            dependency.getArtifactId().
-                                indexOf( rootArtifactId ) >= 0 )
+                        if ( dependency.getArtifactId() != null
+                            && dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                         {
                             if ( dependency.getGroupId() != null )
                             {
-                                dependency.setGroupId( StringUtils.replace( dependency.getGroupId(),
-                                    groupId,
-                                    "${" +
-                                        Constants.GROUP_ID + "}" ) );
+                                dependency.setGroupId( StringUtils.replace( dependency.getGroupId(), groupId,
+                                                                            "${" + Constants.GROUP_ID + "}" ) );
                             }
-                            dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(),
-                                rootArtifactId, "${rootArtifactId}" ) );
+
+                            dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(), rootArtifactId,
+                                                                           "${rootArtifactId}" ) );
+
                             if ( dependency.getVersion() != null )
                             {
-                                dependency.setVersion( "${" +
-                                    Constants.VERSION + "}" );
+                                dependency.setVersion( "${" + Constants.VERSION + "}" );
                             }
                         }
                     }
                 }
 
                 // rewrite DependencyManagement
-                if ( profile.getDependencyManagement() != null &&
-                    profile.getDependencyManagement().getDependencies() !=
-                        null &&
-                    !profile.getDependencyManagement().getDependencies().
-                        isEmpty() )
+                if ( profile.getDependencyManagement() != null
+                    && profile.getDependencyManagement().getDependencies() != null
+                    && !profile.getDependencyManagement().getDependencies().isEmpty() )
                 {
-                    Iterator dependencies =
-                        profile.getDependencyManagement().getDependencies().
-                            iterator();
-                    while ( dependencies.hasNext() )
+                    for ( Iterator dependencies = profile.getDependencyManagement().getDependencies().iterator();
+                        dependencies.hasNext(); )
                     {
-                        Dependency dependency =
-                            (Dependency) dependencies.next();
+                        Dependency dependency = (Dependency) dependencies.next();
 
-                        if ( dependency.getArtifactId() != null &&
-                            dependency.getArtifactId().
-                                indexOf( rootArtifactId ) >= 0 )
+                        if ( dependency.getArtifactId() != null
+                            && dependency.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                         {
                             if ( dependency.getGroupId() != null )
                             {
-                                dependency.setGroupId( StringUtils.replace( dependency.getGroupId(),
-                                    groupId,
-                                    "${" +
-                                        Constants.GROUP_ID + "}" ) );
+                                dependency.setGroupId( StringUtils.replace( dependency.getGroupId(), groupId,
+                                                                            "${" + Constants.GROUP_ID + "}" ) );
                             }
-                            dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(),
-                                rootArtifactId, "${rootArtifactId}" ) );
+
+                            dependency.setArtifactId( StringUtils.replace( dependency.getArtifactId(), rootArtifactId,
+                                                                           "${rootArtifactId}" ) );
+
                             if ( dependency.getVersion() != null )
                             {
-                                dependency.setVersion( "${" +
-                                    Constants.VERSION + "}" );
+                                dependency.setVersion( "${" + Constants.VERSION + "}" );
                             }
                         }
                     }
                 }
 
                 // rewrite Plugins
-                if ( profile.getBuild() != null &&
-                    profile.getBuild().getPlugins() != null &&
-                    !profile.getBuild().getPlugins().isEmpty() )
+                if ( profile.getBuild() != null && profile.getBuild().getPlugins() != null
+                    && !profile.getBuild().getPlugins().isEmpty() )
                 {
-                    Iterator plugins = profile.getBuild().getPlugins().
-                        iterator();
-                    while ( plugins.hasNext() )
+                    for ( Iterator plugins = profile.getBuild().getPlugins().iterator(); plugins.hasNext(); )
                     {
-                        Plugin plugin =
-                            (Plugin) plugins.next();
+                        Plugin plugin = (Plugin) plugins.next();
 
-                        if ( plugin.getArtifactId() != null &&
-                            plugin.getArtifactId().indexOf( rootArtifactId ) >=
-                                0 )
+                        if ( plugin.getArtifactId() != null && plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                         {
                             if ( plugin.getGroupId() != null )
                             {
-                                plugin.setGroupId( StringUtils.replace( plugin.getGroupId(),
-                                    groupId,
-                                    "${" +
-                                        Constants.GROUP_ID + "}" ) );
+                                plugin.setGroupId( StringUtils.replace( plugin.getGroupId(), groupId,
+                                                                        "${" + Constants.GROUP_ID + "}" ) );
                             }
-                            plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(),
-                                rootArtifactId, "${rootArtifactId}" ) );
+
+                            plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(), rootArtifactId,
+                                                                       "${rootArtifactId}" ) );
+
                             if ( plugin.getVersion() != null )
                             {
-                                plugin.setVersion( "${" +
-                                    Constants.VERSION + "}" );
+                                plugin.setVersion( "${" + Constants.VERSION + "}" );
                             }
                         }
                     }
                 }
 
                 // rewrite PluginManagement
-                if ( profile.getBuild() != null &&
-                    profile.getBuild().getPluginManagement() != null &&
-                    profile.getBuild().getPluginManagement().getPlugins() !=
-                        null &&
-                    !profile.getBuild().getPluginManagement().getPlugins().
-                        isEmpty() )
+                if ( profile.getBuild() != null && profile.getBuild().getPluginManagement() != null
+                    && profile.getBuild().getPluginManagement().getPlugins() != null
+                    && !profile.getBuild().getPluginManagement().getPlugins().isEmpty() )
                 {
-                    Iterator plugins =
-                        profile.getBuild().getPluginManagement().
-                            getPlugins().iterator();
-                    while ( plugins.hasNext() )
+                    for ( Iterator plugins = profile.getBuild().getPluginManagement().getPlugins().iterator();
+                        plugins.hasNext(); )
                     {
-                        Plugin plugin =
-                            (Plugin) plugins.next();
+                        Plugin plugin = (Plugin) plugins.next();
 
-                        if ( plugin.getArtifactId() != null &&
-                            plugin.getArtifactId().indexOf( rootArtifactId ) >=
-                                0 )
+                        if ( plugin.getArtifactId() != null && plugin.getArtifactId().indexOf( rootArtifactId ) >= 0 )
                         {
                             if ( plugin.getGroupId() != null )
                             {
-                                plugin.setGroupId( StringUtils.replace( plugin.getGroupId(),
-                                    groupId,
-                                    "${" +
-                                        Constants.GROUP_ID + "}" ) );
+                                plugin.setGroupId( StringUtils.replace( plugin.getGroupId(), groupId,
+                                                                        "${" + Constants.GROUP_ID + "}" ) );
                             }
-                            plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(),
-                                rootArtifactId, "${rootArtifactId}" ) );
+
+                            plugin.setArtifactId( StringUtils.replace( plugin.getArtifactId(), rootArtifactId,
+                                                                       "${rootArtifactId}" ) );
+
                             if ( plugin.getVersion() != null )
                             {
-                                plugin.setVersion( "${" +
-                                    Constants.VERSION + "}" );
+                                plugin.setVersion( "${" + Constants.VERSION + "}" );
                             }
                         }
                     }
@@ -790,107 +756,40 @@
         }
     }
 
-    private void setArtifactId(
-        Properties properties,
-        String artifactId
-    )
+    private void setArtifactId( Properties properties, String artifactId )
     {
         properties.setProperty( Constants.ARTIFACT_ID, artifactId );
     }
 
-    private List concatenateToList( List toConcatenate,
-                                    String with )
+    private List concatenateToList( List toConcatenate, String with )
     {
         List result = new ArrayList( toConcatenate.size() );
-        Iterator iterator = toConcatenate.iterator();
-        while ( iterator.hasNext() )
+
+        for ( Iterator iterator = toConcatenate.iterator(); iterator.hasNext(); )
         {
             String concatenate = (String) iterator.next();
+
             result.add( ( ( with.length() > 0 ) ? ( with + "/" + concatenate ) : concatenate ) );
         }
+
         return result;
     }
 
-    private OldArchetypeDescriptor convertToOldDescriptor(
-        String id,
-        String packageName,
-        File basedir
-    )
-        throws
-        IOException
-    {
-        getLogger().debug( "Resolving OldArchetypeDescriptor files in " + basedir );
-
-        String excludes = "pom.xml,archetype.properties*,**/target/**";
-
-        Iterator defaultExcludes = Arrays.asList( ListScanner.DEFAULTEXCLUDES ).iterator();
-        while ( defaultExcludes.hasNext() )
-        {
-            excludes += "," + (String) defaultExcludes.next() + "/**";
-        }
-
-        List fileNames = FileUtils.getFileNames( basedir, "**", excludes, false );
-
-        getLogger().debug( "Resolved " + fileNames.size() + " files" );
-
-        String packageAsDirectory = StringUtils.replace( packageName, '.', '/' ) + "/";
-
-        List sources = archetypeFilesResolver.findSourcesMainFiles( fileNames, "java/**" );
-        fileNames.removeAll( sources );
-        sources = removePackage( sources, packageAsDirectory );
-
-        List testSources = archetypeFilesResolver.findSourcesTestFiles( fileNames, "java/**" );
-        fileNames.removeAll( testSources );
-        testSources = removePackage( testSources, packageAsDirectory );
-
-        List resources = archetypeFilesResolver.findResourcesMainFiles( fileNames, "java/**" );
-        fileNames.removeAll( resources );
-
-        List testResources = archetypeFilesResolver.findResourcesTestFiles( fileNames, "java/**" );
-        fileNames.removeAll( testResources );
-
-        List siteResources = archetypeFilesResolver.findSiteFiles( fileNames, null );
-        fileNames.removeAll( siteResources );
-
-        resources.addAll( fileNames );
-
-        OldArchetypeDescriptor descriptor = new OldArchetypeDescriptor();
-        descriptor.setId( id );
-        descriptor.setSources( sources );
-        descriptor.setTestSources( testSources );
-        descriptor.setResources( resources );
-        descriptor.setTestResources( testResources );
-        descriptor.setSiteResources( siteResources );
-
-        return descriptor;
-    }
-
-    private void copyFiles(
-        File basedir,
-        File archetypeFilesDirectory,
-        String directory,
-        List fileSetResources,
-        boolean packaged,
-        String packageName
-    )
-        throws
-        IOException
+    private void copyFiles( File basedir, File archetypeFilesDirectory, String directory, List fileSetResources,
+                            boolean packaged, String packageName )
+        throws IOException
     {
         String packageAsDirectory = StringUtils.replace( packageName, ".", File.separator );
-        getLogger().debug(
-            "Package as Directory: Package:" + packageName + "->" + packageAsDirectory
-        );
 
-        Iterator iterator = fileSetResources.iterator();
+        getLogger().debug( "Package as Directory: Package:" + packageName + "->" + packageAsDirectory );
 
-        while ( iterator.hasNext() )
+        for ( Iterator iterator = fileSetResources.iterator();  iterator.hasNext(); )
         {
             String inputFileName = (String) iterator.next();
 
             String outputFileName =
-                packaged
-                    ? StringUtils.replace( inputFileName, packageAsDirectory + File.separator, "" )
-                    : inputFileName;
+                packaged ? StringUtils.replace( inputFileName, packageAsDirectory + File.separator, "" )
+                                : inputFileName;
             getLogger().debug( "InputFileName:" + inputFileName );
             getLogger().debug( "OutputFileName:" + outputFileName );
 
@@ -901,52 +800,24 @@
             outputFile.getParentFile().mkdirs();
 
             FileUtils.copyFile( inputFile, outputFile );
-        } // end while
+        }
     }
 
-    private void copyPom( File basedir,
-                          File replicaFilesDirectory )
-        throws
-        IOException
+    private void createArchetypeFiles( Properties reverseProperties, List fileSets, String packageName, File basedir,
+                                       File archetypeFilesDirectory, String defaultEncoding )
+        throws IOException
     {
-        FileUtils.copyFileToDirectory(
-            new File( basedir, Constants.ARCHETYPE_POM ),
-            replicaFilesDirectory
-        );
-    }
+        getLogger().debug( "Creating Archetype/Module files from " + basedir + " to " + archetypeFilesDirectory );
 
-    private void createArchetypeFiles(
-        Properties reverseProperties,
-        List fileSets,
-        String packageName,
-        File basedir,
-        File archetypeFilesDirectory,
-        String defaultEncoding
-    )
-        throws
-        IOException
-    {
-        getLogger().debug(
-            "Creating Archetype/Module files from " + basedir + " to " + archetypeFilesDirectory
-        );
-        
-        Iterator iterator = fileSets.iterator();
-
-        while ( iterator.hasNext() )
+        for ( Iterator iterator = fileSets.iterator(); iterator.hasNext(); )
         {
             FileSet fileSet = (FileSet) iterator.next();
 
             DirectoryScanner scanner = new DirectoryScanner();
             scanner.setBasedir( basedir );
-            scanner.setIncludes(
-                (String[]) concatenateToList( fileSet.getIncludes(), fileSet.getDirectory() )
-                    .toArray( new String[fileSet.getIncludes().size()] )
-            );
-            scanner.setExcludes(
-                (String[]) fileSet.getExcludes().toArray(
-                    new String[fileSet.getExcludes().size()]
-                )
-            );
+            scanner.setIncludes( (String[]) concatenateToList( fileSet.getIncludes(),
+                                                               fileSet.getDirectory() ).toArray( new String[fileSet.getIncludes().size()] ) );
+            scanner.setExcludes( (String[]) fileSet.getExcludes().toArray( new String[fileSet.getExcludes().size()] ) );
             scanner.addDefaultExcludes();
             getLogger().debug( "Using fileset " + fileSet );
             scanner.scan();
@@ -956,62 +827,53 @@
 
             if ( fileSet.isFiltered() )
             {
-                processFileSet(
-                    basedir,
-                    archetypeFilesDirectory,
-                    fileSet.getDirectory(),
-                    fileSetResources,
-                    fileSet.isPackaged(),
-                    packageName,
-                    reverseProperties,
-                    defaultEncoding
-                );
+                processFileSet( basedir, archetypeFilesDirectory, fileSet.getDirectory(), fileSetResources,
+                                fileSet.isPackaged(), packageName, reverseProperties, defaultEncoding );
                 getLogger().debug( "Processed " + fileSet.getDirectory() + " files" );
             }
             else
             {
-                copyFiles(
-                    basedir,
-                    archetypeFilesDirectory,
-                    fileSet.getDirectory(),
-                    fileSetResources,
-                    fileSet.isPackaged(),
-                    packageName
-                );
+                copyFiles( basedir, archetypeFilesDirectory, fileSet.getDirectory(), fileSetResources,
+                           fileSet.isPackaged(), packageName );
                 getLogger().debug( "Copied " + fileSet.getDirectory() + " files" );
             }
-        } // end while
+        }
     }
 
-    private void createArchetypePom(
-        Model pom,
-        File archetypeFilesDirectory,
-        Properties pomReversedProperties,
-        File initialPomFile,
-        boolean preserveCData,
-        boolean keepParent
-    )
-        throws
-        IOException
+    private void createArchetypePom( Model pom, File archetypeFilesDirectory, Properties pomReversedProperties,
+                                     File initialPomFile, boolean preserveCData, boolean keepParent )
+        throws IOException
     {
-        File outputFile =
-            FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM );
+        File outputFile = FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM );
 
         if ( preserveCData )
         {
             getLogger().debug( "Preserving CDATA parts of pom" );
-            File inputFile =
-                FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM + ".tmp" );
+            File inputFile = FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM + ".tmp" );
 
             FileUtils.copyFile( initialPomFile, inputFile );
 
-            String initialcontent = FileUtils.fileRead( inputFile );
+            Reader in = null;
+            Writer out = null;
+            try
+            {
+                in = ReaderFactory.newXmlReader( inputFile );
 
-            String content = getReversedContent( initialcontent, pomReversedProperties );
+                String initialcontent = IOUtil.toString( in );
 
-            outputFile.getParentFile().mkdirs();
+                String content = getReversedContent( initialcontent, pomReversedProperties );
 
-            FileUtils.fileWrite( outputFile.getAbsolutePath(), content );
+                outputFile.getParentFile().mkdirs();
+
+                out = WriterFactory.newXmlWriter( outputFile );
+
+                IOUtil.copy( content, out );
+            }
+            finally
+            {
+                IOUtil.close( in );
+                IOUtil.close( out );
+            }
 
             inputFile.delete();
         }
@@ -1028,34 +890,38 @@
             pom.setVersion( "${" + Constants.VERSION + "}" );
 
             rewriteReferences( pom, pomReversedProperties.getProperty( Constants.ARTIFACT_ID ),
-                pomReversedProperties.getProperty( Constants.GROUP_ID ) );
+                               pomReversedProperties.getProperty( Constants.GROUP_ID ) );
 
             pomManager.writePom( pom, outputFile, initialPomFile );
         }
 
-        String initialcontent = FileUtils.fileRead( initialPomFile );
-        Iterator properties = pomReversedProperties.keySet().iterator();
-        while ( properties.hasNext() )
+        Reader in = null;
+        try
         {
-            String property = (String) properties.next();
+            in = ReaderFactory.newXmlReader( initialPomFile );
+            String initialcontent = IOUtil.toString( in );
 
-            if ( initialcontent.indexOf( "${" + property + "}" ) > 0 )
+            Iterator properties = pomReversedProperties.keySet().iterator();
+            while ( properties.hasNext() )
             {
-                getLogger().warn( "Archetype uses ${" + property +
-                    "} for internal processing, but file " + initialPomFile +
-                    " contains this property already" );
+                String property = (String) properties.next();
+
+                if ( initialcontent.indexOf( "${" + property + "}" ) > 0 )
+                {
+                    getLogger().warn(
+                                      "Archetype uses ${" + property + "} for internal processing, but file "
+                                          + initialPomFile + " contains this property already" );
+                }
             }
         }
+        finally
+        {
+            IOUtil.close( in );
+        }
     }
 
-    private FileSet createFileSet(
-        final List excludes,
-        final boolean packaged,
-        final boolean filtered,
-        final String group,
-        final List includes,
-        String defaultEncoding
-    )
+    private FileSet createFileSet( final List excludes, final boolean packaged, final boolean filtered,
+                                   final String group, final List includes, String defaultEncoding )
     {
         FileSet fileSet = new FileSet();
 
@@ -1071,56 +937,31 @@
         return fileSet;
     }
 
-    private List createFileSets(
-        List files,
-        int level,
-        boolean packaged,
-        String packageName,
-        boolean filtered,
-        String defaultEncoding
-    )
+    private List createFileSets( List files, int level, boolean packaged, String packageName, boolean filtered,
+                                 String defaultEncoding )
     {
         List fileSets = new ArrayList();
 
         if ( !files.isEmpty() )
         {
             getLogger().debug(
-                "Creating filesets" + ( packaged ? ( " packaged (" + packageName + ")" ) : "" )
-                    + ( filtered ? " filtered" : "" ) + " at level " + level
-            );
+                               "Creating filesets" + ( packaged ? ( " packaged (" + packageName + ")" ) : "" )
+                                   + ( filtered ? " filtered" : "" ) + " at level " + level );
             if ( level == 0 )
             {
-                List includes = new ArrayList();
+                List includes = new ArrayList( files );
                 List excludes = new ArrayList();
 
-                Iterator filesIterator = files.iterator();
-                while ( filesIterator.hasNext() )
-                {
-                    String file = (String) filesIterator.next();
-
-                    includes.add( file );
-                }
-
                 if ( !includes.isEmpty() )
                 {
-                    fileSets.add(
-                        createFileSet(
-                            excludes,
-                            packaged,
-                            filtered,
-                            "",
-                            includes,
-                            defaultEncoding
-                        )
-                    );
+                    fileSets.add( createFileSet( excludes, packaged, filtered, "", includes, defaultEncoding ) );
                 }
             }
             else
             {
                 Map groups = getGroupsMap( files, level );
 
-                Iterator groupIterator = groups.keySet().iterator();
-                while ( groupIterator.hasNext() )
+                for ( Iterator groupIterator = groups.keySet().iterator(); groupIterator.hasNext(); )
                 {
                     String group = (String) groupIterator.next();
 
@@ -1128,51 +969,28 @@
 
                     if ( !packaged )
                     {
-                        fileSets.add(
-                            getUnpackagedFileSet(
-                                filtered,
-                                group,
-                                (List) groups.get( group ),
-                                defaultEncoding
-                            )
-                        );
+                        fileSets.add( getUnpackagedFileSet( filtered, group, (List) groups.get( group ),
+                                                            defaultEncoding ) );
                     }
                     else
                     {
-                        fileSets.addAll(
-                            getPackagedFileSets(
-                                filtered,
-                                group,
-                                (List) groups.get( group ),
-                                packageName,
-                                defaultEncoding
-                            )
-                        );
+                        fileSets.addAll( getPackagedFileSets( filtered, group, (List) groups.get( group ), packageName,
+                                                              defaultEncoding ) );
                     }
                 }
             } // end if
 
             getLogger().debug( "Resolved fileSets " + fileSets );
         } // end if
+
         return fileSets;
     }
 
-    private ModuleDescriptor createModule(
-        Properties reverseProperties,
-        String rootArtifactId,
-        String moduleId,
-        String packageName,
-        File basedir,
-        File archetypeFilesDirectory,
-        List languages,
-        List filtereds,
-        String defaultEncoding,
-        boolean preserveCData,
-        boolean keepParent
-    )
-        throws
-        IOException,
-        XmlPullParserException
+    private ModuleDescriptor createModule( Properties reverseProperties, String rootArtifactId, String moduleId,
+                                           String packageName, File basedir, File archetypeFilesDirectory,
+                                           List languages, List filtereds, String defaultEncoding,
+                                           boolean preserveCData, boolean keepParent )
+        throws IOException, XmlPullParserException
     {
         ModuleDescriptor archetypeDescriptor = new ModuleDescriptor();
         getLogger().debug( "Starting module's descriptor " + moduleId );
@@ -1180,19 +998,21 @@
         archetypeFilesDirectory.mkdirs();
         getLogger().debug( "Module's files output directory " + archetypeFilesDirectory );
 
-        Model pom =
-            pomManager.readPom( FileUtils.resolveFile( basedir, Constants.ARCHETYPE_POM ) );
+        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}" );
             moduleDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
         }
+
         if ( moduleId.indexOf( rootArtifactId ) >= 0 )
         {
             moduleDirectory = StringUtils.replace( moduleId, rootArtifactId, "__rootArtifactId__" );
         }
+
         archetypeDescriptor.setName( replacementId );
         archetypeDescriptor.setId( replacementId );
         archetypeDescriptor.setDir( moduleDirectory );
@@ -1201,29 +1021,22 @@
 
         List fileNames = resolveFileNames( pom, basedir );
 
-        List filesets =
-            resolveFileSets( packageName, fileNames, languages, filtereds, defaultEncoding );
+        List filesets = resolveFileSets( packageName, fileNames, languages, filtereds, defaultEncoding );
         getLogger().debug( "Resolved filesets for module " + archetypeDescriptor.getName() );
 
         archetypeDescriptor.setFileSets( filesets );
 
-        createArchetypeFiles(
-            reverseProperties,
-            filesets,
-            packageName,
-            basedir,
-            archetypeFilesDirectory,
-            defaultEncoding
-        );
+        createArchetypeFiles( reverseProperties, filesets, packageName, basedir, archetypeFilesDirectory,
+                              defaultEncoding );
         getLogger().debug( "Created files for module " + archetypeDescriptor.getName() );
 
         String parentArtifactId = reverseProperties.getProperty( Constants.PARENT_ARTIFACT_ID );
         setParentArtifactId( reverseProperties, pom.getArtifactId() );
 
-        Iterator modules = pom.getModules().iterator();
-        while ( modules.hasNext() )
+        for ( Iterator modules = pom.getModules().iterator(); modules.hasNext(); )
         {
             String subModuleId = (String) modules.next();
+
             String subModuleIdDirectory = subModuleId;
             if ( subModuleId.indexOf( rootArtifactId ) >= 0 )
             {
@@ -1233,26 +1046,16 @@
             getLogger().debug( "Creating module " + subModuleId );
 
             ModuleDescriptor moduleDescriptor =
-                createModule(
-                    reverseProperties,
-                    rootArtifactId,
-                    subModuleId,
-                    packageName,
-                    FileUtils.resolveFile( basedir, subModuleId ),
-                    FileUtils.resolveFile( archetypeFilesDirectory, subModuleIdDirectory ),
-                    languages,
-                    filtereds,
-                    defaultEncoding,
-                    preserveCData,
-                    keepParent
-                );
+                createModule( reverseProperties, rootArtifactId, subModuleId, packageName,
+                              FileUtils.resolveFile( basedir, subModuleId ),
+                              FileUtils.resolveFile( archetypeFilesDirectory, subModuleIdDirectory ), languages,
+                              filtereds, defaultEncoding, preserveCData, keepParent );
 
             archetypeDescriptor.addModule( moduleDescriptor );
-            getLogger().debug(
-                "Added module " + moduleDescriptor.getName() + " in "
-                    + archetypeDescriptor.getName()
-            );
+
+            getLogger().debug( "Added module " + moduleDescriptor.getName() + " in " + archetypeDescriptor.getName() );
         }
+
         restoreParentArtifactId( reverseProperties, parentArtifactId );
         restoreArtifactId( reverseProperties, pom.getArtifactId() );
 
@@ -1261,35 +1064,41 @@
         return archetypeDescriptor;
     }
 
-    private void createModulePom(
-        Model pom,
-        String rootArtifactId,
-        File archetypeFilesDirectory,
-        Properties pomReversedProperties,
-        File initialPomFile,
-        boolean preserveCData,
-        boolean keepParent
-    )
-        throws
-        IOException
+    private void createModulePom( Model pom, String rootArtifactId, File archetypeFilesDirectory,
+                                  Properties pomReversedProperties, File initialPomFile, boolean preserveCData,
+                                  boolean keepParent )
+        throws IOException
     {
-        File outputFile =
-            FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM );
+        File outputFile = FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM );
 
         if ( preserveCData )
         {
             getLogger().debug( "Preserving CDATA parts of pom" );
-            File inputFile =
-                FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM + ".tmp" );
+            File inputFile = FileUtils.resolveFile( archetypeFilesDirectory, Constants.ARCHETYPE_POM + ".tmp" );
 
             FileUtils.copyFile( initialPomFile, inputFile );
-            String initialcontent = FileUtils.fileRead( inputFile );
 
-            String content = getReversedContent( initialcontent, pomReversedProperties );
+            Reader in = null;
+            Writer out = null;
+            try
+            {
+                in = ReaderFactory.newXmlReader( inputFile );
 
-            outputFile.getParentFile().mkdirs();
+                String initialcontent = IOUtil.toString( in );
 
-            FileUtils.fileWrite( outputFile.getAbsolutePath(), content );
+                String content = getReversedContent( initialcontent, pomReversedProperties );
+
+                outputFile.getParentFile().mkdirs();
+
+                out = WriterFactory.newXmlWriter( outputFile );
+
+                IOUtil.copy( content, out );
+            }
+            finally
+            {
+                IOUtil.close( in );
+                IOUtil.close( out );
+            }
 
             inputFile.delete();
         }
@@ -1298,15 +1107,16 @@
             if ( pom.getParent() != null )
             {
                 pom.getParent().setGroupId(
-                    StringUtils.replace(
-                        pom.getParent().getGroupId(),
-                        pomReversedProperties.getProperty( Constants.GROUP_ID ),
-                        "${" + Constants.GROUP_ID + "}" )
-                );
-                if ( pom.getParent().getArtifactId() != null &&
-                    pom.getParent().getArtifactId().indexOf( rootArtifactId ) >= 0 )
+                                            StringUtils.replace(
+                                                                 pom.getParent().getGroupId(),
+                                                                 pomReversedProperties.getProperty( Constants.GROUP_ID ),
+                                                                 "${" + Constants.GROUP_ID + "}" ) );
+                if ( pom.getParent().getArtifactId() != null
+                    && pom.getParent().getArtifactId().indexOf( rootArtifactId ) >= 0 )
                 {
-                    pom.getParent().setArtifactId( StringUtils.replace( pom.getParent().getArtifactId(), rootArtifactId, "${rootArtifactId}" ) );
+                    pom.getParent().setArtifactId(
+                                                   StringUtils.replace( pom.getParent().getArtifactId(),
+                                                                        rootArtifactId, "${rootArtifactId}" ) );
                 }
                 if ( pom.getParent().getVersion() != null )
                 {
@@ -1317,14 +1127,13 @@
 
             if ( pom.getGroupId() != null )
             {
-                pom.setGroupId(
-                    StringUtils.replace(
-                        pom.getGroupId(),
-                        pomReversedProperties.getProperty( Constants.GROUP_ID ),
-                        "${" + Constants.GROUP_ID + "}" )
-                );
+                pom.setGroupId( StringUtils.replace( pom.getGroupId(),
+                                                     pomReversedProperties.getProperty( Constants.GROUP_ID ), "${"
+                                                         + Constants.GROUP_ID + "}" ) );
             }
+
             pom.setArtifactId( "${" + Constants.ARTIFACT_ID + "}" );
+
             if ( pom.getVersion() != null )
             {
                 pom.setVersion( "${" + Constants.VERSION + "}" );
@@ -1335,74 +1144,35 @@
             pomManager.writePom( pom, outputFile, initialPomFile );
         }
 
-        String initialcontent = FileUtils.fileRead( initialPomFile );
-        Iterator properties = pomReversedProperties.keySet().iterator();
-        while ( properties.hasNext() )
+        Reader in = null;
+        try
         {
-            String property = (String) properties.next();
+            in = ReaderFactory.newXmlReader( initialPomFile );
+            String initialcontent = IOUtil.toString( in );
 
-            if ( initialcontent.indexOf( "${" + property + "}" ) > 0 )
+            for ( Iterator properties = pomReversedProperties.keySet().iterator(); properties.hasNext(); )
             {
-                getLogger().warn( "OldArchetype uses ${" + property +
-                    "} for internal processing, but file " + initialPomFile +
-                    " contains this property already" );
+                String property = (String) properties.next();
+
+                if ( initialcontent.indexOf( "${" + property + "}" ) > 0 )
+                {
+                    getLogger().warn(
+                                      "OldArchetype uses ${" + property + "} for internal processing, but file "
+                                          + initialPomFile + " contains this property already" );
+                }
             }
         }
-    }
-
-    private void createReplicaFiles( List filesets,
-                                     File basedir,
-                                     File replicaFilesDirectory )
-        throws
-        IOException
-    {
-        getLogger().debug(
-            "Creating OldArchetype/Module replica files from " + basedir + " to "
-                + replicaFilesDirectory
-        );
-
-        copyPom( basedir, replicaFilesDirectory );
-
-        Iterator iterator = filesets.iterator();
-
-        while ( iterator.hasNext() )
+        finally
         {
-            FileSet fileset = (FileSet) iterator.next();
-
-            DirectoryScanner scanner = new DirectoryScanner();
-            scanner.setBasedir( basedir );
-            scanner.setIncludes(
-                (String[]) concatenateToList( fileset.getIncludes(), fileset.getDirectory() )
-                    .toArray( new String[fileset.getIncludes().size()] )
-            );
-            scanner.setExcludes(
-                (String[]) fileset.getExcludes().toArray(
-                    new String[fileset.getExcludes().size()]
-                )
-            );
-            scanner.addDefaultExcludes();
-            getLogger().debug( "Using fileset " + fileset );
-            scanner.scan();
-
-            List fileSetResources = Arrays.asList( scanner.getIncludedFiles() );
-
-            copyFiles(
-                basedir,
-                replicaFilesDirectory,
-                fileset.getDirectory(),
-                fileSetResources,
-                false,
-                null
-            );
-            getLogger().debug( "Copied " + fileset.getDirectory() + " files" );
+            IOUtil.close( in );
         }
     }
 
     private Set getExtensions( List files )
     {
         Set extensions = new HashSet();
-        Iterator filesIterator = files.iterator();
-        while ( filesIterator.hasNext() )
+
+        for ( Iterator filesIterator = files.iterator(); filesIterator.hasNext(); )
         {
             String file = (String) filesIterator.next();
 
@@ -1417,12 +1187,11 @@
         return "target" + File.separator + "generated-sources" + File.separator + "archetype";
     }
 
-    private Map getGroupsMap( final List files,
-                              final int level )
+    private Map getGroupsMap( final List files, final int level )
     {
         Map groups = new HashMap();
-        Iterator fileIterator = files.iterator();
-        while ( fileIterator.hasNext() )
+
+        for ( Iterator fileIterator = files.iterator(); fileIterator.hasNext(); )
         {
             String file = (String) fileIterator.next();
 
@@ -1443,27 +1212,21 @@
 
             group.add( innerPath );
         }
-        getLogger().debug(
-            "Sorted " + groups.size() + " groups in " + files.size() + " files"
-        );
-        getLogger().debug( "Sorted Files:" + files );
+
+        getLogger().debug( "Sorted " + groups.size() + " groups in " + files.size() + " files" );
+        getLogger().debug( "Sorted Files: " + files );
+
         return groups;
     }
 
-    private FileSet getPackagedFileSet(
-        final boolean filtered,
-        final Set packagedExtensions,
-        final String group,
-        final Set unpackagedExtensions,
-        final List unpackagedFiles,
-        String defaultEncoding
-    )
+    private FileSet getPackagedFileSet( final boolean filtered, final Set packagedExtensions, final String group,
+                                        final Set unpackagedExtensions, final List unpackagedFiles,
+                                        String defaultEncoding )
     {
         List includes = new ArrayList();
         List excludes = new ArrayList();
 
-        Iterator extensionsIterator = packagedExtensions.iterator();
-        while ( extensionsIterator.hasNext() )
+        for ( Iterator extensionsIterator = packagedExtensions.iterator(); extensionsIterator.hasNext(); )
         {
             String extension = (String) extensionsIterator.next();
 
@@ -1471,32 +1234,23 @@
 
             if ( unpackagedExtensions.contains( extension ) )
             {
-                excludes.addAll(
-                    archetypeFilesResolver.getFilesWithExtension( unpackagedFiles, extension )
-                );
+                excludes.addAll( archetypeFilesResolver.getFilesWithExtension( unpackagedFiles, extension ) );
             }
         }
 
-        FileSet fileset =
-            createFileSet( excludes, true, filtered, group, includes, defaultEncoding );
-        return fileset;
+        return createFileSet( excludes, true, filtered, group, includes, defaultEncoding );
     }
 
-    private List getPackagedFileSets(
-        final boolean filtered,
-        final String group,
-        final List groupFiles,
-        final String packageName,
-        String defaultEncoding
-    )
+    private List getPackagedFileSets( final boolean filtered, final String group, final List groupFiles,
+                                      final String packageName, String defaultEncoding )
     {
         String packageAsDir = StringUtils.replace( packageName, ".", "/" );
+
         List packagedFileSets = new ArrayList();
         List packagedFiles = archetypeFilesResolver.getPackagedFiles( groupFiles, packageAsDir );
         getLogger().debug( "Found packaged Files:" + packagedFiles );
 
-        List unpackagedFiles =
-            archetypeFilesResolver.getUnpackagedFiles( groupFiles, packageAsDir );
+        List unpackagedFiles = archetypeFilesResolver.getUnpackagedFiles( groupFiles, packageAsDir );
         getLogger().debug( "Found unpackaged Files:" + unpackagedFiles );
 
         Set packagedExtensions = getExtensions( packagedFiles );
@@ -1506,70 +1260,43 @@
 
         if ( !packagedExtensions.isEmpty() )
         {
-            packagedFileSets.add(
-                getPackagedFileSet(
-                    filtered,
-                    packagedExtensions,
-                    group,
-                    unpackagedExtensions,
-                    unpackagedFiles,
-                    defaultEncoding
-                )
-            );
+            packagedFileSets.add( getPackagedFileSet( filtered, packagedExtensions, group, unpackagedExtensions,
+                                                      unpackagedFiles, defaultEncoding ) );
         }
 
         if ( !unpackagedExtensions.isEmpty() )
         {
             getLogger().debug( "Found unpackaged extensions " + unpackagedExtensions );
-            packagedFileSets.add(
-                getUnpackagedFileSet(
-                    filtered,
-                    unpackagedExtensions,
-                    unpackagedFiles,
-                    group,
-                    packagedExtensions,
-                    defaultEncoding
-                )
-            );
+
+            packagedFileSets.add( getUnpackagedFileSet( filtered, unpackagedExtensions, unpackagedFiles, group,
+                                                        packagedExtensions, defaultEncoding ) );
         }
+
         return packagedFileSets;
     }
 
-    private void setParentArtifactId(
-        Properties properties,
-        String parentArtifactId
-    )
+    private void setParentArtifactId( Properties properties, String parentArtifactId )
     {
         properties.setProperty( Constants.PARENT_ARTIFACT_ID, parentArtifactId );
     }
 
-    private void processFileSet(
-        File basedir,
-        File archetypeFilesDirectory,
-        String directory,
-        List fileSetResources,
-        boolean packaged,
-        String packageName,
-        Properties reverseProperties,
-        String defaultEncoding
-    )
-        throws
-        IOException
+    private void processFileSet( File basedir, File archetypeFilesDirectory, String directory, List fileSetResources,
+                                 boolean packaged, String packageName, Properties reverseProperties,
+                                 String defaultEncoding )
+        throws IOException
     {
         String packageAsDirectory = StringUtils.replace( packageName, ".", File.separator );
-        getLogger().debug(
-            "Package as Directory: Package:" + packageName + "->" + packageAsDirectory
-        );
 
-        Iterator iterator = fileSetResources.iterator();
+        getLogger().debug( "Package as Directory: Package:" + packageName + "->" + packageAsDirectory );
 
-        while ( iterator.hasNext() )
+        for ( Iterator iterator = fileSetResources.iterator(); iterator.hasNext(); )
         {
             String inputFileName = (String) iterator.next();
+
             String outputFileName =
-                packaged
-                    ? StringUtils.replace( inputFileName, packageAsDirectory + File.separator, "" )
-                    : inputFileName;
+                packaged ? StringUtils.replace( inputFileName, packageAsDirectory + File.separator, "" )
+                                : inputFileName;
+
             getLogger().debug( "InputFileName:" + inputFileName );
             getLogger().debug( "OutputFileName:" + outputFileName );
 
@@ -1580,37 +1307,29 @@
 
             String fileEncoding = detector.isFound() ? detector.getCharset() : defaultEncoding;
 
-            String initialcontent =
-                org.apache.commons.io.IOUtils.toString(
-                    new FileInputStream( inputFile ),
-                    fileEncoding
-                );
+            String initialcontent = IOUtil.toString( new FileInputStream( inputFile ), fileEncoding );
 
-            Iterator properties = reverseProperties.keySet().iterator();
-            while ( properties.hasNext() )
+            for ( Iterator properties = reverseProperties.keySet().iterator(); properties.hasNext(); )
             {
                 String property = (String) properties.next();
 
                 if ( initialcontent.indexOf( "${" + property + "}" ) > 0 )
                 {
-                    getLogger().warn( "Archetype uses ${" + property +
-                        "} for internal processing, but file " + inputFile +
-                        " contains this property already" );
+                    getLogger().warn(
+                                      "Archetype uses ${" + property + "} for internal processing, but file "
+                                          + inputFile + " contains this property already" );
                 }
             }
 
             String content = getReversedContent( initialcontent, reverseProperties );
+
             outputFile.getParentFile().mkdirs();
-            org.apache.commons.io.IOUtils.write(
-                content,
-                new FileOutputStream( outputFile ),
-                fileEncoding
-            );
-        } // end while
+
+            org.apache.commons.io.IOUtils.write( content, new FileOutputStream( outputFile ), fileEncoding );
+        }
     }
 
-    private List removePackage( List sources,
-                                String packageAsDirectory )
+    private List removePackage( List sources, String packageAsDirectory )
     {
         if ( sources == null )
         {
@@ -1618,21 +1337,20 @@
         }
 
         List unpackagedSources = new ArrayList( sources.size() );
-        Iterator sourcesIterator = sources.iterator();
-        while ( sourcesIterator.hasNext() )
+
+        for ( Iterator sourcesIterator = sources.iterator(); sourcesIterator.hasNext(); )
         {
             String source = (String) sourcesIterator.next();
+
             String unpackagedSource = StringUtils.replace( source, packageAsDirectory, "" );
+
             unpackagedSources.add( unpackagedSource );
         }
 
         return unpackagedSources;
     }
 
-    private Properties getRequiredProperties(
-        ArchetypeDescriptor archetypeDescriptor,
-        Properties properties
-    )
+    private Properties getRequiredProperties( ArchetypeDescriptor archetypeDescriptor, Properties properties )
     {
         Properties reversedProperties = new Properties();
 
@@ -1640,35 +1358,30 @@
         reversedProperties.remove( Constants.ARCHETYPE_GROUP_ID );
         reversedProperties.remove( Constants.ARCHETYPE_ARTIFACT_ID );
         reversedProperties.remove( Constants.ARCHETYPE_VERSION );
-        reversedProperties.setProperty(
-            Constants.PACKAGE_IN_PATH_FORMAT,
-            getPackageInPathFormat(properties.getProperty( Constants.PACKAGE ))
-        );
-        
+        reversedProperties.setProperty( Constants.PACKAGE_IN_PATH_FORMAT,
+                                        getPackageInPathFormat( properties.getProperty( Constants.PACKAGE ) ) );
+
         return reversedProperties;
     }
 
-    private List resolveFileNames( final Model pom,
-                                   final File basedir )
-        throws
-        IOException
+    private List resolveFileNames( final Model pom, final File basedir )
+        throws IOException
     {
         getLogger().debug( "Resolving files for " + pom.getId() + " in " + basedir );
 
-        Iterator modules = pom.getModules().iterator();
-        String excludes = "pom.xml*,archetype.properties*,target/**,";
-        while ( modules.hasNext() )
+        StringBuffer buff = new StringBuffer( "pom.xml*,archetype.properties*,target/**," );
+        for ( Iterator modules = pom.getModules().iterator(); modules.hasNext(); )
         {
-            excludes += "," + (String) modules.next() + "/**";
+            buff.append( ',' ).append( (String) modules.next() ).append( "/**" );
         }
 
-        Iterator defaultExcludes = Arrays.asList( ListScanner.DEFAULTEXCLUDES ).iterator();
-        while ( defaultExcludes.hasNext() )
+        for ( Iterator defaultExcludes = Arrays.asList( ListScanner.DEFAULTEXCLUDES ).iterator();
+            defaultExcludes.hasNext(); )
         {
-            excludes += "," + (String) defaultExcludes.next() + "/**";
+            buff.append( ',' ).append( (String) defaultExcludes.next() ).append( "/**" );
         }
 
-        excludes = PathUtils.convertPathForOS( excludes );
+        String excludes = PathUtils.convertPathForOS( buff.toString() );
 
         List fileNames = FileUtils.getFileNames( basedir, "**,.*,**/.*", excludes, false );
 
@@ -1678,374 +1391,242 @@
         return fileNames;
     }
 
-    private List resolveFileSets(
-        String packageName,
-        List fileNames,
-        List languages,
-        List filtereds,
-        String defaultEncoding
-    )
+    private List resolveFileSets( String packageName, List fileNames, List languages, List filtereds,
+                                  String defaultEncoding )
     {
         List resolvedFileSets = new ArrayList();
         getLogger().debug(
-            "Resolving filesets with package=" + packageName + ", languages=" + languages
-                + " and extentions=" + filtereds
-        );
+                           "Resolving filesets with package=" + packageName + ", languages=" + languages
+                               + " and extentions=" + filtereds );
 
         List files = new ArrayList( fileNames );
 
         String languageIncludes = "";
 
-        Iterator languagesIterator = languages.iterator();
-
-        while ( languagesIterator.hasNext() )
+        for ( Iterator languagesIterator = languages.iterator(); languagesIterator.hasNext(); )
         {
             String language = (String) languagesIterator.next();
 
-            languageIncludes +=
-                ( ( languageIncludes.length() == 0 ) ? "" : "," ) + language + "/**";
+            languageIncludes += ( ( languageIncludes.length() == 0 ) ? "" : "," ) + language + "/**";
         }
 
         getLogger().debug( "Using languages includes " + languageIncludes );
 
         String filteredIncludes = "";
-        Iterator filteredsIterator = filtereds.iterator();
-        while ( filteredsIterator.hasNext() )
+        for ( Iterator filteredsIterator = filtereds.iterator(); filteredsIterator.hasNext(); )
         {
             String filtered = (String) filteredsIterator.next();
 
             filteredIncludes +=
-                ( ( filteredIncludes.length() == 0 ) ? "" : "," ) + "**/"
-                    + ( filtered.startsWith( "." ) ? "" : "*." ) + filtered;
+                ( ( filteredIncludes.length() == 0 ) ? "" : "," ) + "**/" + ( filtered.startsWith( "." ) ? "" : "*." )
+                    + filtered;
         }
 
         getLogger().debug( "Using filtered includes " + filteredIncludes );
 
-        /*sourcesMainFiles*/
-        List sourcesMainFiles =
-            archetypeFilesResolver.findSourcesMainFiles( files, languageIncludes );
+        /* sourcesMainFiles */
+        List sourcesMainFiles = archetypeFilesResolver.findSourcesMainFiles( files, languageIncludes );
         if ( !sourcesMainFiles.isEmpty() )
         {
             files.removeAll( sourcesMainFiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( sourcesMainFiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( sourcesMainFiles, filteredIncludes );
             sourcesMainFiles.removeAll( filteredFiles );
 
             List unfilteredFiles = sourcesMainFiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding ) );
             }
 
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*resourcesMainFiles*/
-        List resourcesMainFiles =
-            archetypeFilesResolver.findResourcesMainFiles( files, languageIncludes );
+        /* resourcesMainFiles */
+        List resourcesMainFiles = archetypeFilesResolver.findResourcesMainFiles( files, languageIncludes );
         if ( !resourcesMainFiles.isEmpty() )
         {
             files.removeAll( resourcesMainFiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( resourcesMainFiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( resourcesMainFiles, filteredIncludes );
             resourcesMainFiles.removeAll( filteredFiles );
 
             List unfilteredFiles = resourcesMainFiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 3, false, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 3, false, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets(
-                        unfilteredFiles,
-                        3,
-                        false,
-                        packageName,
-                        false,
-                        defaultEncoding
-                    )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, false, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*sourcesTestFiles*/
-        List sourcesTestFiles =
-            archetypeFilesResolver.findSourcesTestFiles( files, languageIncludes );
+        /* sourcesTestFiles */
+        List sourcesTestFiles = archetypeFilesResolver.findSourcesTestFiles( files, languageIncludes );
         if ( !sourcesTestFiles.isEmpty() )
         {
             files.removeAll( sourcesTestFiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( sourcesTestFiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( sourcesTestFiles, filteredIncludes );
             sourcesTestFiles.removeAll( filteredFiles );
 
             List unfilteredFiles = sourcesTestFiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*ressourcesTestFiles*/
-        List resourcesTestFiles =
-            archetypeFilesResolver.findResourcesTestFiles( files, languageIncludes );
+        /* ressourcesTestFiles */
+        List resourcesTestFiles = archetypeFilesResolver.findResourcesTestFiles( files, languageIncludes );
         if ( !resourcesTestFiles.isEmpty() )
         {
             files.removeAll( resourcesTestFiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( resourcesTestFiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( resourcesTestFiles, filteredIncludes );
             resourcesTestFiles.removeAll( filteredFiles );
 
             List unfilteredFiles = resourcesTestFiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 3, false, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 3, false, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets(
-                        unfilteredFiles,
-                        3,
-                        false,
-                        packageName,
-                        false,
-                        defaultEncoding
-                    )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, false, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*siteFiles*/
+        /* siteFiles */
         List siteFiles = archetypeFilesResolver.findSiteFiles( files, languageIncludes );
         if ( !siteFiles.isEmpty() )
         {
             files.removeAll( siteFiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( siteFiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( siteFiles, filteredIncludes );
             siteFiles.removeAll( filteredFiles );
 
             List unfilteredFiles = siteFiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 2, false, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 2, false, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets(
-                        unfilteredFiles,
-                        2,
-                        false,
-                        packageName,
-                        false,
-                        defaultEncoding
-                    )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 2, false, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*thirdLevelSourcesfiles*/
-        List thirdLevelSourcesfiles =
-            archetypeFilesResolver.findOtherSources( 3, files, languageIncludes );
+        /* thirdLevelSourcesfiles */
+        List thirdLevelSourcesfiles = archetypeFilesResolver.findOtherSources( 3, files, languageIncludes );
         if ( !thirdLevelSourcesfiles.isEmpty() )
         {
             files.removeAll( thirdLevelSourcesfiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles(
-                    thirdLevelSourcesfiles,
-                    filteredIncludes
-                );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( thirdLevelSourcesfiles, filteredIncludes );
             thirdLevelSourcesfiles.removeAll( filteredFiles );
 
             List unfilteredFiles = thirdLevelSourcesfiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 3, true, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, true, packageName, false, defaultEncoding ) );
             }
 
-            /*thirdLevelResourcesfiles*/
+            /* thirdLevelResourcesfiles */
             List thirdLevelResourcesfiles =
-                archetypeFilesResolver.findOtherResources(
-                    3,
-                    files,
-                    thirdLevelSourcesfiles,
-                    languageIncludes
-                );
+                archetypeFilesResolver.findOtherResources( 3, files, thirdLevelSourcesfiles, languageIncludes );
             if ( !thirdLevelResourcesfiles.isEmpty() )
             {
                 files.removeAll( thirdLevelResourcesfiles );
-                filteredFiles =
-                    archetypeFilesResolver.getFilteredFiles(
-                        thirdLevelResourcesfiles,
-                        filteredIncludes
-                    );
+                filteredFiles = archetypeFilesResolver.getFilteredFiles( thirdLevelResourcesfiles, filteredIncludes );
                 thirdLevelResourcesfiles.removeAll( filteredFiles );
                 unfilteredFiles = thirdLevelResourcesfiles;
                 if ( !filteredFiles.isEmpty() )
                 {
-                    resolvedFileSets.addAll(
-                        createFileSets(
-                            filteredFiles,
-                            3,
-                            false,
-                            packageName,
-                            true,
-                            defaultEncoding
-                        )
-                    );
+                    resolvedFileSets.addAll( createFileSets( filteredFiles, 3, false, packageName, true,
+                                                             defaultEncoding ) );
                 }
                 if ( !unfilteredFiles.isEmpty() )
                 {
-                    resolvedFileSets.addAll(
-                        createFileSets(
-                            unfilteredFiles,
-                            3,
-                            false,
-                            packageName,
-                            false,
-                            defaultEncoding
-                        )
-                    );
+                    resolvedFileSets.addAll( createFileSets( unfilteredFiles, 3, false, packageName, false,
+                                                             defaultEncoding ) );
                 }
             }
         } // end if
 
-        /*secondLevelSourcesfiles*/
-        List secondLevelSourcesfiles =
-            archetypeFilesResolver.findOtherSources( 2, files, languageIncludes );
+        /* secondLevelSourcesfiles */
+        List secondLevelSourcesfiles = archetypeFilesResolver.findOtherSources( 2, files, languageIncludes );
         if ( !secondLevelSourcesfiles.isEmpty() )
         {
             files.removeAll( secondLevelSourcesfiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles(
-                    secondLevelSourcesfiles,
-                    filteredIncludes
-                );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( secondLevelSourcesfiles, filteredIncludes );
             secondLevelSourcesfiles.removeAll( filteredFiles );
 
             List unfilteredFiles = secondLevelSourcesfiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 2, true, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 2, true, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( unfilteredFiles, 2, true, packageName, false, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 2, true, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*secondLevelResourcesfiles*/
-        List secondLevelResourcesfiles =
-            archetypeFilesResolver.findOtherResources( 2, files, languageIncludes );
+        /* secondLevelResourcesfiles */
+        List secondLevelResourcesfiles = archetypeFilesResolver.findOtherResources( 2, files, languageIncludes );
         if ( !secondLevelResourcesfiles.isEmpty() )
         {
             files.removeAll( secondLevelResourcesfiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles(
-                    secondLevelResourcesfiles,
-                    filteredIncludes
-                );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( secondLevelResourcesfiles, filteredIncludes );
             secondLevelResourcesfiles.removeAll( filteredFiles );
 
             List unfilteredFiles = secondLevelResourcesfiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 2, false, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 2, false, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets(
-                        unfilteredFiles,
-                        2,
-                        false,
-                        packageName,
-                        false,
-                        defaultEncoding
-                    )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 2, false, packageName, false, defaultEncoding ) );
             }
         }
 
-        /*rootResourcesfiles*/
-        List rootResourcesfiles =
-            archetypeFilesResolver.findOtherResources( 0, files, languageIncludes );
+        /* rootResourcesfiles */
+        List rootResourcesfiles = archetypeFilesResolver.findOtherResources( 0, files, languageIncludes );
         if ( !rootResourcesfiles.isEmpty() )
         {
             files.removeAll( rootResourcesfiles );
 
-            List filteredFiles =
-                archetypeFilesResolver.getFilteredFiles( rootResourcesfiles, filteredIncludes );
+            List filteredFiles = archetypeFilesResolver.getFilteredFiles( rootResourcesfiles, filteredIncludes );
             rootResourcesfiles.removeAll( filteredFiles );
 
             List unfilteredFiles = rootResourcesfiles;
             if ( !filteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets( filteredFiles, 0, false, packageName, true, defaultEncoding )
-                );
+                resolvedFileSets.addAll( createFileSets( filteredFiles, 0, false, packageName, true, defaultEncoding ) );
             }
             if ( !unfilteredFiles.isEmpty() )
             {
-                resolvedFileSets.addAll(
-                    createFileSets(
-                        unfilteredFiles,
-                        0,
-                        false,
-                        packageName,
-                        false,
-                        defaultEncoding
-                    )
-                );
+                resolvedFileSets.addAll( createFileSets( unfilteredFiles, 0, false, packageName, false, defaultEncoding ) );
             }
         }
 
-         /**/
+        /**/
         if ( !files.isEmpty() )
         {
             getLogger().info( "Ignored files: " + files );
@@ -2054,10 +1635,7 @@
         return resolvedFileSets;
     }
 
-    private void restoreArtifactId(
-        Properties properties,
-        String artifactId
-    )
+    private void restoreArtifactId( Properties properties, String artifactId )
     {
         if ( StringUtils.isEmpty( artifactId ) )
         {
@@ -2069,10 +1647,7 @@
         }
     }
 
-    private void restoreParentArtifactId(
-        Properties properties,
-        String parentArtifactId
-    )
+    private void restoreParentArtifactId( Properties properties, String parentArtifactId )
     {
         if ( StringUtils.isEmpty( parentArtifactId ) )
         {
@@ -2084,49 +1659,36 @@
         }
     }
 
-    private String getReversedContent( String content,
-                                       Properties properties )
+    private String getReversedContent( String content, Properties properties )
     {
-        String result = StringUtils.replace( 
-                StringUtils.replace( content, "$", "${symbol_dollar}" ), 
-                "\\", "${symbol_escape}" );
-        Iterator propertyIterator = properties.keySet().iterator();
-        while ( propertyIterator.hasNext() )
+        String result =
+            StringUtils.replace( StringUtils.replace( content, "$", "${symbol_dollar}" ), "\\", "${symbol_escape}" );
+
+        for ( Iterator propertyIterator = properties.keySet().iterator(); propertyIterator.hasNext(); )
         {
             String propertyKey = (String) propertyIterator.next();
-            result =
-                StringUtils.replace(
-                    result,
-                    properties.getProperty( propertyKey ),
-                    "${" + propertyKey + "}"
-                );
+
+            result = StringUtils.replace( result, properties.getProperty( propertyKey ), "${" + propertyKey + "}" );
         }
-        //TODO: Replace velocity to a better engine... 
-        return "#set( $symbol_pound = '#' )\n" + "#set( $symbol_dollar = '$' )\n" + 
-               "#set( $symbol_escape = '\\' )\n" + 
-               StringUtils.replace( result, "#", "${symbol_pound}" );
+        // TODO: Replace velocity to a better engine...
+        return "#set( $symbol_pound = '#' )\n" + "#set( $symbol_dollar = '$' )\n" + "#set( $symbol_escape = '\\' )\n"
+            + StringUtils.replace( result, "#", "${symbol_pound}" );
     }
 
     private String getTemplateOutputDirectory()
     {
-        return
-            Constants.SRC + File.separator + Constants.MAIN + File.separator + Constants.RESOURCES;
+        return Constants.SRC + File.separator + Constants.MAIN + File.separator + Constants.RESOURCES;
     }
 
-    private FileSet getUnpackagedFileSet(
-        final boolean filtered,
-        final String group,
-        final List groupFiles,
-        String defaultEncoding
-    )
+    private FileSet getUnpackagedFileSet( final boolean filtered, final String group, final List groupFiles,
+                                          String defaultEncoding )
     {
         Set extensions = getExtensions( groupFiles );
 
         List includes = new ArrayList();
         List excludes = new ArrayList();
 
-        Iterator extensionsIterator = extensions.iterator();
-        while ( extensionsIterator.hasNext() )
+        for ( Iterator extensionsIterator = extensions.iterator(); extensionsIterator.hasNext(); )
         {
             String extension = (String) extensionsIterator.next();
 
@@ -2136,27 +1698,20 @@
         return createFileSet( excludes, false, filtered, group, includes, defaultEncoding );
     }
 
-    private FileSet getUnpackagedFileSet(
-        final boolean filtered,
-        final Set unpackagedExtensions,
-        final List unpackagedFiles,
-        final String group,
-        final Set packagedExtensions,
-        String defaultEncoding
-    )
+    private FileSet getUnpackagedFileSet( final boolean filtered, final Set unpackagedExtensions,
+                                          final List unpackagedFiles, final String group, final Set packagedExtensions,
+                                          String defaultEncoding )
     {
         List includes = new ArrayList();
         List excludes = new ArrayList();
 
-        Iterator extensionsIterator = unpackagedExtensions.iterator();
-        while ( extensionsIterator.hasNext() )
+        for ( Iterator extensionsIterator = unpackagedExtensions.iterator(); extensionsIterator.hasNext(); )
         {
             String extension = (String) extensionsIterator.next();
+
             if ( packagedExtensions.contains( extension ) )
             {
-                includes.addAll(
-                    archetypeFilesResolver.getFilesWithExtension( unpackagedFiles, extension )
-                );
+                includes.addAll( archetypeFilesResolver.getFilesWithExtension( unpackagedFiles, extension ) );
             }
             else
             {
@@ -2167,25 +1722,16 @@
         return createFileSet( excludes, false, filtered, group, includes, defaultEncoding );
     }
 
-    private void writeOldDescriptor( OldArchetypeDescriptor oldDescriptor,
-                                     File oldDescriptorFile )
-        throws
-        IOException
-    {
-        OldArchetypeDescriptorXpp3Writer writer = new OldArchetypeDescriptorXpp3Writer();
-        writer.write( new FileWriter( oldDescriptorFile ), oldDescriptor );
-    }
-    
     private static final String MAVEN_PROPERTIES = "META-INF/maven/org.apache.maven.archetype/archetype-common/pom.properties";
-    
+
     public String getArchetypeVersion()
     {
         InputStream is = null;
-        
+
         // This should actually come from the pom.properties at testing but it's not generated and put into the JAR, it happens
         // as part of the JAR plugin which is crap as it makes testing inconsistent.
         String version = "version";
-        
+
         try
         {
             Properties properties = new Properties();
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptor.java
deleted file mode 100644
index e6d1e80..0000000
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptor.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.creator.olddescriptor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** @author rafale */
-public class OldArchetypeDescriptor
-{
-    private String id;
-    private List resources;
-    private List siteResources;
-    private List sources;
-    private List testResources;
-    private List testSources;
-
-    public void addResources( String resource )
-    {
-        if ( resources == null )
-        {
-            resources = new ArrayList();
-        }
-        resources.add( resource );
-    }
-
-    public void addSiteResources( String resource )
-    {
-        if ( siteResources == null )
-        {
-            siteResources = new ArrayList();
-        }
-        siteResources.add( resource );
-    }
-
-    public void addSource( String source )
-    {
-        if ( sources == null )
-        {
-            sources = new ArrayList();
-        }
-        sources.add( source );
-    }
-
-    public void addTestResources( String resource )
-    {
-        if ( testResources == null )
-        {
-            testResources = new ArrayList();
-        }
-        testResources.add( resource );
-    }
-
-    public void addTestSources( String source )
-    {
-        if ( testSources == null )
-        {
-            testSources = new ArrayList();
-        }
-        testSources.add( source );
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public List getResources()
-    {
-        return resources;
-    }
-
-    public void setResources( List resources )
-    {
-        this.resources = resources;
-    }
-
-    public List getSiteResources()
-    {
-        return siteResources;
-    }
-
-    public void setSiteResources( List siteResources )
-    {
-        this.siteResources = siteResources;
-    }
-
-    public List getSources()
-    {
-        return sources;
-    }
-
-    public void setSources( List sources )
-    {
-        this.sources = sources;
-    }
-
-    public List getTestResources()
-    {
-        return testResources;
-    }
-
-    public void setTestResources( List testResources )
-    {
-        this.testResources = testResources;
-    }
-
-    public List getTestSources()
-    {
-        return testSources;
-    }
-
-    public void setTestSources( List testSources )
-    {
-        this.testSources = testSources;
-    }
-
-    public String toString()
-    {
-        return
-            "(OldArchetypeDescriptor"
-                + " id=" + id
-                + " sources=" + sources
-                + " testSources" + testSources
-                + " resources" + resources
-                + " testResources" + testResources
-                + " siteResources" + siteResources
-                + ")";
-    }
-}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptorXpp3Writer.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptorXpp3Writer.java
deleted file mode 100644
index 23acd0a..0000000
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/olddescriptor/OldArchetypeDescriptorXpp3Writer.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.creator.olddescriptor;
-
-import org.codehaus.plexus.util.xml.pull.MXSerializer;
-import org.codehaus.plexus.util.xml.pull.XmlSerializer;
-
-import java.io.Writer;
-import java.util.Iterator;
-
-/** @author rafale */
-public class OldArchetypeDescriptorXpp3Writer
-{
-    private String NAMESPACE;
-
-    public void write( Writer writer,
-                       OldArchetypeDescriptor descriptor )
-        throws
-        java.io.IOException
-    {
-        XmlSerializer serializer = new MXSerializer();
-        serializer.setProperty(
-            "http://xmlpull.org/v1/doc/properties.html#serializer-indentation",
-            "  "
-        );
-        serializer.setProperty(
-            "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator",
-            "\n"
-        );
-        serializer.setOutput( writer );
-        serializer.startDocument( "UTF-8", null );
-        writeArchetypeDescriptor( descriptor, "archetype", serializer );
-        serializer.endDocument();
-    }
-
-    private void writeArchetypeDescriptor(
-        OldArchetypeDescriptor descriptor,
-        String tagName,
-        XmlSerializer serializer
-    )
-        throws
-        java.io.IOException
-    {
-        if ( descriptor != null )
-        {
-            serializer.startTag( NAMESPACE, tagName );
-            if ( descriptor.getId() != null )
-            {
-                serializer.startTag( NAMESPACE, "id" ).text( descriptor.getId() ).endTag(
-                    NAMESPACE,
-                    "id"
-                );
-            }
-            if ( ( descriptor.getSources() != null ) && ( descriptor.getSources().size() > 0 ) )
-            {
-                serializer.startTag( NAMESPACE, "sources" );
-                for ( Iterator iter = descriptor.getSources().iterator(); iter.hasNext(); )
-                {
-                    String source = (String) iter.next();
-                    serializer.startTag( NAMESPACE, "source" ).text( source ).endTag(
-                        NAMESPACE,
-                        "source"
-                    );
-                }
-                serializer.endTag( NAMESPACE, "sources" );
-            }
-            if ( ( descriptor.getTestSources() != null )
-                && ( descriptor.getTestSources().size() > 0 )
-                )
-            {
-                serializer.startTag( NAMESPACE, "testSources" );
-                for ( Iterator iter = descriptor.getTestSources().iterator(); iter.hasNext(); )
-                {
-                    String source = (String) iter.next();
-                    serializer.startTag( NAMESPACE, "source" ).text( source ).endTag(
-                        NAMESPACE,
-                        "source"
-                    );
-                }
-                serializer.endTag( NAMESPACE, "testSources" );
-            }
-            if ( ( descriptor.getResources() != null )
-                && ( descriptor.getResources().size() > 0 )
-                )
-            {
-                serializer.startTag( NAMESPACE, "resources" );
-                for ( Iterator iter = descriptor.getResources().iterator(); iter.hasNext(); )
-                {
-                    String source = (String) iter.next();
-                    serializer.startTag( NAMESPACE, "resource" ).text( source ).endTag(
-                        NAMESPACE,
-                        "resource"
-                    );
-                }
-                serializer.endTag( NAMESPACE, "resources" );
-            }
-            if ( ( descriptor.getTestResources() != null )
-                && ( descriptor.getTestResources().size() > 0 )
-                )
-            {
-                serializer.startTag( NAMESPACE, "testResources" );
-                for ( Iterator iter = descriptor.getTestResources().iterator(); iter.hasNext(); )
-                {
-                    String source = (String) iter.next();
-                    serializer.startTag( NAMESPACE, "resource" ).text( source ).endTag(
-                        NAMESPACE,
-                        "resource"
-                    );
-                }
-                serializer.endTag( NAMESPACE, "testResources" );
-            }
-            if ( ( descriptor.getSiteResources() != null )
-                && ( descriptor.getSiteResources().size() > 0 )
-                )
-            {
-                serializer.startTag( NAMESPACE, "siteResources" );
-                for ( Iterator iter = descriptor.getSiteResources().iterator(); iter.hasNext(); )
-                {
-                    String source = (String) iter.next();
-                    serializer.startTag( NAMESPACE, "resource" ).text( source ).endTag(
-                        NAMESPACE,
-                        "resource"
-                    );
-                }
-                serializer.endTag( NAMESPACE, "siteResources" );
-            }
-            serializer.endTag( NAMESPACE, tagName );
-        } // end if
-    }
-}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
index 6f13a88..83929bb 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * 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.
+ */
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -28,27 +47,23 @@
      */
     private ArtifactFactory artifactFactory;
 
-    public File download( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                         List remoteRepositories )
+    public File download( String groupId, String artifactId, String version, ArtifactRepository archetypeRepository,
+                          ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException
    {
         Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
 
-        List repositories = new ArrayList(remoteRepositories);
+        List repositories = new ArrayList( remoteRepositories );
         if ( repositories.isEmpty() && archetypeRepository != null )
         {
-            repositories.add(archetypeRepository);
+            repositories.add( archetypeRepository );
         }
-        else
-        if ( repositories.isEmpty() && localRepository != null )
+        else if ( repositories.isEmpty() && localRepository != null )
         {
-            repositories.add(localRepository);
-            
+            repositories.add( localRepository );
+
         }
+
         ArtifactRepository localRepo = localRepository;
         try
         {
@@ -56,21 +71,18 @@
         }
         catch ( ArtifactResolutionException e )
         {
-            throw new DownloadException( "Error downloading.", e );
+            throw new DownloadException( "Error downloading " + artifact.getId() + ".", e );
         }
         catch ( ArtifactNotFoundException e )
         {
-            throw new DownloadNotFoundException( "Requested download does not exist.", e );
+            throw new DownloadNotFoundException( "Requested " + artifact.getId() + " download does not exist.", e );
         }
 
         return artifact.getFile();
     }
-    public File downloadOld( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                         List remoteRepositories )
+
+    public File downloadOld( String groupId, String artifactId, String version, ArtifactRepository archetypeRepository,
+                             ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException
    {
         Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
@@ -80,11 +92,11 @@
         }
         catch ( ArtifactResolutionException e )
         {
-            throw new DownloadException( "Error downloading.", e );
+            throw new DownloadException( "Error downloading " + artifact.getId() + ".", e );
         }
         catch ( ArtifactNotFoundException e )
         {
-            throw new DownloadNotFoundException( "Requested download does not exist.", e );
+            throw new DownloadNotFoundException( "Requested " + artifact.getId() + " download does not exist.", e );
         }
 
         return artifact.getFile();
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
index c499dd7..f610e60 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * 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.
+ */
+
 /**
  * @author Jason van Zyl
  */
@@ -11,8 +30,7 @@
         super( string );
     }
 
-    public DownloadException( String string,
-                              Throwable throwable )
+    public DownloadException( String string, Throwable throwable )
     {
         super( string, throwable );
     }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
index 1c8e607..f8cbf94 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * 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.
+ */
+
 /**
  * @author Jason van Zyl
  */
@@ -11,8 +30,7 @@
         super( string );
     }
 
-    public DownloadNotFoundException( String string,
-                                      Throwable throwable )
+    public DownloadNotFoundException( String string, Throwable throwable )
     {
         super( string, throwable );
     }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
index ad041a0..c448880 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * 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.
+ */
+
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
 import java.io.File;
@@ -12,19 +31,11 @@
 {
     String ROLE = Downloader.class.getName();
 
-    public File download( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                          List remoteRepositories )
+    public File download( String groupId, String artifactId, String version, ArtifactRepository archetypeRepository,
+                          ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException;
 
-    public File downloadOld( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                          List remoteRepositories )
+    public File downloadOld( String groupId, String artifactId, String version, ArtifactRepository archetypeRepository,
+                             ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException;
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationConfigurationFailure.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationConfigurationFailure.java
index 1ea3be4..eefd92f 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationConfigurationFailure.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationConfigurationFailure.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class ArchetypeGenerationConfigurationFailure
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationFailure.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationFailure.java
index ffe12ef..1f46fd9 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationFailure.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationFailure.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class ArchetypeGenerationFailure
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
index c1732ef..53be0d4 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 import java.util.List;
 
 public class ArchetypeNotConfigured
@@ -26,10 +26,11 @@
 {
     private List missingProperties;
 
-    public List getMissingProperties() {
+    public List getMissingProperties()
+    {
         return missingProperties;
     }
-    
+
     public ArchetypeNotConfigured( List missingProperties )
     {
         this.missingProperties = missingProperties;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java
index 27fffd7..84c7ca3 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java
@@ -1,44 +1,44 @@
-/*

- * 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.exception;

-

-public class ArchetypeNotDefined

-    extends Exception

-{

-    public ArchetypeNotDefined()

-    {

-    }

-

-    public ArchetypeNotDefined( String msg )

-    {

-        super( msg );

-    }

-

-    public ArchetypeNotDefined( Throwable cause )

-    {

-        super( cause );

-    }

-

-    public ArchetypeNotDefined( String msg,

-                                Throwable cause )

-    {

-        super( msg, cause );

-    }

-}

+package org.apache.maven.archetype.exception;
+
+/*
+ * 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.
+ */
+
+public class ArchetypeNotDefined
+    extends Exception
+{
+    public ArchetypeNotDefined()
+    {
+    }
+
+    public ArchetypeNotDefined( String msg )
+    {
+        super( msg );
+    }
+
+    public ArchetypeNotDefined( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ArchetypeNotDefined( String msg,
+                                Throwable cause )
+    {
+        super( msg, cause );
+    }
+}
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeSelectionFailure.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeSelectionFailure.java
index d520a52..df5ab40 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeSelectionFailure.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeSelectionFailure.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class ArchetypeSelectionFailure
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/InvalidPackaging.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/InvalidPackaging.java
index f34702d..6ee191f 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/InvalidPackaging.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/InvalidPackaging.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class InvalidPackaging
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/OutputFileExists.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/OutputFileExists.java
index 8f3b328..271f288 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/OutputFileExists.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/OutputFileExists.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class OutputFileExists
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/PomFileExists.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/PomFileExists.java
index 449f7fc..d93acda 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/PomFileExists.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/PomFileExists.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class PomFileExists
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ProjectDirectoryExists.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ProjectDirectoryExists.java
index 40e7091..1ce2dd0 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/ProjectDirectoryExists.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/ProjectDirectoryExists.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class ProjectDirectoryExists
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/TemplateCreationException.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/TemplateCreationException.java
index 7365095..43219ad 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/TemplateCreationException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/TemplateCreationException.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class TemplateCreationException
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownArchetype.java
index 05a9ad0..d04ae2e 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownArchetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownArchetype.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class UnknownArchetype
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownGroup.java b/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownGroup.java
index 1f223b1..ecc53c1 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownGroup.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownGroup.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.exception;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.exception;
-
 public class UnknownGroup
     extends Exception
 {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
index b5f63db..eb34854 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/ArchetypeGenerator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.generator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,7 +19,7 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.generator;
+import java.io.File;
 
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
@@ -26,8 +28,9 @@
 {
     String ROLE = ArchetypeGenerator.class.getName();
 
-    void generateArchetype( ArchetypeGenerationRequest request,
-                            ArchetypeGenerationResult result );
+    void generateArchetype( ArchetypeGenerationRequest request, ArchetypeGenerationResult result );
+
+    void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile, ArchetypeGenerationResult result );
 
 //    void generateArchetype(
 //        File propertyFile,
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
index eb128e6..c2337cb 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.generator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,16 +19,10 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.generator;
-
 import org.apache.maven.archetype.old.OldArchetype;
-import org.apache.maven.archetype.old.ArchetypeDescriptorException;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
-import org.apache.maven.archetype.old.ArchetypeNotFoundException;
-import org.apache.maven.archetype.old.ArchetypeTemplateProcessingException;
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
-import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
 import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
 import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
@@ -45,10 +41,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Properties;
 
 /** @plexus.component */
 public class DefaultArchetypeGenerator
@@ -67,22 +60,9 @@
     /** @plexus.requirement */
     private OldArchetype oldArchetype;
 
-    private void generateArchetype(
-        ArchetypeGenerationRequest request,
-        ArtifactRepository localRepository,
-        String basedir
-    )
-        throws
-        IOException,
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
-        XmlPullParserException,
-        DocumentException,
-        InvalidPackaging,
+    private File getArchetypeFile( ArchetypeGenerationRequest request, ArtifactRepository localRepository )
+        throws IOException, ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, ProjectDirectoryExists,
+        PomFileExists, OutputFileExists, XmlPullParserException, DocumentException, InvalidPackaging,
         ArchetypeGenerationFailure
     {
         if ( !isArchetypeDefined( request ) )
@@ -90,62 +70,44 @@
             throw new ArchetypeNotDefined( "The archetype is not defined" );
         }
 
-        List repos = new ArrayList( /*repositories*/ );
+        List repos = new ArrayList/* repositories */();
 
         ArtifactRepository remoteRepo = null;
-        if ( request != null  && request.getArchetypeRepository() != null )
+        if ( request != null && request.getArchetypeRepository() != null )
         {
-            remoteRepo=archetypeRegistryManager.createRepository(
-                request.getArchetypeRepository(),
-                request.getArchetypeArtifactId() + "-repo" );
+            remoteRepo =
+                archetypeRegistryManager.createRepository( request.getArchetypeRepository(),
+                                                           request.getArchetypeArtifactId() + "-repo" );
 
             repos.add( remoteRepo );
         }
 
-        if ( !archetypeArtifactManager.exists(
-            request.getArchetypeGroupId(),
-            request.getArchetypeArtifactId(),
-            request.getArchetypeVersion(),remoteRepo,
-            localRepository,
-            repos ) )
+        if ( !archetypeArtifactManager.exists( request.getArchetypeGroupId(), request.getArchetypeArtifactId(),
+                                               request.getArchetypeVersion(), remoteRepo, localRepository, repos ) )
         {
-            throw new UnknownArchetype(
-                "The desired archetype does not exist (" + request.getArchetypeGroupId() + ":"
-                    + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion()
-                    + ")"
-            );
+            throw new UnknownArchetype( "The desired archetype does not exist (" + request.getArchetypeGroupId() + ":"
+                + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion() + ")" );
         }
 
-        if ( archetypeArtifactManager.isFileSetArchetype(
-            request.getArchetypeGroupId(),
-            request.getArchetypeArtifactId(),
-            request.getArchetypeVersion(),remoteRepo,
-            localRepository,
-            repos
-        )
-            )
+        File archetypeFile =
+            archetypeArtifactManager.getArchetypeFile( request.getArchetypeGroupId(), request.getArchetypeArtifactId(),
+                                                       request.getArchetypeVersion(), remoteRepo, localRepository,
+                                                       repos );
+        return archetypeFile;
+    }
+
+    private void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws IOException, UnknownArchetype, ArchetypeNotConfigured, ProjectDirectoryExists,
+        PomFileExists, OutputFileExists, XmlPullParserException, DocumentException, InvalidPackaging,
+        ArchetypeGenerationFailure
+    {
+        if ( archetypeArtifactManager.isFileSetArchetype( archetypeFile ) )
         {
-            processFileSetArchetype(
-                request,remoteRepo,
-                localRepository,
-                basedir,
-                repos
-            );
+            processFileSetArchetype( request, archetypeFile );
         }
-        else if (
-            archetypeArtifactManager.isOldArchetype(
-                request.getArchetypeGroupId(),
-                request.getArchetypeArtifactId(),
-                request.getArchetypeVersion(),remoteRepo,
-                localRepository,
-                repos ) )
+        else if ( archetypeArtifactManager.isOldArchetype( archetypeFile ) )
         {
-            processOldArchetype(
-                request,remoteRepo,
-                localRepository,
-                basedir,
-                repos
-            );
+            processOldArchetype( request, archetypeFile );
         }
         else
         {
@@ -161,184 +123,145 @@
 
     private boolean isArchetypeDefined( ArchetypeGenerationRequest request )
     {
-        return org.codehaus.plexus.util.StringUtils.isNotEmpty( request.getArchetypeGroupId() )
-        && org.codehaus.plexus.util.StringUtils.isNotEmpty( request.getArchetypeArtifactId() )
-        && org.codehaus.plexus.util.StringUtils.isNotEmpty( request.getArchetypeVersion() );
+        return StringUtils.isNotEmpty( request.getArchetypeGroupId() )
+            && StringUtils.isNotEmpty( request.getArchetypeArtifactId() )
+            && StringUtils.isNotEmpty( request.getArchetypeVersion() );
     }
 
     /** FileSetArchetype */
-    private void processFileSetArchetype(
-        final ArchetypeGenerationRequest request,
-        ArtifactRepository remoteRepo,
-        final ArtifactRepository localRepository,
-        final String basedir,
-        final List repositories
-    )
-        throws
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
+    private void processFileSetArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws UnknownArchetype, ArchetypeNotConfigured, ProjectDirectoryExists, PomFileExists, OutputFileExists,
         ArchetypeGenerationFailure
     {
-        //TODO: get rid of the property file usage.
-//        Properties properties = request.getProperties();
-//
-//        properties.setProperty( Constants.ARCHETYPE_GROUP_ID, request.getArchetypeGroupId() );
-//
-//        properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, request.getArchetypeArtifactId() );
-//
-//        properties.setProperty( Constants.ARCHETYPE_VERSION, request.getArchetypeVersion() );
-//
-//        properties.setProperty( Constants.GROUP_ID, request.getGroupId(  ) );
-//
-//        properties.setProperty( Constants.ARTIFACT_ID, request.getArtifactId(  ) );
-//
-//        properties.setProperty( Constants.VERSION, request.getVersion() );
-//
-//        properties.setProperty( Constants.PACKAGE, request.getPackage(  ) );
-//
-//        properties.setProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS, request.getArchetypeGoals() );
-
-        File archetypeFile =
-            archetypeArtifactManager.getArchetypeFile(
-                request.getArchetypeGroupId(),
-                request.getArchetypeArtifactId(),
-                request.getArchetypeVersion(),remoteRepo,
-                localRepository,
-                repositories
-            );
-
-        filesetGenerator.generateArchetype( request, archetypeFile, basedir );
+        filesetGenerator.generateArchetype( request, archetypeFile );
     }
 
-    private void processOldArchetype(
-        ArchetypeGenerationRequest request,
-        ArtifactRepository remoteRepo,
-        ArtifactRepository localRepository,
-        String basedir,
-        List repositories
-    )
-        throws
-        UnknownArchetype,
-        ArchetypeGenerationFailure
+    private void processOldArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws UnknownArchetype, ArchetypeGenerationFailure
     {
-        ArchetypeConfiguration archetypeConfiguration;
+        oldArchetype.createArchetype( request, archetypeFile );
+    }
 
-        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor =
-            archetypeArtifactManager.getOldArchetypeDescriptor(
-                request.getArchetypeGroupId(),
-                request.getArchetypeArtifactId(),
-                request.getArchetypeVersion(),remoteRepo,
-                localRepository,
-                repositories
-            );
-
-        Map map = new HashMap();
-
-        map.put( "basedir", basedir );
-
-        map.put( "package", request.getPackage() );
-
-        map.put( "packageName", request.getPackage() );
-
-        map.put( "groupId", request.getGroupId() );
-
-        map.put( "artifactId", request.getArtifactId() );
-
-        map.put( "version", request.getVersion() );
-//        try
-//        {
-            oldArchetype.createArchetype(
-                request.getArchetypeGroupId(),
-                request.getArchetypeArtifactId(),
-                request.getArchetypeVersion(),remoteRepo,
-                localRepository,
-                repositories,
-                map
-            );
-//        }
-//        catch ( ArchetypeDescriptorException ex )
-//        {
-//            throw new ArchetypeGenerationFailure(
-//                "Failed to generate project from the old archetype", ex
-//            );
-//        }
-//        catch ( ArchetypeTemplateProcessingException ex )
-//        {
-//            throw new ArchetypeGenerationFailure(
-//                "Failed to generate project from the old archetype", ex
-//            );
-//        }
-//        catch ( ArchetypeNotFoundException ex )
-//        {
-//            throw new ArchetypeGenerationFailure(
-//                "Failed to generate project from the old archetype", ex
-//            );
-//        }
+    public void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile, ArchetypeGenerationResult result )
+    {
+        try
+        {
+            generateArchetype( request, archetypeFile );
+        }
+        catch ( IOException ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( UnknownArchetype ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( ArchetypeNotConfigured ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( ProjectDirectoryExists ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( PomFileExists ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( OutputFileExists ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( XmlPullParserException ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( DocumentException ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( InvalidPackaging ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
+        catch ( ArchetypeGenerationFailure ex )
+        {
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
+        }
     }
 
     public void generateArchetype( ArchetypeGenerationRequest request, ArchetypeGenerationResult result )
     {
         try
         {
-            generateArchetype( request, request.getLocalRepository(), request.getOutputDirectory() );
+            File archetypeFile = getArchetypeFile( request, request.getLocalRepository() );
+
+            generateArchetype( request, archetypeFile, result );
         }
         catch ( IOException ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( ArchetypeNotDefined ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( UnknownArchetype ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( ArchetypeNotConfigured ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( ProjectDirectoryExists ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( PomFileExists ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( OutputFileExists ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( XmlPullParserException ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( DocumentException ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( InvalidPackaging ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
         catch ( ArchetypeGenerationFailure ex )
         {
-            getLogger().error(ex.getMessage(), ex);
-            result.setCause(ex);
+            getLogger().error( ex.getMessage(), ex );
+            result.setCause( ex );
         }
     }
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
index 1855254..c055c10 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.generator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.generator;
-
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
 import org.apache.maven.archetype.common.ArchetypeFilesResolver;
 import org.apache.maven.archetype.common.Constants;
@@ -78,25 +78,18 @@
     private VelocityComponent velocity;
 
     /**
-     * Token delimiter. 
+     * Token delimiter.
      */
     private static final String DELIMITER = "__";
 
     /**
      * Pattern used to detect tokens in a string. Tokens are any text surrounded
-     * by the delimiter. 
+     * by the delimiter.
      */
-    private static final Pattern TOKEN_PATTERN = Pattern.compile(".*" + DELIMITER + ".*" + DELIMITER + ".*");
+    private static final Pattern TOKEN_PATTERN = Pattern.compile( ".*" + DELIMITER + ".*" + DELIMITER + ".*" );
 
-    public void generateArchetype( ArchetypeGenerationRequest request,
-                                   File archetypeFile,
-                                   String basedir )
-        throws
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
+    public void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws UnknownArchetype, ArchetypeNotConfigured, ProjectDirectoryExists, PomFileExists, OutputFileExists,
         ArchetypeGenerationFailure
     {
         ClassLoader old = Thread.currentThread().getContextClassLoader();
@@ -110,35 +103,29 @@
             {
                 if ( request.isInteractiveMode () )
                 {
-                    throw new ArchetypeNotConfigured ( "No archetype was chosen", null );
+                    throw new ArchetypeNotConfigured ( "No archetype was chosen.", null );
                 }
                 else
                 {
                     StringBuffer exceptionMessage = new StringBuffer();
-                    exceptionMessage.append("Archetype " );
-                    exceptionMessage.append( request.getArchetypeGroupId() );
-                    exceptionMessage.append( ":" );
-                    exceptionMessage.append( request.getArchetypeArtifactId() );
-                    exceptionMessage.append( ":" );
-                    exceptionMessage.append( request.getArchetypeVersion() );
-                    exceptionMessage.append( " is not configured" );
-                    
+                    exceptionMessage.append( "Archetype " + request.getArchetypeGroupId() + ":"
+                        + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion()
+                        + " is not configured" );
+
                     List missingProperties = new ArrayList( 0 );
-                    java.util.Iterator requiredProperties = 
-                            archetypeDescriptor.getRequiredProperties().iterator();
-                    while( requiredProperties.hasNext() )
+                    for ( Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
+                        requiredProperties.hasNext(); )
                     {
-                        RequiredProperty requiredProperty = (RequiredProperty) requiredProperties.next ();
-                        if (org.codehaus.plexus.util.StringUtils.isEmpty(
-                            request.getProperties().getProperty ( requiredProperty.getKey() ) ) )
+                        RequiredProperty requiredProperty = (RequiredProperty) requiredProperties.next();
+
+                        if ( StringUtils.isEmpty( request.getProperties().getProperty( requiredProperty.getKey() ) ) )
                         {
-                            exceptionMessage.append( "\n\tProperty " );
-                            exceptionMessage.append( requiredProperty.getKey() );
+                            exceptionMessage.append( "\n\tProperty " + requiredProperty.getKey() + " is missing." );
+
                             missingProperties.add( requiredProperty.getKey() );
-                            exceptionMessage.append( " is missing." );
                         }
                     }
-                    
+
                     throw new ArchetypeNotConfigured( exceptionMessage.toString(), missingProperties );
                 }
             }
@@ -147,8 +134,8 @@
 
             String packageName = request.getPackage();
             String artifactId = request.getArtifactId();
-            File outputDirectoryFile = new File( basedir, artifactId );
-            File basedirPom = new File( basedir, Constants.ARCHETYPE_POM );
+            File outputDirectoryFile = new File( request.getOutputDirectory(), artifactId );
+            File basedirPom = new File( request.getOutputDirectory(), Constants.ARCHETYPE_POM );
             File pom = new File( outputDirectoryFile, Constants.ARCHETYPE_POM );
 
             List archetypeResources =
@@ -164,29 +151,20 @@
 
             if ( archetypeDescriptor.isPartial() )
             {
-                getLogger().debug(
-                    "Procesing partial archetype " + archetypeDescriptor.getName()
-                );
+                getLogger().debug( "Processing partial archetype " + archetypeDescriptor.getName() );
                 if ( outputDirectoryFile.exists() )
                 {
                     if ( !pom.exists() )
                     {
-                        throw new PomFileExists(
-                            "This is a partial archetype and the pom.xml file doesn't exist."
-                        );
+                        throw new PomFileExists( "This is a partial archetype and the pom.xml file doesn't exist." );
                     }
                     else
                     {
                         processPomWithMerge( context, pom, "" );
-                        processArchetypeTemplatesWithWarning(
-                            archetypeDescriptor,
-                            archetypeResources,
-                            archetypeZipFile,
-                            "",
-                            context,
-                            packageName,
-                            outputDirectoryFile
-                        );
+
+                        processArchetypeTemplatesWithWarning( archetypeDescriptor, archetypeResources,
+                                                              archetypeZipFile, "", context, packageName,
+                                                              outputDirectoryFile );
                     }
                 }
                 else
@@ -194,28 +172,17 @@
                     if ( basedirPom.exists() )
                     {
                         processPomWithMerge( context, basedirPom, "" );
-                        processArchetypeTemplatesWithWarning(
-                            archetypeDescriptor,
-                            archetypeResources,
-                            archetypeZipFile,
-                            "",
-                            context,
-                            packageName,
-                            new File( basedir )
-                        );
+
+                        processArchetypeTemplatesWithWarning( archetypeDescriptor, archetypeResources,
+                                                              archetypeZipFile, "", context, packageName,
+                                                              new File( request.getOutputDirectory() ) );
                     }
                     else
                     {
                         processPom( context, pom, "" );
-                        processArchetypeTemplates(
-                            archetypeDescriptor,
-                            archetypeResources,
-                            archetypeZipFile,
-                            "",
-                            context,
-                            packageName,
-                            outputDirectoryFile
-                        );
+
+                        processArchetypeTemplates( archetypeDescriptor, archetypeResources, archetypeZipFile, "",
+                                                   context, packageName, outputDirectoryFile );
                     }
                 }
 
@@ -226,12 +193,11 @@
             }
             else
             {
-                getLogger().debug(
-                    "Processing complete archetype " + archetypeDescriptor.getName()
-                );
+                getLogger().debug( "Processing complete archetype " + archetypeDescriptor.getName() );
                 if ( outputDirectoryFile.exists() && pom.exists() )
                 {
-                    throw new ProjectDirectoryExists( "A Maven 2 project already exists in the directory " + outputDirectoryFile.getPath() );
+                    throw new ProjectDirectoryExists( "A Maven 2 project already exists in the directory "
+                        + outputDirectoryFile.getPath() );
                 }
                 else
                 {
@@ -239,21 +205,11 @@
                     {
                         getLogger().warn( "The directory " + outputDirectoryFile.getPath() + " already exists." );
                     }
+
                     context.put( "rootArtifactId", artifactId );
 
-                    processFilesetModule(
-                        artifactId,
-                        artifactId,
-                        archetypeResources,
-                        pom,
-                        archetypeZipFile,
-                        "",
-                        basedirPom,
-                        outputDirectoryFile,
-                        packageName,
-                        archetypeDescriptor,
-                        context
-                    );
+                    processFilesetModule( artifactId, artifactId, archetypeResources, pom, archetypeZipFile, "",
+                                          basedirPom, outputDirectoryFile, packageName, archetypeDescriptor, context );
                 }
             }
         }
@@ -292,16 +248,9 @@
         return StringUtils.replace( packageName, ".", "/" );
     }
 
-    private void copyFile(
-        final File outFile,
-        final String template,
-        final boolean failIfExists,
-        final ZipFile archetypeZipFile
-    )
-        throws
-        FileNotFoundException,
-        OutputFileExists,
-        IOException
+    private void copyFile( final File outFile, final String template, final boolean failIfExists,
+                           final ZipFile archetypeZipFile )
+        throws FileNotFoundException, OutputFileExists, IOException
     {
         getLogger().debug( "Copying file " + template );
 
@@ -326,30 +275,19 @@
         }
     }
 
-    private void copyFiles(
-        String directory,
-        List fileSetResources,
-        boolean packaged,
-        String packageName,
-        File outputDirectoryFile,
-        ZipFile archetypeZipFile,
-        String moduleOffset,
-        boolean failIfExists,
-        Context context
-    )
-        throws
-        OutputFileExists,
-        FileNotFoundException,
-        IOException
+    private void copyFiles( String directory, List fileSetResources, boolean packaged, String packageName,
+                            File outputDirectoryFile, ZipFile archetypeZipFile, String moduleOffset,
+                            boolean failIfExists, Context context )
+        throws OutputFileExists, FileNotFoundException, IOException
     {
         Iterator iterator = fileSetResources.iterator();
 
         while ( iterator.hasNext() )
         {
             String template = (String) iterator.next();
-            File outputFile = getOutputFile( 
-                    template, directory, outputDirectoryFile, 
-                    packaged, packageName, moduleOffset, context);
+
+            File outputFile =
+                getOutputFile( template, directory, outputDirectoryFile, packaged, packageName, moduleOffset, context );
 
             copyFile( outputFile, template, failIfExists, archetypeZipFile );
         }
@@ -357,32 +295,24 @@
 
     private String getEncoding( String archetypeEncoding )
     {
-        return
-            ( ( null == archetypeEncoding ) || "".equals( archetypeEncoding ) )
-                ? "UTF-8"
-                : archetypeEncoding;
+        return StringUtils.isEmpty( archetypeEncoding ) ? "UTF-8" : archetypeEncoding;
     }
 
     private String getOffsetSeparator( String moduleOffset )
     {
-        return ( StringUtils.isEmpty( moduleOffset ) ? "/" : ( "/" + moduleOffset + "/" ) );
+        return StringUtils.isEmpty( moduleOffset ) ? "/" : ( "/" + moduleOffset + "/" );
     }
 
-    private File getOutputFile( 
-        String template, 
-        String directory, 
-        File outputDirectoryFile, 
-        boolean packaged, 
-        String packageName, 
-        String moduleOffset,
-        Context context )
+    private File getOutputFile( String template, String directory, File outputDirectoryFile, boolean packaged,
+                                String packageName, String moduleOffset, Context context )
     {
         String templateName = StringUtils.replaceOnce( template, directory, "" );
-        String outputFileName = directory + "/" + 
-                (packaged ? getPackageAsDirectory(packageName) : "") + 
-                "/" + templateName.substring(moduleOffset.length() );
 
-        if ( TOKEN_PATTERN.matcher(outputFileName).matches() ) 
+        String outputFileName =
+            directory + "/" + ( packaged ? getPackageAsDirectory( packageName ) : "" ) + "/"
+                + templateName.substring( moduleOffset.length() );
+
+        if ( TOKEN_PATTERN.matcher( outputFileName ).matches() )
         {
             outputFileName = replaceFilenameTokens( outputFileName, context );
         }
@@ -393,15 +323,15 @@
     }
 
     /**
-     * Replaces all tokens (text surrounded by the {@link #DELIMITER}) within 
-     * the given string, using properties contained within the context. If a 
-     * property does not exist in the context, the token is left unmodified 
+     * Replaces all tokens (text surrounded by the {@link #DELIMITER}) within
+     * the given string, using properties contained within the context. If a
+     * property does not exist in the context, the token is left unmodified
      * and a warning is logged.
      *
-     * @param filePath the file name and path to be interpolated  
-     * @param context contains the available properties 
-     */  
-    private String replaceFilenameTokens( String filePath, Context context ) 
+     * @param filePath the file name and path to be interpolated
+     * @param context contains the available properties
+     */
+    private String replaceFilenameTokens( String filePath, Context context )
     {
         String interpolatedResult = filePath;
         String propertyToken = null;
@@ -411,60 +341,55 @@
         int end = 0;
         int skipUndefinedPropertyIndex = 0;
 
-        int maxAttempts = StringUtils.countMatches( interpolatedResult, 
-                DELIMITER ) / 2;
+        int maxAttempts = StringUtils.countMatches( interpolatedResult, DELIMITER ) / 2;
 
-        for ( int x = 0; x < maxAttempts && start != -1; x++ ) 
+        for ( int x = 0; x < maxAttempts && start != -1; x++ )
         {
             start = interpolatedResult.indexOf( DELIMITER, skipUndefinedPropertyIndex );
 
-            if ( start != -1 ) 
+            if ( start != -1 )
             {
-                end = interpolatedResult.indexOf( DELIMITER, 
-                        start + DELIMITER.length() );
+                end = interpolatedResult.indexOf( DELIMITER, start + DELIMITER.length() );
 
-                if ( end != -1 ) 
+                if ( end != -1 )
                 {
-                   propertyToken = interpolatedResult.substring( 
-                           start + DELIMITER.length(), end );
+                    propertyToken = interpolatedResult.substring( start + DELIMITER.length(), end );
                 }
 
                 contextPropertyValue = (String) context.get( propertyToken );
-    
-                if ( contextPropertyValue != null && 
-                            contextPropertyValue.trim().length() > 0 ) 
+
+                if ( contextPropertyValue != null && contextPropertyValue.trim().length() > 0 )
                 {
-                    if (getLogger().isDebugEnabled())
+                    if ( getLogger().isDebugEnabled() )
                     {
-                        getLogger().debug( "Replacing '" + DELIMITER + propertyToken
-                                + DELIMITER + "' in file path '" + 
-                                interpolatedResult + "' with value '" + 
-                                contextPropertyValue + "'."); 
+                        getLogger().debug(
+                                           "Replacing '" + DELIMITER + propertyToken + DELIMITER + "' in file path '"
+                                               + interpolatedResult + "' with value '" + contextPropertyValue + "'." );
                     }
-                  
-                    interpolatedResult = StringUtils.replace( 
-                            interpolatedResult, 
-                            DELIMITER + propertyToken + DELIMITER, 
-                            contextPropertyValue );
-    
-                } else 
+
+                    interpolatedResult =
+                        StringUtils.replace( interpolatedResult, DELIMITER + propertyToken + DELIMITER,
+                                             contextPropertyValue );
+
+                }
+                else
                 {
                     // Need to skip the undefined property
                     skipUndefinedPropertyIndex = end + DELIMITER.length() + 1;
-                   
-                    getLogger().warn( "Property '" + propertyToken + 
-                            "' was not specified, so the token in '" + 
-                            interpolatedResult + "' is not being replaced." );
+
+                    getLogger().warn(
+                                      "Property '" + propertyToken + "' was not specified, so the token in '"
+                                          + interpolatedResult + "' is not being replaced." );
                 }
             }
         }
 
-        if (getLogger().isDebugEnabled())
+        if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "Final interpolated file path: '" + interpolatedResult + "'" ); 
+            getLogger().debug( "Final interpolated file path: '" + interpolatedResult + "'" );
         }
 
-        return interpolatedResult; 
+        return interpolatedResult;
     }
 
     private String getPackageInPathFormat( String aPackage )
@@ -476,22 +401,20 @@
     {
         boolean configured = true;
 
-        java.util.Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
-        while ( configured && requiredProperties.hasNext () )
-        {
-            RequiredProperty requiredProperty = (RequiredProperty) requiredProperties.next ();
+        Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
 
-            configured = configured &&
-                org.codehaus.plexus.util.StringUtils.isNotEmpty(
-                    request.getProperties().getProperty ( requiredProperty.getKey() )
-                );
+        while ( configured && requiredProperties.hasNext() )
+        {
+            RequiredProperty requiredProperty = (RequiredProperty) requiredProperties.next();
+
+            configured =
+                configured && StringUtils.isNotEmpty( request.getProperties().getProperty( requiredProperty.getKey() ) );
         }
 
         return configured;
     }
 
-    private void setParentArtifactId( Context context,
-                                      String artifactId )
+    private void setParentArtifactId( Context context, String artifactId )
     {
         context.put( Constants.PARENT_ARTIFACT_ID, artifactId );
     }
@@ -499,14 +422,13 @@
     private Context prepareVelocityContext( ArchetypeGenerationRequest request )
     {
         Context context = new VelocityContext();
-        context.put(Constants.GROUP_ID, request.getGroupId());
-        context.put(Constants.ARTIFACT_ID, request.getArtifactId());
-        context.put(Constants.VERSION, request.getVersion());
-        context.put(Constants.PACKAGE, request.getPackage());
-        context.put(Constants.PACKAGE_IN_PATH_FORMAT, getPackageInPathFormat(request.getPackage()));
+        context.put( Constants.GROUP_ID, request.getGroupId() );
+        context.put( Constants.ARTIFACT_ID, request.getArtifactId() );
+        context.put( Constants.VERSION, request.getVersion() );
+        context.put( Constants.PACKAGE, request.getPackage() );
+        context.put( Constants.PACKAGE_IN_PATH_FORMAT, getPackageInPathFormat( request.getPackage() ) );
 
-        Iterator iterator = request.getProperties().keySet().iterator();
-        while ( iterator.hasNext() )
+        for ( Iterator iterator = request.getProperties().keySet().iterator(); iterator.hasNext(); )
         {
             String key = (String) iterator.next();
 
@@ -517,114 +439,48 @@
         return context;
     }
 
-    private void processArchetypeTemplates(
-        AbstractArchetypeDescriptor archetypeDescriptor,
-        List archetypeResources,
-        ZipFile archetypeZipFile,
-        String moduleOffset,
-        Context context,
-        String packageName,
-        File outputDirectoryFile
-    )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure,
-        FileNotFoundException,
-        IOException
+    private void processArchetypeTemplates( AbstractArchetypeDescriptor archetypeDescriptor, List archetypeResources,
+                                            ZipFile archetypeZipFile, String moduleOffset, Context context,
+                                            String packageName, File outputDirectoryFile )
+        throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
     {
-        processTemplates(
-            packageName,
-            outputDirectoryFile,
-            context,
-            archetypeDescriptor,
-            archetypeResources,
-            archetypeZipFile,
-            moduleOffset,
-            false
-        );
+        processTemplates( packageName, outputDirectoryFile, context, archetypeDescriptor, archetypeResources,
+                          archetypeZipFile, moduleOffset, false );
     }
 
     private void processArchetypeTemplatesWithWarning(
-        org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
-        List archetypeResources,
-        ZipFile archetypeZipFile,
-        String moduleOffset,
-        Context context,
-        String packageName,
-        File outputDirectoryFile
-    )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure,
-        FileNotFoundException,
-        IOException
+                                                       org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
+                                                       List archetypeResources, ZipFile archetypeZipFile,
+                                                       String moduleOffset, Context context, String packageName,
+                                                       File outputDirectoryFile )
+        throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
     {
-        processTemplates(
-            packageName,
-            outputDirectoryFile,
-            context,
-            archetypeDescriptor,
-            archetypeResources,
-            archetypeZipFile,
-            moduleOffset,
-            true
-        );
+        processTemplates( packageName, outputDirectoryFile, context, archetypeDescriptor, archetypeResources,
+                          archetypeZipFile, moduleOffset, true );
     }
 
-    private void processFileSet(
-        String directory,
-        List fileSetResources,
-        boolean packaged,
-        String packageName,
-        Context context,
-        File outputDirectoryFile,
-        String moduleOffset,
-        String archetypeEncoding,
-        boolean failIfExists
-    )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure
+    private void processFileSet( String directory, List fileSetResources, boolean packaged, String packageName,
+                                 Context context, File outputDirectoryFile, String moduleOffset,
+                                 String archetypeEncoding, boolean failIfExists )
+        throws OutputFileExists, ArchetypeGenerationFailure
     {
-        Iterator iterator = fileSetResources.iterator();
-
-        while ( iterator.hasNext() )
+        for ( Iterator iterator = fileSetResources.iterator(); iterator.hasNext(); )
         {
             String template = (String) iterator.next();
 
-            String templateName = StringUtils.replaceOnce( template, directory, "" );
-            File outputFile = getOutputFile( 
-                    template, directory, outputDirectoryFile, 
-                    packaged, packageName, moduleOffset, context);
+            File outputFile =
+                getOutputFile( template, directory, outputDirectoryFile, packaged, packageName, moduleOffset, context );
 
-            processTemplate(outputFile,
-                context,
-                Constants.ARCHETYPE_RESOURCES + "/" + template,
-                archetypeEncoding,
-                failIfExists
-            );
+            processTemplate( outputFile, context, Constants.ARCHETYPE_RESOURCES + "/" + template, archetypeEncoding,
+                             failIfExists );
         }
     }
 
-    private void processFilesetModule(
-        String rootArtifactId,
-        String artifactId,
-        final List archetypeResources,
-        File pom,
-        final ZipFile archetypeZipFile,
-        String moduleOffset,
-        File basedirPom,
-        File outputDirectoryFile,
-        final String packageName,
-        final AbstractArchetypeDescriptor archetypeDescriptor,
-        final Context context
-    )
-        throws
-        DocumentException,
-        XmlPullParserException,
-        ArchetypeGenerationFailure,
-        InvalidPackaging,
-        IOException,
+    private void processFilesetModule( String rootArtifactId, String artifactId, final List archetypeResources,
+                                       File pom, final ZipFile archetypeZipFile, String moduleOffset, File basedirPom,
+                                       File outputDirectoryFile, final String packageName,
+                                       final AbstractArchetypeDescriptor archetypeDescriptor, final Context context )
+        throws DocumentException, XmlPullParserException, ArchetypeGenerationFailure, InvalidPackaging, IOException,
         OutputFileExists
     {
         outputDirectoryFile.mkdirs();
@@ -634,148 +490,93 @@
         getLogger().debug( "Processing module moduleOffset " + moduleOffset );
         getLogger().debug( "Processing module outputDirectoryFile " + outputDirectoryFile );
 
-        processFilesetProject(
-            archetypeDescriptor,
-            StringUtils.replace( artifactId, "${rootArtifactId}", rootArtifactId ),
-            archetypeResources,
-            pom,
-            archetypeZipFile,
-            moduleOffset,
-            context,
-            packageName,
-            outputDirectoryFile,
-            basedirPom
-        );
+        processFilesetProject( archetypeDescriptor,
+                               StringUtils.replace( artifactId, "${rootArtifactId}", rootArtifactId ),
+                               archetypeResources, pom, archetypeZipFile, moduleOffset, context, packageName,
+                               outputDirectoryFile, basedirPom );
 
         String parentArtifactId = (String) context.get( Constants.PARENT_ARTIFACT_ID );
+
         Iterator subprojects = archetypeDescriptor.getModules().iterator();
+
         if ( subprojects.hasNext() )
         {
-            getLogger().debug(
-                artifactId + " has modules (" + archetypeDescriptor.getModules() + ")"
-            );
+            getLogger().debug( artifactId + " has modules (" + archetypeDescriptor.getModules() + ")" );
+
             setParentArtifactId( context, StringUtils.replace( artifactId, "${rootArtifactId}", rootArtifactId ) );
         }
+
         while ( subprojects.hasNext() )
         {
             ModuleDescriptor project = (ModuleDescriptor) subprojects.next();
 
             artifactId = project.getId();
 
-            File moduleOutputDirectoryFile = new File( outputDirectoryFile,
-                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 ),
-                archetypeResources,
-                new File( moduleOutputDirectoryFile, Constants.ARCHETYPE_POM ),
-                archetypeZipFile,
-                ( StringUtils.isEmpty( moduleOffset ) ? "" : ( moduleOffset + "/" ) ) + StringUtils.replace( project.getDir(), "${rootArtifactId}",
-                    rootArtifactId ),
-                pom,
-                moduleOutputDirectoryFile,
-                packageName,
-                project,
-                context
-            );
+            File moduleOutputDirectoryFile =
+                new File( outputDirectoryFile,
+                          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 ),
+                                  archetypeResources,
+                                  new File( moduleOutputDirectoryFile, Constants.ARCHETYPE_POM ), archetypeZipFile,
+                                  ( StringUtils.isEmpty( moduleOffset ) ? "" : ( moduleOffset + "/" ) )
+                                      + StringUtils.replace( project.getDir(), "${rootArtifactId}", rootArtifactId ),
+                                  pom, moduleOutputDirectoryFile, packageName, project, context );
         }
+
         restoreParentArtifactId( context, parentArtifactId );
+
         getLogger().debug( "Processed " + artifactId );
     }
 
-    private void processFilesetProject(
-        final AbstractArchetypeDescriptor archetypeDescriptor,
-        final String moduleId,
-        final List archetypeResources,
-        final File pom,
-        final ZipFile archetypeZipFile,
-        String moduleOffset,
-        final Context context,
-        final String packageName,
-        final File outputDirectoryFile,
-        final File basedirPom
-    )
-        throws
-        DocumentException,
-        XmlPullParserException,
-        ArchetypeGenerationFailure,
-        InvalidPackaging,
-        IOException,
-        FileNotFoundException,
-        OutputFileExists
+    private void processFilesetProject( final AbstractArchetypeDescriptor archetypeDescriptor, final String moduleId,
+                                        final List archetypeResources, final File pom, final ZipFile archetypeZipFile,
+                                        String moduleOffset, final Context context, final String packageName,
+                                        final File outputDirectoryFile, final File basedirPom )
+        throws DocumentException, XmlPullParserException, ArchetypeGenerationFailure, InvalidPackaging, IOException,
+        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(
-                context,
-                pom,
-                moduleOffset,
-                basedirPom,
-                moduleId
-            );
+            processPomWithParent( context, pom, moduleOffset, basedirPom, moduleId );
         }
         else
         {
             processPom( context, pom, moduleOffset );
         }
 
-        processArchetypeTemplates(
-            archetypeDescriptor,
-            archetypeResources,
-            archetypeZipFile,
-            moduleOffset,
-            context,
-            packageName,
-            outputDirectoryFile
-        );
+        processArchetypeTemplates( archetypeDescriptor, archetypeResources, archetypeZipFile, moduleOffset, context,
+                                   packageName, outputDirectoryFile );
     }
 
-    private void processPom( Context context,
-                             File pom,
-                             String moduleOffset )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure
+    private void processPom( Context context, File pom, String moduleOffset )
+        throws OutputFileExists, ArchetypeGenerationFailure
     {
         getLogger().debug( "Processing pom " + pom );
-        processTemplate(
-            pom,
-            context,
-            Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
-                + Constants.ARCHETYPE_POM,
-            getEncoding( null ),
-            true
-        );
+
+        processTemplate( pom, context, Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
+            + Constants.ARCHETYPE_POM, getEncoding( null ), true );
     }
 
-    private void processPomWithMerge( Context context,
-                                      File pom,
-                                      String moduleOffset )
-        throws
-        OutputFileExists,
-        IOException,
-        XmlPullParserException,
-        ArchetypeGenerationFailure
+    private void processPomWithMerge( Context context, File pom, String moduleOffset )
+        throws OutputFileExists, IOException, XmlPullParserException, ArchetypeGenerationFailure
     {
         getLogger().debug( "Processing pom " + pom + " with merge" );
 
         File temporaryPom = getTemporaryFile( pom );
 
-        processTemplate(
-            temporaryPom,
-            context,
-            Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
-                + Constants.ARCHETYPE_POM,
-            getEncoding( null ),
-            true
-        );
+        processTemplate( temporaryPom, context, Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
+            + Constants.ARCHETYPE_POM, getEncoding( null ), true );
 
         pomManager.mergePoms( pom, temporaryPom );
 
@@ -791,67 +592,48 @@
         }
     }
 
-    private void processPomWithParent(
-        Context context,
-        File pom,
-        String moduleOffset,
-        File basedirPom,
-        String moduleId
-    )
-        throws
-        OutputFileExists,
-        XmlPullParserException,
-        DocumentException,
-        IOException,
-        InvalidPackaging,
+    private void processPomWithParent( Context context, File pom, String moduleOffset, File basedirPom, String moduleId )
+        throws OutputFileExists, XmlPullParserException, DocumentException, IOException, InvalidPackaging,
         ArchetypeGenerationFailure
     {
         getLogger().debug( "Processing pom " + pom + " with parent " + basedirPom );
-        processTemplate(
-            pom,
-            context,
-            Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
-                + Constants.ARCHETYPE_POM,
-            getEncoding( null ),
-            true
-        );
+
+        processTemplate( pom, context, Constants.ARCHETYPE_RESOURCES + getOffsetSeparator( moduleOffset )
+            + Constants.ARCHETYPE_POM, getEncoding( null ), true );
 
         getLogger().debug( "Adding module " + moduleId );
+
         pomManager.addModule( basedirPom, moduleId );
+
         pomManager.addParent( pom, basedirPom );
     }
 
-    private void processTemplate(
-        File outFile,
-        Context context,
-        String templateFileName,
-        String encoding,
-        boolean failIfExists
-    )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure
+    private void processTemplate( File outFile, Context context, String templateFileName, String encoding,
+                                  boolean failIfExists )
+        throws OutputFileExists, ArchetypeGenerationFailure
     {
         templateFileName = templateFileName.replace( File.separatorChar, '/' );
-        
-        if ( !velocity.getEngine ().templateExists( templateFileName )
-            && velocity.getEngine ().templateExists(
-                templateFileName.replace ( '/', File.separatorChar )
-            )
-        )
+
+        String localTemplateFileName = templateFileName.replace( '/', File.separatorChar );
+        if ( !templateFileName.equals( localTemplateFileName )
+            && !velocity.getEngine().templateExists( templateFileName )
+            && velocity.getEngine().templateExists( localTemplateFileName ) )
         {
-            templateFileName = templateFileName.replace ( '/', File.separatorChar );
+            templateFileName = localTemplateFileName;
         }
-        
+
         getLogger().debug( "Prosessing template " + templateFileName );
 
-        if ( failIfExists && outFile.exists() )
+        if ( outFile.exists() )
         {
-            throw new OutputFileExists( "Don't rewrite file " + outFile.getAbsolutePath() );
-        }
-        else if ( outFile.exists() )
-        {
-            getLogger().warn( "PT Don't override file " + outFile );
+            if ( failIfExists )
+            {
+                throw new OutputFileExists( "Don't override file " + outFile.getAbsolutePath() );
+            }
+            else
+            {
+                getLogger().warn( "Don't override file " + outFile );
+            }
         }
         else
         {
@@ -874,94 +656,61 @@
             }
             catch ( Exception e )
             {
-                throw new ArchetypeGenerationFailure(
-                    "Error merging velocity templates: " + e.getMessage(),
-                    e
-                );
+                throw new ArchetypeGenerationFailure( "Error merging velocity templates: " + e.getMessage(), e );
             }
             finally
             {
                 IOUtil.close( writer );
-                writer = null;
             }
         }
     }
 
-    private void processTemplates(
-        String packageName,
-        File outputDirectoryFile,
-        Context context,
-        AbstractArchetypeDescriptor archetypeDescriptor,
-        List archetypeResources,
-        ZipFile archetypeZipFile,
-        String moduleOffset,
-        boolean failIfExists
-    )
-        throws
-        OutputFileExists,
-        ArchetypeGenerationFailure,
-        FileNotFoundException,
-        IOException
+    private void processTemplates( String packageName, File outputDirectoryFile, Context context,
+                                   AbstractArchetypeDescriptor archetypeDescriptor, List archetypeResources,
+                                   ZipFile archetypeZipFile, String moduleOffset, boolean failIfExists )
+        throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
     {
         Iterator iterator = archetypeDescriptor.getFileSets().iterator();
         if ( iterator.hasNext() )
         {
             getLogger().debug( "Processing filesets" );
         }
+
         while ( iterator.hasNext() )
         {
             FileSet fileSet = (FileSet) iterator.next();
 
-            List fileSetResources =
-                archetypeFilesResolver.filterFiles( moduleOffset, fileSet, archetypeResources );
+            List fileSetResources = archetypeFilesResolver.filterFiles( moduleOffset, fileSet, archetypeResources );
 
-            //This creates an empty directory, even if there is no file to process
-            //Fix for ARCHETYPE-57
-            getOutputFile(
-                moduleOffset, fileSet.getDirectory(), outputDirectoryFile,
-                fileSet.isPackaged(), packageName, moduleOffset, context ).mkdirs();
-
+            // This creates an empty directory, even if there is no file to process
+            // Fix for ARCHETYPE-57
+            getOutputFile( moduleOffset, fileSet.getDirectory(), outputDirectoryFile, fileSet.isPackaged(),
+                           packageName, moduleOffset, context ).mkdirs();
 
             if ( fileSet.isFiltered() )
             {
                 getLogger().debug(
-                    "Processing fileset " + fileSet + "\n\n\n\n" + fileSetResources + "\n\n"
-                        + archetypeResources + "\n\n"
-                );
-                processFileSet(
-                    fileSet.getDirectory(),
-                    fileSetResources,
-                    fileSet.isPackaged(),
-                    packageName,
-                    context,
-                    outputDirectoryFile,
-                    moduleOffset,
-                    getEncoding( fileSet.getEncoding() ),
-                    failIfExists
-                );
-                getLogger().debug( "Processed " + fileSetResources.size() + " files" );
+                                   "Processing fileset " + fileSet + "\n\n\n\n" + fileSetResources + "\n\n"
+                                       + archetypeResources + "\n\n" );
+
+                processFileSet( fileSet.getDirectory(), fileSetResources, fileSet.isPackaged(), packageName, context,
+                                outputDirectoryFile, moduleOffset, getEncoding( fileSet.getEncoding() ), failIfExists );
+
+                getLogger().debug( "Processed " + fileSetResources.size() + " files." );
             }
             else
             {
                 getLogger().debug( "Copying fileset " + fileSet );
-                copyFiles(
-                    fileSet.getDirectory(),
-                    fileSetResources,
-                    fileSet.isPackaged(),
-                    packageName,
-                    outputDirectoryFile,
-                    archetypeZipFile,
-                    moduleOffset,
-                    failIfExists,
-                    context
-                );
-                getLogger().debug( "Copied " + fileSetResources.size() + " files" );
+
+                copyFiles( fileSet.getDirectory(), fileSetResources, fileSet.isPackaged(), packageName,
+                           outputDirectoryFile, archetypeZipFile, moduleOffset, failIfExists, context );
+
+                getLogger().debug( "Copied " + fileSetResources.size() + " files." );
             }
         }
     }
 
-    private void restoreParentArtifactId( Context context,
-                                          String parentArtifactId )
+    private void restoreParentArtifactId( Context context, String parentArtifactId )
     {
         if ( StringUtils.isEmpty( parentArtifactId ) )
         {
@@ -975,9 +724,10 @@
 
     private File getTemporaryFile( File file )
     {
-        File tmp =
-            FileUtils.createTempFile( file.getName(), Constants.TMP, file.getParentFile() );
+        File tmp = FileUtils.createTempFile( file.getName(), Constants.TMP, file.getParentFile() );
+
         tmp.deleteOnExit();
+
         return tmp;
     }
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java
index b113d7a..425e756 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.generator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.generator;
-
 import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
 import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
 import org.apache.maven.archetype.exception.OutputFileExists;
@@ -34,15 +34,8 @@
 {
     String ROLE = FilesetArchetypeGenerator.class.getName();
 
-    void generateArchetype( ArchetypeGenerationRequest request,
-                            File archetypeFile,
-                            String basedir )
-        throws
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        ProjectDirectoryExists,
-        PomFileExists,
-        OutputFileExists,
+    void generateArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws UnknownArchetype, ArchetypeNotConfigured, ProjectDirectoryExists, PomFileExists, OutputFileExists,
         ArchetypeGenerationFailure;
 
 //    Compile time deprecation ;-)
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
index 4794890..e156a75 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeDescriptorException.java
@@ -1,23 +1,26 @@
 package org.apache.maven.archetype.old;
 
-import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
-
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
index 9010df8..75d22fb 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeNotFoundException.java
@@ -1,23 +1,26 @@
 package org.apache.maven.archetype.old;
 
-import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
-
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
index 6b1ae57..fd6b1b4 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/ArchetypeTemplateProcessingException.java
@@ -1,23 +1,26 @@
 package org.apache.maven.archetype.old;
 
-import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
-
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
index d6967fc..8e99cdb 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
@@ -1,26 +1,31 @@
 package org.apache.maven.archetype.old;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor;
 import org.apache.maven.archetype.old.descriptor.ArchetypeDescriptorBuilder;
 import org.apache.maven.archetype.old.descriptor.TemplateDescriptor;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
+import org.apache.maven.archetype.common.Constants;
 import org.apache.maven.archetype.exception.UnknownArchetype;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
@@ -33,7 +38,9 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.codehaus.plexus.velocity.VelocityComponent;
 import org.dom4j.Document;
@@ -45,8 +52,6 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -57,8 +62,8 @@
 import java.io.Writer;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -99,31 +104,36 @@
     // artifactId = maven-foo-archetype
     // version = latest
 
-    public void createArchetype( String archetypeGroupId,
-                                 String archetypeArtifactId,
-                                 String archetypeVersion,
-                                 ArtifactRepository archetypeRepository,
-                                 ArtifactRepository localRepository,
-                                 List remoteRepositories,
-                                 Map parameters )
+    public void createArchetype( ArchetypeGenerationRequest request, ArtifactRepository archetypeRepository )
         throws UnknownArchetype, ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException
     {
         // ----------------------------------------------------------------------
         // Download the archetype
         // ----------------------------------------------------------------------
 
-        File archetype;
+        File archetypeFile = archetypeArtifactManager.getArchetypeFile(
+                request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(),
+                archetypeRepository, request.getLocalRepository(), request.getRemoteArtifactRepositories() );
 
-//        try
-//        {
-            archetype = archetypeArtifactManager.getArchetypeFile( 
-                archetypeGroupId, archetypeArtifactId, archetypeVersion, 
-                archetypeRepository, localRepository, remoteRepositories );
-//        }
-//        catch ( UnknownArchetype e )
-//        {
-//            throw new ArchetypeDescriptorException( "Error attempting to download archetype.", e );
-//        }
+        createArchetype( request, archetypeFile );
+    }
+
+    public void createArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws ArchetypeDescriptorException, ArchetypeTemplateProcessingException
+    {
+        Map parameters = new HashMap();
+
+        parameters.put( "basedir", request.getOutputDirectory() );
+
+        parameters.put( Constants.PACKAGE, request.getPackage() );
+
+        parameters.put( "packageName", request.getPackage() );
+
+        parameters.put( Constants.GROUP_ID, request.getGroupId() );
+
+        parameters.put( Constants.ARTIFACT_ID, request.getArtifactId() );
+
+        parameters.put( Constants.VERSION, request.getVersion() );
 
         // ---------------------------------------------------------------------
         // Get Logger and display all parameters used
@@ -134,8 +144,8 @@
             {
                 getLogger().info( "----------------------------------------------------------------------------" );
 
-                getLogger().info( "Using following parameters for creating OldArchetype: " + archetypeArtifactId + ":" +
-                    archetypeVersion );
+                getLogger().info( "Using following parameters for creating OldArchetype: "
+                                      + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion() );
 
                 getLogger().info( "----------------------------------------------------------------------------" );
 
@@ -168,15 +178,17 @@
 
         URLClassLoader archetypeJarLoader;
 
+        InputStream is = null;
+
         try
         {
             URL[] urls = new URL[1];
 
-            urls[0] = archetype.toURL();
+            urls[0] = archetypeFile.toURL();
 
             archetypeJarLoader = new URLClassLoader( urls );
 
-            InputStream is = getStream( ARCHETYPE_DESCRIPTOR, archetypeJarLoader );
+            is = getStream( ARCHETYPE_DESCRIPTOR, archetypeJarLoader );
 
             if ( is == null )
             {
@@ -199,16 +211,18 @@
         {
             throw new ArchetypeDescriptorException( "Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e );
         }
+        finally
+        {
+            IOUtil.close( is );
+        }
 
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
-        String basedir = (String) parameters.get( "basedir" );
+        String artifactId = request.getArtifactId();
 
-        String artifactId = (String) parameters.get( "artifactId" );
-
-        File parentPomFile = new File( basedir, ARCHETYPE_POM );
+        File parentPomFile = new File( request.getOutputDirectory(), ARCHETYPE_POM );
 
         File outputDirectoryFile;
 
@@ -216,7 +230,7 @@
         File pomFile;
         if ( parentPomFile.exists() && descriptor.isAllowPartial() && artifactId == null )
         {
-            outputDirectoryFile = new File( basedir );
+            outputDirectoryFile = new File( request.getOutputDirectory() );
             creating = false;
             pomFile = parentPomFile;
         }
@@ -228,7 +242,7 @@
                     "Artifact ID must be specified when creating a new project from an archetype." );
             }
 
-            outputDirectoryFile = new File( basedir, artifactId );
+            outputDirectoryFile = new File( request.getOutputDirectory(), artifactId );
             creating = true;
 
             if ( outputDirectoryFile.exists() )
@@ -239,8 +253,8 @@
                 }
                 else
                 {
-                    throw new ArchetypeTemplateProcessingException( "Directory " +
-                        outputDirectoryFile.getName() + " already exists - please run from a clean directory" );
+                    throw new ArchetypeTemplateProcessingException( "Directory "
+                        + outputDirectoryFile.getName() + " already exists - please run from a clean directory" );
                 }
             }
 
@@ -249,13 +263,13 @@
 
         if ( creating )
         {
-            if ( parameters.get( "groupId" ) == null )
+            if ( request.getGroupId() == null )
             {
                 throw new ArchetypeTemplateProcessingException(
                     "Group ID must be specified when creating a new project from an archetype." );
             }
 
-            if ( parameters.get( "version" ) == null )
+            if ( request.getVersion() == null )
             {
                 throw new ArchetypeTemplateProcessingException(
                     "Version must be specified when creating a new project from an archetype." );
@@ -264,7 +278,7 @@
 
         String outputDirectory = outputDirectoryFile.getAbsolutePath();
 
-        String packageName = (String) parameters.get( "package" );
+        String packageName = request.getPackage();
 
         // ----------------------------------------------------------------------
         // Set up the Velocity context
@@ -272,7 +286,7 @@
 
         Context context = new VelocityContext();
 
-        context.put( "package", packageName );
+        context.put( Constants.PACKAGE, packageName );
 
         for ( Iterator iterator = parameters.keySet().iterator(); iterator.hasNext(); )
         {
@@ -296,11 +310,11 @@
         {
             if ( parentPomFile.exists() )
             {
-                FileReader fileReader = null;
+                Reader fileReader = null;
 
                 try
                 {
-                    fileReader = new FileReader( parentPomFile );
+                    fileReader = ReaderFactory.newXmlReader( parentPomFile );
                     MavenXpp3Reader reader = new MavenXpp3Reader();
                     parentModel = reader.read( fileReader );
                     if ( !"pom".equals( parentModel.getPackaging() ) )
@@ -358,12 +372,12 @@
                 IOUtil.close( fileWriter );
             }
 */
-            FileReader fileReader = null;
+            Reader fileReader = null;
             boolean added;
             StringWriter w = new StringWriter();
             try
             {
-                fileReader = new FileReader( parentPomFile );
+                fileReader = ReaderFactory.newXmlReader( parentPomFile );
                 added = addModuleToParentPom( artifactId, fileReader, w );
             }
             catch ( IOException e )
@@ -381,14 +395,20 @@
 
             if ( added )
             {
+                Writer out = null;
                 try
                 {
-                    FileUtils.fileWrite( parentPomFile.getAbsolutePath(), w.toString() );
+                    out = WriterFactory.newXmlWriter( parentPomFile );
+                    IOUtil.copy( w.toString(), out );
                 }
                 catch ( IOException e )
                 {
                     throw new ArchetypeTemplateProcessingException( "Unable to rewrite parent POM", e );
                 }
+                finally
+                {
+                    IOUtil.close( out );
+                }
             }
         }
 
@@ -488,10 +508,10 @@
         // ---------------------------------------------------------------------
 
         Model generatedModel;
-        FileReader pomReader = null;
+        Reader pomReader = null;
         try
         {
-            pomReader = new FileReader( pomFile );
+            pomReader = ReaderFactory.newXmlReader( pomFile );
 
             MavenXpp3Reader reader = new MavenXpp3Reader();
 
@@ -526,10 +546,10 @@
             }
             generatedModel.setParent( parent );
 
-            FileWriter pomWriter = null;
+            Writer pomWriter = null;
             try
             {
-                pomWriter = new FileWriter( pomFile );
+                pomWriter = WriterFactory.newXmlWriter( pomFile );
 
                 MavenXpp3Writer writer = new MavenXpp3Writer();
                 writer.write( pomWriter, generatedModel );
@@ -745,8 +765,8 @@
     private String getOutputDirectory( String outputDirectory,
                                        String testResourceDirectory )
     {
-        return outputDirectory +
-            ( testResourceDirectory.startsWith( "/" ) ? testResourceDirectory : "/" + testResourceDirectory );
+        return outputDirectory
+            + ( testResourceDirectory.startsWith( "/" ) ? testResourceDirectory : "/" + testResourceDirectory );
     }
 
     // ----------------------------------------------------------------------
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
index 7986a5b..324bb02 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/OldArchetype.java
@@ -1,25 +1,29 @@
 package org.apache.maven.archetype.old;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
-import java.util.List;
-import java.util.Map;
+import java.io.File;
+
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.exception.UnknownArchetype;
 
 /**
@@ -39,8 +43,15 @@
     // TODO: delete this, it probably should be project.getFile instead
     String ARCHETYPE_POM = "pom.xml";
 
-    void createArchetype( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository, List remoteRepositories, Map parameters )
+    /**
+     * Download an archetype then create a project from it.
+     */
+    void createArchetype( ArchetypeGenerationRequest request, ArtifactRepository archetypeRepository )
         throws UnknownArchetype, ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException;
+
+    /**
+     * Create a project from an archetype file.
+     */
+    void createArchetype( ArchetypeGenerationRequest request, File archetypeFile )
+        throws ArchetypeDescriptorException, ArchetypeTemplateProcessingException;
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
index 227f25c..3ecd26d 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
@@ -1,19 +1,22 @@
 package org.apache.maven.archetype.old.descriptor;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 import java.util.ArrayList;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilder.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilder.java
index 2fabf1c..cbd83d8 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilder.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilder.java
@@ -1,19 +1,22 @@
 package org.apache.maven.archetype.old.descriptor;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 import org.codehaus.plexus.util.xml.Xpp3Dom;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorGenerator.java
index 5cc4332..9e7b6e2 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorGenerator.java
@@ -1,19 +1,22 @@
 package org.apache.maven.archetype.old.descriptor;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 /**
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
index 0a36368..1ec5f80 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
@@ -1,19 +1,22 @@
 package org.apache.maven.archetype.old.descriptor;
 
 /*
- * Copyright 2004-2006 The Apache Software Foundation.
+ * 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 import java.io.OutputStreamWriter;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawler.java b/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawler.java
index 8c34efb..1fa2987 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawler.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawler.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.repositorycrawler;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,10 +19,7 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.repositorycrawler;
-
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
@@ -30,12 +29,14 @@
 import org.apache.maven.model.Model;
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
+import java.io.Writer;
 
 import java.util.Iterator;
 
@@ -164,12 +165,12 @@
 
     public boolean writeCatalog ( ArchetypeCatalog archetypeCatalog, File archetypeCatalogFile )
     {
-        FileWriter fileWriter = null;
+        Writer fileWriter = null;
         try
         {
             ArchetypeCatalogXpp3Writer catalogWriter = new ArchetypeCatalogXpp3Writer ();
 
-            fileWriter = new FileWriter ( archetypeCatalogFile );
+            fileWriter = WriterFactory.newXmlWriter ( archetypeCatalogFile );
             catalogWriter.write ( fileWriter, archetypeCatalog );
             return true;
         }
@@ -180,7 +181,7 @@
         }
         finally
         {
-            IOUtils.closeQuietly(fileWriter);
+            IOUtil.close( fileWriter );
         }
     }
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java b/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java
index 57a65c2..9c25157 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.repositorycrawler;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.repositorycrawler;
-
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 
 import java.io.File;
@@ -31,6 +31,6 @@
     String ROLE = RepositoryCrawler.class.getName ();
 
     ArchetypeCatalog crawl ( File repository );
-    
-    boolean writeCatalog (ArchetypeCatalog archetypeCatalog, File archetypeCatalogFile);
+
+    boolean writeCatalog( ArchetypeCatalog archetypeCatalog, File archetypeCatalogFile );
 }
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java
index 902c67e..b4c0c99 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.source;
 
+/*
+ * 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.
+ */
+
 import java.io.Writer;
 import java.util.List;
 import java.util.Properties;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java
index fab7543..b3418b4 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.source;
 
+/*
+ * 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.
+ */
+
 /** @author Jason van Zyl */
 public class ArchetypeDataSinkException
     extends Exception
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSource.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSource.java
index ebbbc6c..f6dd9c0 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSource.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSource.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceDescriptor.java
index 336f500..13b6f11 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceDescriptor.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceDescriptor.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceException.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceException.java
index b90a54d..4dff4b6 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceException.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSourceException.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 /** @author Jason van Zyl */
 public class ArchetypeDataSourceException
     extends Exception
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java
index 49f98a0..320fd01 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.source;
 
+/*
+ * 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.
+ */
+
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSource.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSource.java
index 0d48360..82366d4 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSource.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSource.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,23 +19,22 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Reader;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -77,7 +78,7 @@
 
             try
             {
-                ArchetypeCatalog catalog = readCatalog( new FileReader( catalogFile ) );
+                ArchetypeCatalog catalog = readCatalog( ReaderFactory.newXmlReader( catalogFile ) );
 
                 return createArchetypeMap( catalog );
             }
@@ -85,6 +86,10 @@
             {
                 throw new ArchetypeDataSourceException( "The specific archetype catalog does not exist.", e );
             }
+            catch ( IOException e )
+            {
+                throw new ArchetypeDataSourceException( "Error reading archetype catalog.", e );
+            }
         }
         else
         {
@@ -110,13 +115,17 @@
             try
             {
                 getLogger().debug( "Reading the catalog " + catalogFile );
-                catalog = readCatalog( new FileReader( catalogFile ) );
+                catalog = readCatalog( ReaderFactory.newXmlReader( catalogFile ) );
             }
             catch ( FileNotFoundException ex )
             {
                 getLogger().debug( "Catalog file don't exist" );
                 catalog = new ArchetypeCatalog();
             }
+            catch ( IOException e )
+            {
+                throw new ArchetypeDataSourceException( "Error reading archetype catalog.", e );
+            }
         }
         else
         {
@@ -155,10 +164,10 @@
                                       File catalogFile )
         throws ArchetypeDataSourceException
     {
-        FileWriter writer = null;
+        Writer writer = null;
         try
         {
-            writer = new FileWriter( catalogFile );
+            writer = WriterFactory.newXmlWriter( catalogFile );
             catalogWriter.write( writer, catalog );
         }
         catch ( IOException e )
@@ -226,7 +235,7 @@
 
             try
             {
-                return readCatalog( new FileReader( catalogFile ) );
+                return readCatalog( ReaderFactory.newXmlReader( catalogFile ) );
 
             }
             catch ( FileNotFoundException e )
@@ -234,6 +243,10 @@
                 throw new ArchetypeDataSourceException( "The specific archetype catalog does not exist.",
                     e );
             }
+            catch ( IOException e )
+            {
+                throw new ArchetypeDataSourceException( "Error reading archetype catalog.", e );
+            }
         }
         else
         {
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/InternalCatalogArchetypeDataSource.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/InternalCatalogArchetypeDataSource.java
index 693aa61..c7114c7 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/InternalCatalogArchetypeDataSource.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/InternalCatalogArchetypeDataSource.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,11 +19,10 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
+import org.codehaus.plexus.util.ReaderFactory;
 
-import java.io.InputStreamReader;
+import java.io.IOException;
 import java.io.Reader;
 import java.util.List;
 import java.util.Properties;
@@ -37,19 +38,33 @@
     public ArchetypeCatalog getArchetypeCatalog( Properties properties )
         throws ArchetypeDataSourceException
     {
-        Reader reader = new InputStreamReader(
-            getClass().getClassLoader().getResourceAsStream( "archetype-catalog.xml" ) );
+        try
+        {
+            Reader reader = ReaderFactory.newXmlReader(
+                getClass().getClassLoader().getResourceAsStream( "archetype-catalog.xml" ) );
 
-        return readCatalog( reader );
+            return readCatalog( reader );
+        }
+        catch ( IOException e )
+        {
+            throw new ArchetypeDataSourceException( "Error reading archetype catalog.", e );
+        }
     }
 
     public List getArchetypes( Properties properties )
         throws ArchetypeDataSourceException
     {
-        Reader reader = new InputStreamReader(
-            getClass().getClassLoader().getResourceAsStream( "archetype-catalog.xml" ) );
+        try
+        {
+            Reader reader = ReaderFactory.newXmlReader(
+                getClass().getClassLoader().getResourceAsStream( "archetype-catalog.xml" ) );
 
-        return createArchetypeMap( readCatalog( reader ) );
+            return createArchetypeMap( readCatalog( reader ) );
+        }
+        catch ( IOException e )
+        {
+            throw new ArchetypeDataSourceException( "Error reading archetype catalog.", e );
+        }
     }
 
 //    public void updateCatalog( Properties properties,
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java
index 0b49732..2093ae2 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,18 +19,16 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.source;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.repository.Repository;
 
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 import java.util.Properties;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
+import org.codehaus.plexus.util.ReaderFactory;
 
 /**
  * @plexus.component role-hint="remote-catalog"
@@ -40,7 +40,7 @@
     /** @plexus.requirement */
     private WagonManager wagonManager;
 
-    public static String REPOSITORY_PROPERTY = "repository";
+    public static final String REPOSITORY_PROPERTY = "repository";
 
     public ArchetypeCatalog getArchetypeCatalog( Properties properties )
         throws ArchetypeDataSourceException
@@ -56,43 +56,55 @@
         {
             if ( repository.endsWith( "/" ) )
             {
-                repository = repository.substring( 0, repository.length(  ) - 1 );
+                repository = repository.substring( 0, repository.length() - 1 );
             }
 
-            getLogger().debug("Searching for remote catalog: "+ repository +"/archetype-catalog.xml");
+            getLogger().debug( "Searching for remote catalog: " + repository + "/archetype-catalog.xml" );
             // We use wagon to take advantage of a Proxy that has already been setup in a Maven environment.
             Repository wagonRepository = new Repository( "archetype", repository );
             Wagon wagon = wagonManager.getWagon( wagonRepository );
             File catalog = File.createTempFile( "archetype-catalog", ".xml" );
-            wagon.connect( wagonRepository );
-            wagon.get( "archetype-catalog.xml", catalog );
-            wagon.disconnect();
-            return readCatalog( new FileReader( catalog ) );
+            try
+            {
+                wagon.connect( wagonRepository );
+                wagon.get( "archetype-catalog.xml", catalog );
+            }
+            finally
+            {
+                disconnectWagon( wagon );
+            }
+            return readCatalog( ReaderFactory.newXmlReader( catalog ) );
         }
         catch ( ArchetypeDataSourceException e )
         {
             throw e;
         }
         catch ( Exception e )
-        {// When the default archetype catalog names doesn't works, we assume the repository is the URL to a file 
+        { // When the default archetype catalog names doesn't works, we assume the repository is the URL to a file
             try
             {
-                String repositoryPath = repository.substring(0, repository.lastIndexOf("/"));
-                String fileName = repository.substring(repository.lastIndexOf("/") + 1);
-                
-                getLogger().debug("Searching for remote catalog: "+ repositoryPath +"/"+fileName);
+                String repositoryPath = repository.substring( 0, repository.lastIndexOf( "/" ) );
+                String fileName = repository.substring( repository.lastIndexOf( "/" ) + 1 );
+
+                getLogger().debug( "Searching for remote catalog: " + repositoryPath + "/" + fileName );
                 // We use wagon to take advantage of a Proxy that has already been setup in a Maven environment.
                 Repository wagonRepository = new Repository( "archetype", repositoryPath );
                 Wagon wagon = wagonManager.getWagon( wagonRepository );
                 File catalog = File.createTempFile( "archetype-catalog", ".xml" );
-                wagon.connect( wagonRepository );
-                wagon.get( fileName , catalog );
-                wagon.disconnect();
-                return readCatalog( new FileReader( catalog ) );
+                try
+                {
+                    wagon.connect( wagonRepository );
+                    wagon.get( fileName, catalog );
+                }
+                finally
+                {
+                    disconnectWagon( wagon );
+                }
+                return readCatalog( ReaderFactory.newXmlReader( catalog ) );
             }
             catch ( Exception ex )
             {
-                getLogger().warn( "Error reading archetype catalog "+ repository, ex );
+                getLogger().warn( "Error reading archetype catalog " + repository, ex );
                 return new ArchetypeCatalog();
             }
         }
@@ -112,7 +124,7 @@
         {
             if ( repository.endsWith( "/" ) )
             {
-                repository = repository.substring( 0, repository.length(  ) - 1 );
+                repository = repository.substring( 0, repository.length() - 1 );
             }
 
             // We use wagon to take advantage of a Proxy that has already been setup in a Maven environment.
@@ -129,7 +141,7 @@
 
             wagon.disconnect();
 
-            return createArchetypeMap( readCatalog( new FileReader( catalog ) ) );
+            return createArchetypeMap( readCatalog( ReaderFactory.newXmlReader( catalog ) ) );
         }
         catch ( Exception e )
         {
@@ -142,4 +154,17 @@
     {
         throw new ArchetypeDataSourceException( "Not supported yet." );
     }
+
+    private void disconnectWagon( Wagon wagon )
+    {
+        try
+        {
+            wagon.disconnect();
+        }
+        catch ( Exception e )
+        {
+            getLogger().warn( "Problem disconnecting from wagon - ignoring: " + e.getMessage() );
+        }
+    }
+
 }
diff --git a/archetype-common/src/main/mdo/archetype-catalog.mdo b/archetype-common/src/main/mdo/archetype-catalog.mdo
index 85261c2..66915ee 100644
--- a/archetype-common/src/main/mdo/archetype-catalog.mdo
+++ b/archetype-common/src/main/mdo/archetype-catalog.mdo
@@ -1,138 +1,159 @@
-<?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.

-  -->

-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

-  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">

-  <id>archetype-catalog</id>

-  <name>ArchetypeCatalog</name>

-  <description>

-    These are standard catalog files which contain information about Archetypes so that users

-    can be presented with a list of archetypes from any number of catalogs to generate new

-    projects.

-  </description>

-

-  <defaults>

-    <default>

-      <key>package</key>

-      <value>org.apache.maven.archetype.catalog</value>

-    </default>

-  </defaults>

-

-  <classes>

-    <class rootElement="true" xml.tagName="archetype-catalog">

-      <name>ArchetypeCatalog</name>

-      <fields>

-        <field>

-          <name>archetypes</name>

-          <association>

-            <type>Archetype</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    public String toString ()

-    {

-        return archetypes.toString();

-    }

-          ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class>

-    <class>

-      <name>Archetype</name>

-      <fields>

-        <field>

-          <name>groupId</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>artifactId</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>version</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>repository</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>description</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>goals</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-        <field>

-          <name>properties</name>

-          <description>

-            <![CDATA[

-            Properties that will be used during the execution of addition goals after the creation of the archetype.

-            ]]>

-          </description>

-          <type>Properties</type>

-          <association xml.mapStyle="inline">

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    public String toString ()

-    {

-        return "[" + groupId + ":" + artifactId + ":" + version + (repository != null ? " -> " + repository : "") + "]";

-    }

-    public int hashCode ()

-    {

-        return groupId.hashCode () + 17 * artifactId.hashCode ();

-    }

-    public boolean equals (Object object)

-    {

-        if (object == null || !(object instanceof Archetype) )

-        {

-            return false;

-        }

-        else

-        {

-            Archetype a = (Archetype) object;

-            return org.codehaus.plexus.util.StringUtils.equals( groupId, a.getGroupId () ) &&

-                   org.codehaus.plexus.util.StringUtils.equals( artifactId, a.getArtifactId () );

-        }

-    }

-          ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class>

-  </classes>

-</model>

+<?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.
+  -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd"
+  xml.namespace="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/${version}"
+  xml.schemaLocation="http://maven.apache.org/xsd/archetype-catalog-${version}.xsd">
+  <id>archetype-catalog</id>
+  <name>ArchetypeCatalog</name>
+  <description>
+    <![CDATA[
+    <p>This is a reference for the Archetype Catalog descriptor.</p>
+    <p>These are standard catalog files which contain information about Archetypes so that users
+    can be presented with a list of archetypes from any number of catalogs to generate new
+    projects.</p>
+    <p>The Archetype Plugin knows by default its internal catalog. It also knows
+    about the <code>local</code> and <code>remote</code> catalogs:</p>
+    <ul>
+      <li><code>local</code> represents the <code>~/.m2/archetype-catalog.xml</code> catalog file,</li>
+      <li><code>remote</code> represents the <code>http://repo1.maven.org/maven2/archetype-catalog.xml</code> catalog file.</li>
+    </ul>
+    <p>The Archetype Plugin can also read catalogs from filesystem/HTTP by providing the path/URL of a catalog file or
+    of a directory containing an <code>archetype-catalog.xml</code> file.</p>]]>
+  </description>
+
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.archetype.catalog</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="archetype-catalog">
+      <name>ArchetypeCatalog</name>
+      <fields>
+        <field>
+          <name>archetypes</name>
+          <association>
+            <type>Archetype</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>List of Acthetypes available in this catalog.</description>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <code><![CDATA[
+    public String toString ()
+    {
+        return archetypes.toString();
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+
+    <class>
+      <name>Archetype</name>
+      <description>Informations to point to an Archetype referenced in the catalog.</description>
+      <fields>
+        <field>
+          <name>groupId</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The groupId of the archetype.</description>
+        </field>
+        <field>
+          <name>artifactId</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The artifactId of the archetype.</description>
+        </field>
+        <field>
+          <name>version</name>
+          <type>String</type>
+          <required>true</required>
+          <description><![CDATA[The version of the archetype. <code>RELEASE</code> is a valid version.]]></description>
+        </field>
+        <field>
+          <name>repository</name>
+          <type>String</type>
+          <required>false</required>
+          <description>The repository where to find the archetype.
+           When omitted, the archetype is searched for in the repository where the catalog comes from.</description>
+        </field>
+        <field>
+          <name>description</name>
+          <type>String</type>
+          <required>false</required>
+          <description>The description of the archetype.</description>
+        </field>
+        <field xdoc.separator="blank">
+          <name>goals</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>properties</name>
+          <description>
+            <![CDATA[
+            Properties that will be used during the execution of addition goals after the creation of the archetype.
+            ]]>
+          </description>
+          <type>Properties</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <code><![CDATA[
+    public String toString ()
+    {
+        return "[" + groupId + ":" + artifactId + ":" + version + (repository != null ? " -> " + repository : "") + "]";
+    }
+    public int hashCode ()
+    {
+        return groupId.hashCode () + 17 * artifactId.hashCode ();
+    }
+    public boolean equals (Object object)
+    {
+        if (object == null || !(object instanceof Archetype) )
+        {
+            return false;
+        }
+        else
+        {
+            Archetype a = (Archetype) object;
+            return org.codehaus.plexus.util.StringUtils.equals( groupId, a.getGroupId () ) &&
+                   org.codehaus.plexus.util.StringUtils.equals( artifactId, a.getArtifactId () );
+        }
+    }
+          ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+  </classes>
+</model>
diff --git a/archetype-common/src/main/mdo/archetype-common.mdo b/archetype-common/src/main/mdo/archetype-common.mdo
index 7a7dfde..4a1b781 100644
--- a/archetype-common/src/main/mdo/archetype-common.mdo
+++ b/archetype-common/src/main/mdo/archetype-common.mdo
@@ -1,301 +1,228 @@
-<?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.

-  -->

-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

-  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">

-  <id>archetype-common</id>

-  <name>ArchetypeCommon</name>

-

-  <defaults>

-    <default>

-      <key>package</key>

-      <value>org.apache.maven.archetype.common</value>

-    </default>

-  </defaults>

-

-  <classes>

-

-    <!--class>

-      <name>Archetype</name>

-      <fields>

-        <field>

-          <name>GroupId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>ArtifactId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Version</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Name</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Prefix</name>

-          <type>String</type>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    public boolean equals( Object o )

-    {

-        if ( this == o )

-        {

-            return true;

-        }

-

-        if ( !( o instanceof Archetype ) )

-        {

-            return false;

-        }

-

-        Archetype a = (Archetype) o;

-

-        if ( !a.getArtifactId().equals( getArtifactId() ) )

-        {

-            return false;

-        }

-        else if ( !a.getGroupId().equals( getGroupId() ) )

-        {

-            return false;

-        }

-        /*

-        else if ( !a.getPrefix().equals( getPrefix() ) )

-        {

-            return false;

-        }

-        else if ( !a.getName().equals( getName() ) )

-        {

-            return false;

-        }*/

-        return true;

-    }

-

-    public int hashCode()

-    {

-        int result = 17;

-        result = 37 * result + getArtifactId().hashCode();

-        result = 37 * result + getGroupId().hashCode();

-        return result;

-    }

-                    ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class-->

-

-    <class rootElement="true">

-      <name>ArchetypeDefinition</name>

-      <fields>

-        <field>

-          <name>GroupId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>ArtifactId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Version</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Name</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>repository</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>goals</name>

-          <type>String</type>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    public void reset ()

-    {

-        setGroupId ( null );

-        setArtifactId ( null );

-        setVersion ( null );

-    }

-

-    public boolean isArtifactDefined ()

-    {

-        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () );

-    }

-

-    public boolean isDefined ()

-    {

-        return isPartiallyDefined () && isVersionDefined ();

-    }

-

-    public boolean isGroupDefined ()

-    {

-        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () );

-    }

-

-    public boolean isPartiallyDefined ()

-    {

-        return isGroupDefined () && isArtifactDefined ();

-    }

-

-    public boolean isVersionDefined ()

-    {

-        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () );

-    }

-                    ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class>

-

-    <class>

-      <name>ArchetypeConfiguration</name>

-      <fields>

-        <field>

-          <name>GroupId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>ArtifactId</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Version</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>Name</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>goals</name>

-          <type>String</type>

-        </field>

-        <field>

-          <name>RequiredProperties</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    public void reset ()

-    {

-        properties.clear ();

-    }

-

-    private java.util.Properties properties = new java.util.Properties ();

-

-    public void setProperty ( String requiredProperty, String propertyValue )

-    {

-        properties.setProperty ( requiredProperty, propertyValue );

-    }

-

-    public String getProperty (String property)

-    {

-        return properties.getProperty ( property, null );

-    }

-

-    public java.util.Properties getProperties ()

-    {

-        return properties;

-    }

-

-    public java.util.Properties toProperties ()

-    {

-        java.util.Properties result = new java.util.Properties ();

-        result.putAll ( properties );

-        result.setProperty (

-            Constants.ARCHETYPE_GROUP_ID,

-            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )

-        );

-        result.setProperty (

-            Constants.ARCHETYPE_ARTIFACT_ID,

-            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )

-        );

-        result.setProperty (

-            Constants.ARCHETYPE_VERSION,

-            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )

-        );

-

-        properties.setProperty (

-            Constants.ARCHETYPE_POST_GENERATION_GOALS,

-            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGoals() ) ? getGoals() : "" )

-        );

-

-        return result;

-    }

-

-    public boolean isConfigured ()

-    {

-        boolean configured = true;

-

-        java.util.Iterator requiredProperties = getRequiredProperties().iterator();

-        while ( configured && requiredProperties.hasNext () )

-        {

-            String requiredProperty = (String) requiredProperties.next ();

-

-            configured = configured &&

-                org.codehaus.plexus.util.StringUtils.isNotEmpty(

-                    properties.getProperty ( requiredProperty )

-                );

-        }

-

-        return configured;

-    }

-

-    public boolean isConfigured ( String requiredProperties )

-    {

-        return org.codehaus.plexus.util.StringUtils.isNotEmpty (

-                    properties.getProperty ( requiredProperties )

-                );

-    }

-

-    private java.util.Properties defaultProperties = new java.util.Properties ();

-

-    public void setDefaultProperty ( String requiredProperty, String propertyValue )

-    {

-        defaultProperties.setProperty ( requiredProperty, propertyValue );

-    }

-

-    public String getDefaultValue (String requiredProperty)

-    {

-        return defaultProperties.getProperty ( requiredProperty, null );

-    }

-

-    public java.util.Properties getDefaultValues ()

-    {

-        return defaultProperties;

-    }

-                    ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class>

-  </classes>

-</model>

+<?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.
+  -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+  <id>archetype-common</id>
+  <name>ArchetypeCommon</name>
+
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.archetype.common</value>
+    </default>
+  </defaults>
+
+  <classes>
+
+    <class rootElement="true">
+      <name>ArchetypeDefinition</name>
+      <fields>
+        <field>
+          <name>GroupId</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>ArtifactId</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>Version</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>Name</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>repository</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>goals</name>
+          <type>String</type>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <code><![CDATA[
+    public void reset ()
+    {
+        setGroupId ( null );
+        setArtifactId ( null );
+        setVersion ( null );
+    }
+
+    public boolean isArtifactDefined ()
+    {
+        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () );
+    }
+
+    public boolean isDefined ()
+    {
+        return isPartiallyDefined () && isVersionDefined ();
+    }
+
+    public boolean isGroupDefined ()
+    {
+        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () );
+    }
+
+    public boolean isPartiallyDefined ()
+    {
+        return isGroupDefined () && isArtifactDefined ();
+    }
+
+    public boolean isVersionDefined ()
+    {
+        return org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () );
+    }
+                    ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+
+    <class>
+      <name>ArchetypeConfiguration</name>
+      <fields>
+        <field>
+          <name>GroupId</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>ArtifactId</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>Version</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>Name</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>goals</name>
+          <type>String</type>
+        </field>
+        <field>
+          <name>RequiredProperties</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <code><![CDATA[
+    public void reset ()
+    {
+        properties.clear ();
+    }
+
+    private java.util.Properties properties = new java.util.Properties ();
+
+    public void setProperty ( String requiredProperty, String propertyValue )
+    {
+        properties.setProperty ( requiredProperty, propertyValue );
+    }
+
+    public String getProperty (String property)
+    {
+        return properties.getProperty ( property, null );
+    }
+
+    public java.util.Properties getProperties ()
+    {
+        return properties;
+    }
+
+    public java.util.Properties toProperties ()
+    {
+        java.util.Properties result = new java.util.Properties ();
+        result.putAll ( properties );
+        result.setProperty (
+            Constants.ARCHETYPE_GROUP_ID,
+            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )
+        );
+        result.setProperty (
+            Constants.ARCHETYPE_ARTIFACT_ID,
+            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )
+        );
+        result.setProperty (
+            Constants.ARCHETYPE_VERSION,
+            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )
+        );
+
+        properties.setProperty (
+            Constants.ARCHETYPE_POST_GENERATION_GOALS,
+            (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGoals() ) ? getGoals() : "" )
+        );
+
+        return result;
+    }
+
+    public boolean isConfigured ()
+    {
+        boolean configured = true;
+
+        java.util.Iterator requiredProperties = getRequiredProperties().iterator();
+        while ( configured && requiredProperties.hasNext () )
+        {
+            String requiredProperty = (String) requiredProperties.next ();
+
+            configured = configured &&
+                org.codehaus.plexus.util.StringUtils.isNotEmpty(
+                    properties.getProperty ( requiredProperty )
+                );
+        }
+
+        return configured;
+    }
+
+    public boolean isConfigured ( String requiredProperties )
+    {
+        return org.codehaus.plexus.util.StringUtils.isNotEmpty (
+                    properties.getProperty ( requiredProperties )
+                );
+    }
+
+    private java.util.Properties defaultProperties = new java.util.Properties ();
+
+    public void setDefaultProperty ( String requiredProperty, String propertyValue )
+    {
+        defaultProperties.setProperty ( requiredProperty, propertyValue );
+    }
+
+    public String getDefaultValue (String requiredProperty)
+    {
+        return defaultProperties.getProperty ( requiredProperty, null );
+    }
+
+    public java.util.Properties getDefaultValues ()
+    {
+        return defaultProperties;
+    }
+                    ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+  </classes>
+</model>
diff --git a/archetype-common/src/main/mdo/archetype-descriptor.mdo b/archetype-common/src/main/mdo/archetype-descriptor.mdo
index 9f4f56f..bc4bdc9 100644
--- a/archetype-common/src/main/mdo/archetype-descriptor.mdo
+++ b/archetype-common/src/main/mdo/archetype-descriptor.mdo
@@ -1,183 +1,209 @@
-<?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.

-  -->

-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

-  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">

-  <id>archetype-descriptor</id>

-  <name>ArchetypeDescriptor</name>

-

-  <defaults>

-    <default>

-      <key>package</key>

-      <value>org.apache.maven.archetype.metadata</value>

-    </default>

-  </defaults>

-  <classes>

-    <class rootElement="true" xml.tagName="archetype-descriptor">

-      <name>ArchetypeDescriptor</name>

-      <superClass>AbstractArchetypeDescriptor</superClass>

-      <fields>

-        <field xml.attribute="true">

-          <name>name</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field xml.attribute="true">

-          <name>partial</name>

-          <type>boolean</type>

-          <required>false</required>

-        </field>

-        <field>

-          <name>requiredProperties</name>

-          <association>

-            <type>RequiredProperty</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-      </fields>

-    </class>

-

-    <class>

-      <name>ModuleDescriptor</name>

-      <superClass>AbstractArchetypeDescriptor</superClass>

-      <fields>

-        <field xml.attribute="true">

-          <name>id</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field xml.attribute="true">

-          <name>dir</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field xml.attribute="true">

-          <name>name</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-      </fields>

-    </class>

-

-    <class>

-      <name>AbstractArchetypeDescriptor</name>

-      <fields>

-        <field>

-          <name>fileSets</name>

-          <association>

-            <type>FileSet</type>

-            <multiplicity>*</multiplicity>

-          </association>

-          <required>true</required>

-        </field>

-        <field>

-          <name>modules</name>

-          <association>

-            <type>ModuleDescriptor</type>

-            <multiplicity>*</multiplicity>

-          </association>

-          <required>false</required>

-        </field>

-      </fields>

-    </class>

-

-    <class>

-      <name>FileSet</name>

-      <fields>

-        <field xml.attribute="true">

-          <name>filtered</name>

-          <type>boolean</type>

-          <required>false</required>

-        </field>

-        <field xml.attribute="true">

-          <name>packaged</name>

-          <type>boolean</type>

-          <required>false</required>

-        </field>

-        <field xml.attribute="true">

-          <name>encoding</name>

-          <type>String</type>

-          <required>false</required>

-        </field>

-        <field>

-          <name>directory</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>includes</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-          <required>false</required>

-        </field>

-        <field>

-          <name>excludes</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-          <required>false</required>

-        </field>

-      </fields>

-      <codeSegments>

-        <codeSegment>

-          <code><![CDATA[

-    {

-        filtered = true;

-        packaged = true;

-    }

-

-    public String toString ()

-    {

-        return

-            getDirectory () + " (" +

-                (isFiltered () ? "Filtered" : "Copied") +

-                "-" +

-                (isPackaged () ? "Packaged" : "Flat") +

-            ") [" +

-                org.codehaus.plexus.util.StringUtils.join ( getIncludes ().iterator (), ", " ) +

-                " -- " +

-                org.codehaus.plexus.util.StringUtils.join ( getExcludes ().iterator (), ", " ) +

-            "]";

-

-    }

-                    ]]></code>

-        </codeSegment>

-      </codeSegments>

-    </class>

-

-    <class>

-      <name>RequiredProperty</name>

-      <fields>

-        <field xml.attribute="true">

-          <name>key</name>

-          <type>String</type>

-          <required>true</required>

-        </field>

-        <field>

-          <name>defaultValue</name>

-          <type>String</type>

-          <required>false</required>

-        </field>

-      </fields>

-    </class>

-  </classes>

-</model>

+<?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.
+  -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd"
+  xml.namespace="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/${version}"
+  xml.schemaLocation="http://maven.apache.org/xsd/archetype-descriptor-${version}.xsd">
+  <id>archetype-descriptor</id>
+  <name>ArchetypeDescriptor</name>
+  <description>
+    <![CDATA[
+    <p>This is a reference for the Archetype descriptor used to describe archetypes's metadata.</p>
+    <p>The metadata about an archetype is stored in the <code>archetype-metadata.xml</code> file located
+    in the <code>META-INF/maven</code> directory of its jar file.</p>]]>
+  </description>
+
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.archetype.metadata</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="archetype-descriptor">
+      <name>ArchetypeDescriptor</name>
+      <superClass>AbstractArchetypeDescriptor</superClass>
+      <fields>
+        <field xml.attribute="true">
+          <name>name</name>
+          <type>String</type>
+          <required>true</required>
+          <description>Name of the Archetype, that will be displayed to the user when choosing an archetype.</description>
+        </field>
+        <field xml.attribute="true">
+          <name>partial</name>
+          <type>boolean</type>
+          <required>false</required>
+          <description>Is this archetype representing a full Maven 2 project or only parts?</description>
+        </field>
+        <field>
+          <name>requiredProperties</name>
+          <description>List of required properties to generate a project from this archetype.</description>
+          <association>
+            <type>RequiredProperty</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+
+    <class>
+      <name>ModuleDescriptor</name>
+      <superClass>AbstractArchetypeDescriptor</superClass>
+      <fields>
+        <field xml.attribute="true">
+          <name>id</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The module's artifactId.</description>
+        </field>
+        <field xml.attribute="true">
+          <name>dir</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The module's directory.</description>
+        </field>
+        <field xml.attribute="true">
+          <name>name</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The module's name.</description>
+        </field>
+      </fields>
+    </class>
+
+    <class>
+      <name>AbstractArchetypeDescriptor</name>
+      <fields>
+        <field>
+          <name>fileSets</name>
+          <association>
+            <type>FileSet</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <required>true</required>
+          <description>File sets definition.</description>
+        </field>
+        <field xdoc.separator="blank">
+          <name>modules</name>
+          <association>
+            <type>ModuleDescriptor</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <required>false</required>
+          <description>Modules definition.</description>
+        </field>
+      </fields>
+    </class>
+
+    <class>
+      <name>FileSet</name>
+      <description>A fileset defines the way the project's files located in the jar file are used by the Archetype Plugin to generate a project.</description>
+      <fields>
+        <field xml.attribute="true">
+          <name>filtered</name>
+          <type>boolean</type>
+          <required>false</required>
+          <description>Filesets can be filtered, which means the selected files will be used as Velocity templates.
+          They can be non-filtered, which means the selected files will be copied without modification.</description>
+        </field>
+        <field xml.attribute="true">
+          <name>packaged</name>
+          <type>boolean</type>
+          <required>false</required>
+          <description>Filesets can be packaged, which means the selected files will be generated/copied in a directory
+           structure that is prepended by the package property. They can be non-packaged, which means that the selected
+           files will be generated/copied without that prepend.</description>
+        </field>
+        <field xml.attribute="true">
+          <name>encoding</name>
+          <type>String</type>
+          <required>false</required>
+          <description>Encoding to use when filtering content.</description>
+        </field>
+        <field>
+          <name>directory</name>
+          <type>String</type>
+          <required>true</required>
+          <description>The directory where the files will be searched for, which is also the directory where the
+           project's files will be generated.</description>
+        </field>
+        <field>
+          <name>includes</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <required>false</required>
+          <description>Inclusion definition "à la" Ant.</description>
+        </field>
+        <field>
+          <name>excludes</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <required>false</required>
+          <description>Exclusion definition "à la" Ant.</description>
+        </field>
+      </fields>
+      <codeSegments>
+        <codeSegment>
+          <code><![CDATA[
+    public String toString ()
+    {
+        return
+            getDirectory () + " (" +
+                (isFiltered () ? "Filtered" : "Copied") +
+                "-" +
+                (isPackaged () ? "Packaged" : "Flat") +
+            ") [" +
+                org.codehaus.plexus.util.StringUtils.join ( getIncludes ().iterator (), ", " ) +
+                " -- " +
+                org.codehaus.plexus.util.StringUtils.join ( getExcludes ().iterator (), ", " ) +
+            "]";
+
+    }
+                    ]]></code>
+        </codeSegment>
+      </codeSegments>
+    </class>
+
+    <class>
+      <name>RequiredProperty</name>
+      <description>Definition of a property required when generating a project from this archetype.</description>
+      <fields>
+        <field xml.attribute="true">
+          <name>key</name>
+          <type>String</type>
+          <required>true</required>
+          <description>Key value of the property.</description>
+        </field>
+        <field>
+          <name>defaultValue</name>
+          <type>String</type>
+          <required>false</required>
+          <description>Default value of the property.</description>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>
diff --git a/archetype-common/src/main/mdo/archetype-registry.mdo b/archetype-common/src/main/mdo/archetype-registry.mdo
index dbd8ad8..9deceb6 100644
--- a/archetype-common/src/main/mdo/archetype-registry.mdo
+++ b/archetype-common/src/main/mdo/archetype-registry.mdo
@@ -1,53 +1,60 @@
-<?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.

-  -->

-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

-  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">

-  <id>archetype-registry</id>

-  <name>ArchetypeRegistry</name>

-

-  <defaults>

-    <default>

-      <key>package</key>

-      <value>org.apache.maven.archetype.registry</value>

-    </default>

-  </defaults>

-

-  <classes>

-    <class rootElement="true" xml.tagName="archetype-registry">

-      <name>ArchetypeRegistry</name>

-      <fields>

-        <field>

-          <name>Languages</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-        <field>

-          <name>FilteredExtensions</name>

-          <association>

-            <type>String</type>

-            <multiplicity>*</multiplicity>

-          </association>

-        </field>

-      </fields>

-    </class>

-  </classes>

-</model>

+<?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.
+  -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd"
+  xml.namespace="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-registry/${version}"
+  xml.schemaLocation="http://maven.apache.org/xsd/archetype-registry-${version}.xsd">
+  <id>archetype-registry</id>
+  <name>ArchetypeRegistry</name>
+  <description>
+    <![CDATA[
+    <p>This is a reference for the Archetype Registry descriptor.</p>
+    <p>The registry is stored in <code>~/.m2/archetype.xml</code> file.</p>]]>
+  </description>
+
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.archetype.registry</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="archetype-registry">
+      <name>ArchetypeRegistry</name>
+      <fields>
+        <field>
+          <name>Languages</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>FilteredExtensions</name>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>
diff --git a/archetype-common/src/main/mdo/archetype.mdo b/archetype-common/src/main/mdo/archetype.mdo
index 149026c..9b481e5 100644
--- a/archetype-common/src/main/mdo/archetype.mdo
+++ b/archetype-common/src/main/mdo/archetype.mdo
@@ -3,16 +3,24 @@
  <!-- START SNIPPET: modello-model -->
 
 <model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd"
+  xml.namespace="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/${version}"
+  xml.schemaLocation="http://maven.apache.org/xsd/archetype-${version}.xsd">
   <id>archetype</id>
   <name>Archetype</name>
-  <description><![CDATA[Maven's model for the archetype descriptor.]]></description>
+  <description>
+    <![CDATA[Maven's model for the old archetype descriptor (ie for Archetype 1.0.x).
+    <p>The metadata about an archetype is stored in the <code>archetype.xml</code> file located
+    in the <code>META-INF/maven</code> directory of its jar file.</p>]]>
+  </description>
+
   <defaults>
     <default>
       <key>package</key>
       <value>org.apache.maven.archetype.model</value>
     </default>
   </defaults>
+
   <classes>
     <class rootElement="true" xml.tagName="archetype">
       <name>ArchetypeModel</name>
@@ -24,55 +32,103 @@
           <version>1.0.0</version>
           <required>true</required>
           <type>String</type>
+          <description><![CDATA[The value should be the same as the artifactId in the archetype <code>pom.xml</code>.]]></description>
         </field>
         <field>
           <name>allowPartial</name>
           <version>1.0.0</version>
-          <required>true</required>
           <type>boolean</type>
+          <description><![CDATA[Setting this option to <code>true</code> makes it possible to run the
+            <code>archetype:create</code> even on existing projects.]]></description>
         </field>
-        <field>
+
+        <field xdoc.separator="blank">
           <name>sources</name>
           <version>1.0.0</version>
+          <description><![CDATA[Files that will go into <code>src/main/java</code>.]]></description>
           <association>
-            <type>String</type>
+            <type>Source</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
         <field>
           <name>resources</name>
           <version>1.0.0</version>
+          <description><![CDATA[Files that will go into <code>src/main/resources</code>.]]></description>
           <association>
-            <type>String</type>
+            <type>Resource</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
-        <field>
+
+        <field xdoc.separator="blank">
           <name>testSources</name>
           <version>1.0.0</version>
-          <association>
-            <type>String</type>
+          <description><![CDATA[Files that will go into <code>src/test/java</code>.]]></description>
+          <association xml.tagName="source">
+            <type>Source</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
         <field>
           <name>testResources</name>
           <version>1.0.0</version>
-          <association>
-            <type>String</type>
+          <description><![CDATA[Files that will go into <code>src/test/resources</code>.]]></description>
+          <association xml.tagName="resource">
+            <type>Resource</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
-        <field>
+
+        <field xdoc.separator="blank">
           <name>siteResources</name>
           <version>1.0.0</version>
-          <association>
-            <type>String</type>
+          <description><![CDATA[Files that will go into <code>src/site</code>.]]></description>
+          <association xml.tagName="resource">
+            <type>Resource</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
       </fields>
     </class>
+
+    <class>
+      <name>Source</name>
+      <description>Describes a source file. Note that source files are always filtered, unlike resources that
+        can be non-filtered.</description>
+      <version>1.0.0</version>
+      <fields>
+        <field xml.attribute="true">
+          <name>encoding</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description><![CDATA[The encoding to be used when reading/writing this file.
+            Platform encoding is used by default, or ISO-8859-1 when filename ends in <code>.properties</code>]]></description>
+        </field>
+      </fields>
+    </class>
+    <class>
+      <name>Resource</name>
+      <description>Describes a resource file.</description>
+      <version>1.0.0</version>
+      <fields>
+        <field xml.attribute="true">
+          <name>encoding</name>
+          <version>1.0.0</version>
+          <type>String</type>
+          <description><![CDATA[The encoding to be used when reading/writing this file.
+            Platform encoding is used by default, or ISO-8859-1 when filename ends in <code>.properties</code>]]></description>
+        </field>
+        <field xml.attribute="true">
+          <name>filtered</name>
+          <version>1.0.0</version>
+          <type>boolean</type>
+          <defaultValue>true</defaultValue>
+          <description>A resource can be filtered, which means the file will be used as Velocity template.
+          It can be non-filtered, which means the file will be copied without modification.</description>
+        </field>
+      </fields>
+    </class>
   </classes>
 </model>
 
diff --git a/archetype-common/src/main/resources/archetype-catalog.xml b/archetype-common/src/main/resources/archetype-catalog.xml
index 3979ae7..16d8305 100644
--- a/archetype-common/src/main/resources/archetype-catalog.xml
+++ b/archetype-common/src/main/resources/archetype-catalog.xml
@@ -1,61 +1,69 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<archetype-catalog>
+<archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
+    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <archetypes>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-basic-jsf</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a web application with Hibernate, Spring and JSF</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-basic-spring</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-basic-struts</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-basic-tapestry</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-core</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a jar application with Hibernate and Spring and XFire</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-modular-jsf</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a modular application with Hibernate, Spring and JSF</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-modular-spring</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-modular-struts</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2</description>
     </archetype>
     <archetype>
       <groupId>org.appfuse.archetypes</groupId>
       <artifactId>appfuse-modular-tapestry</artifactId>
-      <version>RELEASE</version>
+      <version>2.0</version>
       <description>AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4</description>
     </archetype>
     <archetype>
+      <groupId>org.makumba</groupId>
+      <artifactId>makumba-archetype</artifactId>
+      <version>RELEASE</version>
+      <description>Archetype for a simple Makumba application</description>
+    </archetype>
+    <archetype>
       <groupId>org.apache.maven.archetypes</groupId>
       <artifactId>maven-archetype-j2ee-simple</artifactId>
       <version>RELEASE</version>
@@ -110,6 +118,12 @@
       <description>A simple Java web application</description>
     </archetype>
     <archetype>
+      <groupId>net.databinder</groupId>
+      <artifactId>data-app</artifactId>
+      <version>1.0</version>
+      <description>A new Databinder application with sources and resources.</description>
+    </archetype>
+    <archetype>
       <groupId>org.apache.camel.archetypes</groupId>
       <artifactId>camel-archetype-component</artifactId>
       <version>RELEASE</version>
@@ -140,12 +154,24 @@
       <description>Creates a new Camel project with added Spring DSL support</description>
     </archetype>
     <archetype>
+      <groupId>org.apache.camel.archetypes</groupId>
+      <artifactId>camel-archetype-war</artifactId>
+      <version>RELEASE</version>
+      <description>Creates a new Camel project that deploys the Camel Web Console, REST API, and your routes as a WAR</description>
+    </archetype>
+    <archetype>
       <groupId>org.jini.maven-jini-plugin</groupId>
       <artifactId>jini-service-archetype</artifactId>
       <version>2.0</version>
       <description>Archetype for Jini service project creation</description>
     </archetype>
     <archetype>
+      <groupId>de.akquinet.jbosscc</groupId>
+      <artifactId>jbosscc-seam-archetype</artifactId>
+      <version>RELEASE</version>
+      <description>Maven Archetype to generate a Seam Application- Documentation</description>
+    </archetype>
+    <archetype>
       <groupId>org.apache.maven.archetypes</groupId>
       <artifactId>softeu-archetype-seam</artifactId>
       <version>RELEASE</version>
@@ -176,17 +202,31 @@
     <archetype>
       <groupId>org.springframework.osgi</groupId>
       <artifactId>spring-osgi-bundle-archetype</artifactId>
-      <version>1.0.2</version>
+      <version>RELEASE</version>
       <description>Spring-OSGi archetype</description>
     </archetype>
     <archetype>
       <groupId>com.atlassian.maven.archetypes</groupId>
+      <artifactId>bamboo-plugin-archetype</artifactId>
+      <version>3.0.1</version>
+      <repository>https://maven.atlassian.com/public</repository>
+      <description>Atlassian Bamboo plugin archetype</description>
+    </archetype>
+    <archetype>
+      <groupId>com.atlassian.maven.archetypes</groupId>
       <artifactId>confluence-plugin-archetype</artifactId>
       <version>RELEASE</version>
       <repository>https://maven.atlassian.com/public</repository>
       <description>Atlassian Confluence plugin archetype</description>
     </archetype>
     <archetype>
+      <groupId>com.atlassian.maven.archetypes</groupId>
+      <artifactId>jira-plugin-archetype</artifactId>
+      <version>3.0.6</version>
+      <repository>https://maven.atlassian.com/public</repository>
+      <description>Atlassian JIRA plugin archetype</description>
+    </archetype>
+    <archetype>
       <groupId>net.sf.maven-har</groupId>
       <artifactId>maven-archetype-har</artifactId>
       <version>0.9</version>
@@ -205,6 +245,12 @@
       <description>A simple Apache Wicket project</description>
     </archetype>
     <archetype>
+      <groupId>org.apache.tapestry</groupId>
+      <artifactId>quickstart</artifactId>
+      <version>RELEASE</version>
+      <description>A simple Apache Tapestry 5 Project</description>
+    </archetype>
+    <archetype>
       <groupId>org.scala-tools.archetypes</groupId>
       <artifactId>scala-archetype-simple</artifactId>
       <version>1.2</version>
@@ -229,19 +275,19 @@
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-22-archetype-block-plain</artifactId>
       <version>RELEASE</version>
-      <description>[http://cocoon.apache.org/2.2/maven-plugins/]</description>
+      <description>http://cocoon.apache.org/2.2/maven-plugins/</description>
     </archetype>
     <archetype>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-22-archetype-block</artifactId>
       <version>RELEASE</version>
-      <description>[http://cocoon.apache.org/2.2/maven-plugins/]</description>
+      <description>http://cocoon.apache.org/2.2/maven-plugins/</description>
     </archetype>
     <archetype>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-22-archetype-webapp</artifactId>
       <version>RELEASE</version>
-      <description>[http://cocoon.apache.org/2.2/maven-plugins/]</description>
+      <description>http://cocoon.apache.org/2.2/maven-plugins/</description>
     </archetype>
     <archetype>
       <groupId>org.apache.myfaces.buildtools</groupId>
@@ -268,13 +314,13 @@
       <description>A simple archetype for create custom JSF components using MyFaces</description>
     </archetype>
     <archetype>
-      <groupId>org.codehaus.groovy.maven.archetypes</groupId>
+      <groupId>org.codehaus.gmaven.archetypes</groupId>
       <artifactId>gmaven-archetype-basic</artifactId>
       <version>RELEASE</version>
       <description>Groovy basic archetype</description>
     </archetype>
     <archetype>
-      <groupId>org.codehaus.groovy.maven.archetypes</groupId>
+      <groupId>org.codehaus.gmaven.archetypes</groupId>
       <artifactId>gmaven-archetype-mojo</artifactId>
       <version>RELEASE</version>
       <description>Groovy mojo archetype</description>
@@ -285,5 +331,37 @@
       <version>RELEASE</version>
       <description>Struts 2 Starter Archetype</description>
     </archetype>
+    <archetype>
+      <groupId>org.tynamo</groupId>
+      <artifactId>tynamo-archetype</artifactId>
+      <version>RELEASE</version>
+      <description>Creates a CRUD web application based on Tapestry 5 and Tynamo, a model-driven Java web framework</description>
+    </archetype>
+    <archetype>
+      <groupId>tellurium</groupId>
+      <artifactId>tellurium-junit-archetype</artifactId>
+      <version>RELEASE</version>
+      <repository>http://maven.kungfuters.org/content/repositories/releases</repository>
+      <description>Tellurium JUnit project archetype for the Tellurium Automated Testing Framework</description>
+    </archetype>
+    <archetype>
+      <groupId>tellurium</groupId>
+      <artifactId>tellurium-testng-archetype</artifactId>
+      <version>RELEASE</version>
+      <repository>http://maven.kungfuters.org/content/repositories/releases</repository>
+      <description>Tellurium TestNG project archetype for the Tellurium Automated Testing Framework</description>
+    </archetype>
+    <archetype>
+      <groupId>org.fusesource.scalate.tooling</groupId>
+      <artifactId>scalate-archetype-empty</artifactId>
+      <version>RELEASE</version>
+      <description>Generates a Scalate empty web application</description>
+    </archetype>
+    <archetype>
+      <groupId>org.fusesource.scalate.tooling</groupId>
+      <artifactId>scalate-archetype-guice</artifactId>
+      <version>RELEASE</version>
+      <description>Generates a Scalate Jog web application</description>
+    </archetype>
   </archetypes>
 </archetype-catalog>
diff --git a/archetype-common/src/main/resources/org/apache/maven/archetype/creator/archetype.properties b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/archetype-common/src/main/resources/org/apache/maven/archetype/creator/goal.txt b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/goal.txt
diff --git a/archetype-common/src/main/resources/org/apache/maven/archetype/creator/pom-prototype.xml b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/pom-prototype.xml
new file mode 100644
index 0000000..56dbdc8
--- /dev/null
+++ b/archetype-common/src/main/resources/org/apache/maven/archetype/creator/pom-prototype.xml
@@ -0,0 +1,22 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId></groupId>
+  <artifactId></artifactId>
+  <version></version>
+  <packaging>maven-archetype</packaging>
+
+  <name></name>
+
+  <build>
+    <extensions>
+    </extensions>
+
+    <pluginManagement>
+      <plugins>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
\ No newline at end of file
diff --git a/archetype-common/src/site/apt/internal.apt b/archetype-common/src/site/apt/internal.apt
new file mode 100644
index 0000000..18d5a59
--- /dev/null
+++ b/archetype-common/src/site/apt/internal.apt
@@ -0,0 +1,46 @@
+ ------
+ Maven Archetype Internal Catalog
+ ------
+ Hervé Boutemy
+ ------
+ 2010-04-06
+ ------
+
+~~ 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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+
+Maven Archetype Internal Catalog
+
+ The Archetype Plugin comes bundled with an internal catalog.
+
+* Updating the Internal Catalog
+
+ The source for internal catalog is hosted in the {{{http://docs.codehaus.org/display/MAVENUSER/Archetypes+List}Archetype List}}
+ page of the Maven User Wiki.
+
+ This page is transformed to a catalog XML file using following command in <<<archetype-common>>> module directory:
+
+----
+mvn -P internal-catalog test
+----
+
+ Then merge <<<target/archetype-catalog.xml>>> with
+ {{{http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/resources/archetype-catalog.xml?view=markup}<<<src/main/resources/archetype-catalog.xml>>>}}.
diff --git a/archetype-common/src/site/site.xml b/archetype-common/src/site/site.xml
new file mode 100644
index 0000000..6b11858
--- /dev/null
+++ b/archetype-common/src/site/site.xml
@@ -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.
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu name="Documentation">
+      <item name="Internal Catalog" href="./internal.html"/>
+    </menu>
+    <menu name="Reference">
+      <item name="Archetype Descriptor" href="./archetype-descriptor.html"/>
+      <item name="Archetype Catalog" href="./archetype-catalog.html"/>
+      <item name="Archetype Registry" href="./archetype-registry.html"/>
+      <item name="Archetype 1.0.x Descriptor" href="./archetype.html"/>
+    </menu>
+    <menu ref="parent" inherit="top" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml
index 5ecfa42..bb055cf 100644
--- a/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml
+++ b/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
@@ -31,4 +31,13 @@
   <name>Maven archetype Test</name>
   <packaging>jar</packaging>
 
+  <properties>
+    <empty></empty>
+  </properties>
+
+  <!-- comment in prototype pom -->
+  <dependencies>
+    <!-- empty dependencies, with comments -->
+  </dependencies>
+
 </project>
\ No newline at end of file
diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml
index 717639a..33d6dcf 100644
--- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml
+++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml
index 4e9e87b..3ae5c9a 100644
--- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml
+++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml
index 8747668..4c2bc23 100644
--- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml
+++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml
index f17b333..e13e2cd 100644
--- a/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml
+++ b/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
@@ -31,4 +31,9 @@
   <name>Maven archetype Test Old archetype</name>
   <packaging>jar</packaging>
 
+  <!-- comment in prototype pom -->
+  <dependencies>
+    <!-- empty dependencies, with comments -->
+  </dependencies>
+
 </project>
\ No newline at end of file
diff --git a/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
index 03718f0..ce15f3e 100644
--- a/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
+++ b/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/archetypes/site-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/site-1.0/archetype-resources/pom.xml
index 0f4bb59..b3d58bc 100644
--- a/archetype-common/src/test/archetypes/site-1.0/archetype-resources/pom.xml
+++ b/archetype-common/src/test/archetypes/site-1.0/archetype-resources/pom.xml
@@ -20,7 +20,7 @@
 <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">
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
index f56e675..0669c28 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
@@ -19,10 +19,10 @@
 
 import java.io.File;
 import java.io.FileWriter;
-import java.io.IOException;
 import java.io.Writer;
 import java.net.URL;
 import org.apache.commons.io.IOUtils;
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.codehaus.cargo.container.deployable.DeployableType;
@@ -48,39 +48,31 @@
         throws Exception
     {
 
-        Archetype archetype = (Archetype) lookup( Archetype.class.getName() );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.class.getName() );
 
         ArchetypeCatalog result = archetype.getRemoteCatalog( "http://localhost:18881/repo/" );
 
         assertEquals( 1, result.getArchetypes().size() );
-        assertEquals( "groupId", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getGroupId() );
-        assertEquals( "artifactId", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getArtifactId() );
-        assertEquals( "1", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getVersion() );
-        assertEquals( "http://localhost:18881/repo/", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getRepository() );
+        assertEquals( "groupId", ( (Archetype) result.getArchetypes().get( 0 ) ).getGroupId() );
+        assertEquals( "artifactId", ( (Archetype) result.getArchetypes().get( 0 ) ).getArtifactId() );
+        assertEquals( "1", ( (Archetype) result.getArchetypes().get( 0 ) ).getVersion() );
+        assertEquals( "http://localhost:18881/repo/", ( (Archetype) result.getArchetypes().get( 0 ) ).getRepository() );
     }
 
     public void testLocalCatalog()
         throws Exception
     {
 
-        Archetype archetype = (Archetype) lookup( Archetype.class.getName() );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.class.getName() );
 
         ArchetypeCatalog result = archetype.getLocalCatalog( getTestFile( "target/test-classes/repositories/test-catalog" ).
             getAbsolutePath() );
 
         assertEquals( 1, result.getArchetypes().size() );
-        assertEquals( "groupId", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getGroupId() );
-        assertEquals( "artifactId", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getArtifactId() );
-        assertEquals( "1", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getVersion() );
-        assertEquals( "http://localhost:18881/repo/", ((org.apache.maven.archetype.catalog.Archetype) result.getArchetypes().
-            get( 0 )).getRepository() );
+        assertEquals( "groupId", ( (Archetype) result.getArchetypes().get( 0 ) ).getGroupId() );
+        assertEquals( "artifactId", ( (Archetype) result.getArchetypes().get( 0 ) ).getArtifactId() );
+        assertEquals( "1", ( (Archetype) result.getArchetypes().get( 0 ) ).getVersion() );
+        assertEquals( "http://localhost:18881/repo/", ( (Archetype) result.getArchetypes().get( 0 ) ).getRepository() );
     }
 
     private Jetty6xEmbeddedLocalContainer cargo;
@@ -97,7 +89,7 @@
         getTestFile( "target/test-classes/repositories/test-catalog/dummy" ).createNewFile();
 
         ArchetypeCatalog catalog = new ArchetypeCatalog();
-        org.apache.maven.archetype.catalog.Archetype generatedArchetype = new org.apache.maven.archetype.catalog.Archetype();
+        Archetype generatedArchetype = new Archetype();
         generatedArchetype.setGroupId( "groupId" );
         generatedArchetype.setArtifactId( "artifactId" );
         generatedArchetype.setVersion( "1" );
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java b/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java
new file mode 100644
index 0000000..2019d3a
--- /dev/null
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java
@@ -0,0 +1,71 @@
+/*
+ * 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.common;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.archetype.metadata.FileSet;
+
+public class TestDefaultArchetypeFilesResolver
+    extends TestCase
+{
+    public void testResourceFiltering()
+        throws Exception
+    {
+        FileSet fileSet = new FileSet();
+
+        fileSet.addInclude( "**/*.java" );
+
+        fileSet.setDirectory( "src/main/java" );
+        fileSet.setEncoding( "UTF-8" );
+        fileSet.setPackaged( true );
+        fileSet.setFiltered( true );
+
+        List archetypeResources = new ArrayList();
+
+        archetypeResources.add( "pom.xml" );
+        archetypeResources.add( "App.java" );
+        archetypeResources.add( "src/main/c/App.c" );
+        archetypeResources.add( "src/main/java/App.java" );
+        archetypeResources.add( "src/main/java/inner/package/App2.java" );
+        archetypeResources.add( "src/main/mdo/App.mdo" );
+        archetypeResources.add( "src/main/resources/App.properties" );
+        archetypeResources.add( "src/main/resources/inner/dir/App2.properties" );
+        archetypeResources.add( "src/test/c/AppTest.c" );
+        archetypeResources.add( "src/test/java/AppTest.java" );
+        archetypeResources.add( "src/test/mdo/AppTest.mdo" );
+        archetypeResources.add( "src/test/resources/AppTest.properties" );
+
+        System.out.println( "FileSet:" + fileSet );
+        System.out.println( "Resources:" + archetypeResources );
+
+        ArchetypeFilesResolver resolver = new DefaultArchetypeFilesResolver();
+
+        List fileSetResources = resolver.filterFiles( "", fileSet, archetypeResources );
+
+        System.out.println( "Result:" + fileSetResources );
+
+        assertEquals( 2, fileSetResources.size() );
+    }
+
+}
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
index 6c23455..c0ea9a1 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.creator;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.creator;
-
 import org.apache.maven.archetype.ArchetypeCreationRequest;
 import org.apache.maven.archetype.ArchetypeCreationResult;
 import org.apache.maven.archetype.common.Constants;
@@ -28,6 +28,7 @@
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.MavenProjectBuildingResult;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.PropertyUtils;
@@ -42,7 +43,6 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import org.apache.maven.project.MavenProjectBuildingResult;
 
 public class DefaultArchetypeCreatorTest
     extends AbstractMojoTestCase
@@ -55,8 +55,7 @@
     private List repositories;
 
     public void testCreateFilesetArchetype()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testCreateFilesetArchetype" );
 
@@ -86,24 +85,25 @@
         {
             Object result = builder.buildWithDependencies( projectFile, localRepository, null );
             if ( result instanceof MavenProject )
-            {// Using maven 2.0.x / x >= 7
+            { // Using Maven 2.0.x / x >= 7
                 mavenProject = (MavenProject) result;
             }
             else if ( result instanceof MavenProjectBuildingResult )
-            {// Using maven 2.1
-                mavenProject = ((MavenProjectBuildingResult) result).getProject();
+            { // Using Maven 3
+                mavenProject = ( (MavenProjectBuildingResult) result ).getProject();
             }
             else
             {
                 fail( "Wrong result class" );
             }
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             e.printStackTrace();
         }
 
-        FilesetArchetypeCreator instance = (FilesetArchetypeCreator) lookup( ArchetypeCreator.class.getName(), "fileset" );
+        FilesetArchetypeCreator instance =
+            (FilesetArchetypeCreator) lookup( ArchetypeCreator.class.getName(), "fileset" );
 
         languages = new ArrayList();
         languages.add( "java" );
@@ -140,16 +140,16 @@
             .setPartialArchetype( false )
             .setPreserveCData( false )
             .setKeepParent( false )
-            .setPostPhase( "package" );
+            .setPostPhase( "verify" );
 
         ArchetypeCreationResult result = new ArchetypeCreationResult();
 
         instance.createArchetype( request, result );
-        
-        if(result.getCause()!=null){
-            result.getCause().printStackTrace();
+
+        if ( result.getCause() != null )
+        {
+            throw result.getCause();
         }
-        assertNull( result.getCause() );
 
         File template;
 
@@ -322,45 +322,34 @@
     }
 
     protected void tearDown()
-        throws
-        Exception
+        throws Exception
     {
         super.tearDown();
     }
 
     protected void setUp()
-        throws
-        Exception
+        throws Exception
     {
         super.setUp();
 
-        localRepository =
-            new DefaultArtifactRepository(
-                "local",
-                new File( getBasedir(), "target/test-classes/repositories/local" ).toURI()
-                    .toString(),
-                new DefaultRepositoryLayout()
-            );
+        localRepository = new DefaultArtifactRepository( "local",
+           new File( getBasedir(), "target/test-classes/repositories/local" ).toURI().toString(),
+           new DefaultRepositoryLayout() );
 
         repositories =
             Arrays.asList(
                 new ArtifactRepository[]
                     {
-                        new DefaultArtifactRepository(
-                            "central",
-                            new File( getBasedir(), "target/test-classes/repositories/central" )
-                                .toURI().toString(),
+                        new DefaultArtifactRepository( "central",
+                            new File( getBasedir(), "target/test-classes/repositories/central" ).toURI().toString(),
                             new DefaultRepositoryLayout()
                         )
                     }
             );
     }
 
-    private boolean assertContent( File template,
-                                   String content )
-        throws
-        FileNotFoundException,
-        IOException
+    private boolean assertContent( File template, String content )
+        throws FileNotFoundException, IOException
     {
         String templateContent = IOUtil.toString( new FileReader( template ) );
         return StringUtils.countMatches( templateContent, content ) > 0;
@@ -371,20 +360,14 @@
         assertTrue( "File doesn't exist:" + file.getAbsolutePath(), file.exists() );
     }
 
-    private boolean assertNotContent( File template,
-                                      String content )
-        throws
-        FileNotFoundException,
-        IOException
+    private boolean assertNotContent( File template, String content )
+        throws FileNotFoundException, IOException
     {
         return !assertContent( template, content );
     }
 
-    private void copy( File in,
-                       File out )
-        throws
-        IOException,
-        FileNotFoundException
+    private void copy( File in, File out )
+        throws IOException, FileNotFoundException
     {
         assertTrue( !out.exists() || out.delete() );
         assertFalse( out.exists() );
@@ -404,14 +387,12 @@
             );
     }
 
-    private String getPath( String basedir,
-                            String child )
+    private String getPath( String basedir, String child )
     {
         return new File( basedir, child ).getPath();
     }
 
-    private File getFile( String project,
-                          String file )
+    private File getFile( String project, String file )
     {
         return new File( getBasedir(), "target/test-classes/projects/" + project + "/" + file );
     }
@@ -449,8 +430,7 @@
         return propertyFileSample;
     }
 
-    private File getTemplateFile( String project,
-                                  String template )
+    private File getTemplateFile( String project, String template )
     {
         return
             new File(
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
index 8e0ed1c..372d2e4 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
@@ -19,8 +19,6 @@
 
 package org.apache.maven.archetype.generator;
 
-import org.apache.maven.archetype.common.DefaultArchetypeFilesResolver;
-import org.apache.maven.archetype.metadata.FileSet;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -34,16 +32,14 @@
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.io.Reader;
 import java.util.Properties;
 
 public class DefaultArchetypeGeneratorTest
@@ -51,81 +47,41 @@
 {
     ArtifactRepository localRepository;
 
+    String remoteRepository;
+
+    ArchetypeGenerator instance;
+
+    String outputDirectory;
+
     public void testArchetypeNotDefined()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testArchetypeNotDefined" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-2";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-2", "archetypes", null, "1.0" );
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
 
-        String basedir = getProjectDirectory( project );
+        instance.generateArchetype( request, result );
 
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeVersion( "1.0" );
-
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
         if ( result.getCause() == null )
         {
             fail( "Exception must be thrown" );
         }
-        else
-        {
-            assertEquals(
-                "Exception not correct",
-                "The archetype is not defined",
-                result.getCause().getMessage()
-            );
-        }
+        assertEquals( "Exception not correct", "The archetype is not defined", result.getCause().getMessage() );
     }
 
     public void testGenerateArchetypeCompleteWithoutParent()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypeCompleteWithoutParent" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-4";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-4", "archetypes", "basic", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectDirectory = new File( basedir, "file-value" );
-        assertDeleted( projectDirectory );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "basic" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
@@ -137,49 +93,31 @@
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
         request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        assertDeleted( projectDirectory );
 
-        instance.generateArchetype(request, result);
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
 
         if ( result.getCause() != null )
         {
-            fail( "No exception may be thrown: " + result.getCause().getMessage() );
-
             result.getCause().printStackTrace();
+            fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        String template;
-        template = "src/main/java/file/value/package/App.java";
-        assertTemplateContent( projectDirectory, template );
+        assertTemplateContent( projectDirectory, "src/main/java/file/value/package/App.java" );
+        assertTemplateContent( projectDirectory, "src/main/java/file/value/package/inner/package/App2.java" );
+        assertTemplateContent( projectDirectory, "src/main/c/file/value/package/App.c" );
+        assertTemplateContent( projectDirectory, "src/test/java/file/value/package/AppTest.java" );
+        assertTemplateContent( projectDirectory, "src/test/c/file/value/package/AppTest.c" );
+        assertTemplateContent( projectDirectory, "src/main/resources/App.properties" );
+        assertTemplateContent( projectDirectory, "src/main/resources/inner/dir/App2.properties" );
+        assertTemplateContent( projectDirectory, "src/main/mdo/App.mdo" );
+        assertTemplateContent( projectDirectory, "src/test/resources/AppTest.properties" );
+        assertTemplateContent( projectDirectory, "src/test/mdo/AppTest.mdo" );
 
-        template = "src/main/java/file/value/package/inner/package/App2.java";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/main/c/file/value/package/App.c";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/test/java/file/value/package/AppTest.java";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/test/c/file/value/package/AppTest.c";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/main/resources/App.properties";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/main/resources/inner/dir/App2.properties";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/main/mdo/App.mdo";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/test/resources/AppTest.properties";
-        assertTemplateContent( projectDirectory, template );
-
-        template = "src/test/mdo/AppTest.mdo";
-        assertTemplateContent( projectDirectory, template );
-
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( new File( projectDirectory, "pom.xml" ) );
         assertNull( model.getParent() );
         assertEquals( "file-value", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -187,43 +125,18 @@
     }
 
     public void testGenerateArchetypeCompleteWithParent()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypeCompleteWithParent" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-5";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-5", "archetypes", "basic", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectFile = getProjectFile( project );
-        File projectFileSample = getProjectSampleFile( project );
-        copy( projectFileSample, projectFile );
-
-        assertDeleted( new File( basedir, "file-value" ) );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "basic" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -232,15 +145,24 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectFile = getProjectFile();
+        File projectFileSample = getProjectSampleFile();
+        copy( projectFileSample, projectFile );
+
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        assertDeleted( projectDirectory );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( new File( projectDirectory, "pom.xml" ) );
         assertEquals( "org.apache.maven.archetype", model.getParent().getGroupId() );
         assertEquals( "test-generate-5-parent", model.getParent().getArtifactId() );
         assertEquals( "1.0-SNAPSHOT", model.getParent().getVersion() );
@@ -253,47 +175,22 @@
     }
 
     public void testGenerateArchetypePartialOnChild()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypePartialOnChild" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-8";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-8", "archetypes", "partial", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File parentProjectFile = getProjectFile( project );
-        File parentProjectFileSample = getProjectSampleFile( project );
+        File parentProjectFile = getProjectFile();
+        File parentProjectFileSample = getProjectSampleFile();
         copy( parentProjectFileSample, parentProjectFile );
 
-        File projectFile = getProjectFile( project + File.separator + "file-value" );
-        File projectFileSample = getProjectSampleFile( project + File.separator + "file-value" );
-        copy( projectFileSample, projectFile );
-
-        assertDeleted( new File( basedir, "file-value" + File.separator + "src" ) );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "partial" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -302,15 +199,25 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+        File projectFileSample = new File( projectDirectory, "pom.xml.sample" );
+        copy( projectFileSample, projectFile );
+
+        assertDeleted( new File( projectDirectory, "src" ) );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
+
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNotNull( model.getParent() );
         assertEquals( "org.apache.maven.archetype", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -322,47 +229,18 @@
     }
 
     public void testGenerateArchetypePartialOnChildDontOverride()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypePartialOnChildDontOverride" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-9";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-9", "archetypes", "partial", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File parentProjectFile = getProjectFile( project );
-        File parentProjectFileSample = getProjectSampleFile( project );
-        copy( parentProjectFileSample, parentProjectFile );
-
-        File projectFile = getProjectFile( project + File.separator + "file-value" );
-        File projectFileSample = getProjectSampleFile( project + File.separator + "file-value" );
-        copy( projectFileSample, projectFile );
-
-        assertDeleted( new File( basedir, "file-value" + File.separator + "src" ) );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "partial" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -371,15 +249,23 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+        File projectFileSample = new File( projectDirectory, "pom.xml.sample" );
+        copy( projectFileSample, projectFile );
+
+        assertDeleted( new File( projectDirectory, "src" ) );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNotNull( model.getParent() );
         assertEquals( "org.apache.maven.archetype", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -388,55 +274,24 @@
         assertFalse( model.getDependencies().isEmpty() );
         assertEquals( "1.0", ( (Dependency) model.getDependencies().get( 0 ) ).getVersion() );
         assertFalse( model.getBuild().getPlugins().isEmpty() );
-        assertEquals(
-            "1.0",
-            ( (Plugin) model.getBuild().getPlugins().get( 0 ) ).getVersion()
-        );
+        assertEquals( "1.0", ( (Plugin) model.getBuild().getPlugins().get( 0 ) ).getVersion() );
         assertFalse( model.getReporting().getPlugins().isEmpty() );
-        assertEquals(
-            "1.0",
-            ( (ReportPlugin) model.getReporting().getPlugins().get( 0 ) ).getVersion()
-        );
+        assertEquals( "1.0", ( (ReportPlugin) model.getReporting().getPlugins().get( 0 ) ).getVersion() );
     }
 
     public void testGenerateArchetypePartialOnParent()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypePartialOnParent" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-7";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-7", "archetypes", "partial", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectFile = getProjectFile( project );
-        File projectFileSample = getProjectSampleFile( project );
-        copy( projectFileSample, projectFile );
-
-        assertDeleted( new File( basedir, "src" ) );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "partial" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -445,15 +300,23 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectFile = new File( outputDirectory, "pom.xml" );
+        File projectFileSample = new File( outputDirectory, "pom.xml.sample" );
+        copy( projectFileSample, projectFile );
+
+        assertDeleted( new File( outputDirectory, "src" ) );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model = readPom( getProjectFile( project ) );
+        Model model = readPom( getProjectFile() );
         assertNull( model.getParent() );
         assertEquals( "org.apache.maven.archetype", model.getGroupId() );
         assertEquals( "test-generate-7", model.getArtifactId() );
@@ -463,47 +326,31 @@
     }
 
     public void testGenerateArchetypePartialWithoutPoms()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypePartialWithoutPoms" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-6";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-6", "archetypes", "partial", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectDirectory = new File( basedir, "file-value" );
-        assertDeleted( projectDirectory );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "partial" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+
+        assertDeleted( projectDirectory );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNull( model.getParent() );
         assertEquals( "file-value", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -511,40 +358,18 @@
     }
 
     public void testGenerateArchetypeSite()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateArchetypeSite" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-10";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-10", "archetypes", "site", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectDirectory = new File( basedir, "file-value" );
-        assertDeleted( projectDirectory );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "site" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -553,22 +378,25 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+
+        assertDeleted( projectDirectory );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        String template;
-        template = "src/site/site.xml";
-        assertTemplateContent( projectDirectory, template );
+        assertTemplateContent( projectDirectory, "src/site/site.xml" );
+        assertTemplateContent( projectDirectory, "src/site/apt/test.apt" );
 
-        template = "src/site/apt/test.apt";
-        assertTemplateContent( projectDirectory, template );
-
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNull( model.getParent() );
         assertEquals( "file-value", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -576,40 +404,18 @@
     }
 
     public void testGenerateFileSetArchetype()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateFileSetArchetype" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-12";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-12", "archetypes", "fileset", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectDirectory = new File( basedir, "file-value" );
-        assertDeleted( projectDirectory );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "fileset" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
+
         Properties additionalProperties = new Properties();
-        request.setProperties( additionalProperties );
         additionalProperties.setProperty( "property-without-default-1", "file-value" );
         additionalProperties.setProperty( "property-without-default-2", "file-value" );
         additionalProperties.setProperty( "property-without-default-3", "file-value" );
@@ -618,99 +424,56 @@
         additionalProperties.setProperty( "property-with-default-2", "file-value" );
         additionalProperties.setProperty( "property-with-default-3", "file-value" );
         additionalProperties.setProperty( "property-with-default-4", "file-value" );
+        request.setProperties( additionalProperties );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+
+        assertDeleted( projectDirectory );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
-        {result.getCause().printStackTrace(System.err);
+        {
+            result.getCause().printStackTrace( System.err );
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        Model model;
-        String template;
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "src/main/java/file/value/package/App.java", "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "src/main/java/file/value/package/inner/package/App2.java",
+                                                            "file-value" );
 
-        template = "src/main/java/file/value/package/App.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
+        assertTemplateCopiedWithFileSetArchetype( projectDirectory, "src/main/java/file/value/package/App.ogg" );
 
-        template = "src/main/java/file/value/package/inner/package/App2.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory, "src/main/resources/App.properties",
+                                                            "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "src/main/resources/file-value/touch.txt", "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "src/main/resources/file-value/touch_root.txt",
+                                                            "file-value" );
 
-        template = "src/main/java/file/value/package/App.ogg";
-        assertTemplateCopiedWithFileSetArchetype( projectDirectory, template );
+        assertTemplateCopiedWithFileSetArchetype( projectDirectory, "src/main/resources/some-dir/App.png" );
 
-        template = "src/main/resources/App.properties";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-        template = "src/main/resources/file-value/touch.txt";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-        template = "src/main/resources/file-value/touch_root.txt";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory, "src/site/site.xml", "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory, "src/site/apt/usage.apt", "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory, ".classpath", "file-value" );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory, "profiles.xml", "file-value" );
 
-        template = "src/main/resources/some-dir/App.png";
-        assertTemplateCopiedWithFileSetArchetype( projectDirectory, template );
-
-        template = "src/site/site.xml";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-
-        template = "src/site/apt/usage.apt";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-
-        template = ".classpath";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-
-        template = "profiles.xml";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "file-value"
-        );
-
-        model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNull( model.getParent() );
         assertEquals( "file-value", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
         assertEquals( "file-value", model.getVersion() );
 
-        template = "subproject/src/main/java/file/value/package/App.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "subproject"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "subproject/src/main/java/file/value/package/App.java",
+                                                            "subproject" );
 
-        model =
-            readPom( getProjectFile( project + File.separator + "file-value" + "/subproject/" ) );
+        model = readPom( new File( projectDirectory, "subproject/pom.xml" ) );
         assertNotNull( model.getParent() );
         assertEquals( "file-value", model.getParent().getGroupId() );
         assertEquals( "file-value", model.getParent().getArtifactId() );
@@ -719,46 +482,28 @@
         assertEquals( "subproject", model.getArtifactId() );
         assertEquals( "file-value", model.getVersion() );
 
-        template = "subproject/subsubproject/src/main/java/file/value/package/App.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "subsubproject"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "subproject/subsubproject/src/main/java/file/value/package/App.java",
+                                                            "subsubproject" );
 
-        template = "subproject/subsubproject/src/main/java/file/value/package/" +
-                "file-value/inner/subsubproject/innest/Somefile-valueClasssubsubproject.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "subsubproject"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "subproject/subsubproject/src/main/java/file/value/package/"
+                                                                + "file-value/inner/subsubproject/innest/Somefile-valueClasssubsubproject.java",
+                                                            "subsubproject" );
 
-        template = "subproject/subsubproject/src/main/java/file/value/package/" +
-                /*"file-value/inner/subsubproject/innest/" +*/
-                "ArbitraryProperty-file-value.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "subsubproject"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "subproject/subsubproject/src/main/java/file/value/package/"
+                                                            /* + "file-value/inner/subsubproject/innest/" + */
+                                                            + "ArbitraryProperty-file-value.java", "subsubproject" );
 
         // Test that undefined properties are safely ignored (and skipped)
-        template = "subproject/subsubproject/src/main/java/file/value/package/" +
-                /**"file-value/inner/subsubproject/innest/" +*/
-                "SkipsUndefinedProperty-__undefined-property__-file-value.java";
-        assertTemplateContentGeneratedWithFileSetArchetype(
-            projectDirectory,
-            template,
-            "subsubproject"
-        );
+        assertTemplateContentGeneratedWithFileSetArchetype( projectDirectory,
+                                                            "subproject/subsubproject/src/main/java/file/value/package/"
+                                                            /* + "file-value/inner/subsubproject/innest/" + */
+                                                            + "SkipsUndefinedProperty-__undefined-property__-file-value.java",
+                                                            "subsubproject" );
 
-        model =
-            readPom(
-                getProjectFile(
-                    project + File.separator + "file-value" + "/subproject/subsubproject/"
-                )
-            );
+        model = readPom( new File( projectDirectory, "subproject/subsubproject/pom.xml" ) );
         assertNotNull( model.getParent() );
         assertEquals( "file-value", model.getParent().getGroupId() );
         assertEquals( "subproject", model.getParent().getArtifactId() );
@@ -769,58 +514,36 @@
     }
 
     public void testGenerateOldArchetype()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testGenerateOldArchetype" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-11";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-11", "archetypes", "old", "1.0" );
 
-        String basedir = getProjectDirectory( project );
-
-        File projectDirectory = new File( basedir, "file-value" );
-        assertDeleted( projectDirectory );
-
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "old" );
-        request.setArchetypeVersion( "1.0" );
         request.setGroupId( "file-value" );
         request.setArtifactId( "file-value" );
         request.setVersion( "file-value" );
         request.setPackage( "file.value.package" );
 
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        File projectDirectory = new File( outputDirectory, "file-value" );
+        File projectFile = new File( projectDirectory, "pom.xml" );
+
+        assertDeleted( projectDirectory );
+
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+        instance.generateArchetype( request, result );
         if ( result.getCause() != null )
         {
-            result.getCause().printStackTrace(System.err);
+            result.getCause().printStackTrace( System.err );
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
 
-        String template;
-        template = "src/main/java/file/value/package/App.java";
-        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, template );
+        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, "src/main/java/file/value/package/App.java" );
+        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, "src/main/resources/App.properties" );
+        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, "src/site/site.xml" );
 
-        template = "src/main/resources/App.properties";
-        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, template );
-
-        template = "src/site/site.xml";
-        assertTemplateContentGeneratedWithOldArchetype( projectDirectory, template );
-
-        Model model = readPom( getProjectFile( project + File.separator + "file-value" ) );
+        Model model = readPom( projectFile );
         assertNull( model.getParent() );
         assertEquals( "file-value", model.getGroupId() );
         assertEquals( "file-value", model.getArtifactId() );
@@ -828,108 +551,67 @@
     }
 
     public void testPropertiesNotDefined()
-        throws
-        Exception
+        throws Exception
     {
         System.out.println( "testPropertiesNotDefined" );
-        String remoteRepository =
-                new File( getBasedir(), "target/test-classes/repositories/central" )
-                    .toURI().toString();
-        System.err.println("remoteRepository="+remoteRepository);
 
-        String project = "generate-3";
+        ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-3", "archetypes", "basic", "1.0" );
 
-        String basedir = getProjectDirectory( project );
+        ArchetypeGenerationResult result = new ArchetypeGenerationResult();
 
-        DefaultArchetypeGenerator instance =
-            (DefaultArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
-        instanceDefined( instance );
-
-        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
-        request.setLocalRepository( localRepository );
-        request.setArchetypeRepository( remoteRepository );
-        request.setOutputDirectory( basedir );
-
-        request.setArchetypeGroupId( "archetypes" );
-        request.setArchetypeArtifactId( "basic" );
-        request.setArchetypeVersion( "1.0" );
-
-        ArchetypeGenerationResult result=new ArchetypeGenerationResult();
-        instance.generateArchetype(request, result);
+        instance.generateArchetype( request, result );
         if ( result.getCause() == null )
         {
             fail( "No exception may be thrown: " + result.getCause().getMessage() );
         }
-        else
-        {
-            assertTrue(
-                "Exception not correct",
-                result.getCause().getMessage().startsWith(
-                    "Archetype archetypes:basic:1.0 is not configured" ) &&
-                result.getCause().getMessage().endsWith(
-                    "Property property-without-default-4 is missing." )
-            );
-        }
-    }
 
-    public void testResourceFiltering()
-        throws
-        Exception
-    {
-        FileSet fileSet = new FileSet();
-
-        fileSet.addInclude( "**/*.java" );
-
-        fileSet.setDirectory( "src/main/java" );
-        fileSet.setEncoding( "UTF-8" );
-        fileSet.setPackaged( true );
-        fileSet.setFiltered( true );
-
-        List archetypeResources = new ArrayList();
-
-        archetypeResources.add( "pom.xml" );
-        archetypeResources.add( "App.java" );
-        archetypeResources.add( "src/main/c/App.c" );
-        archetypeResources.add( "src/main/java/App.java" );
-        archetypeResources.add( "src/main/java/inner/package/App2.java" );
-        archetypeResources.add( "src/main/mdo/App.mdo" );
-        archetypeResources.add( "src/main/resources/App.properties" );
-        archetypeResources.add( "src/main/resources/inner/dir/App2.properties" );
-        archetypeResources.add( "src/test/c/AppTest.c" );
-        archetypeResources.add( "src/test/java/AppTest.java" );
-        archetypeResources.add( "src/test/mdo/AppTest.mdo" );
-        archetypeResources.add( "src/test/resources/AppTest.properties" );
-
-        System.out.println( "FileSet:" + fileSet );
-        System.out.println( "Resources:" + archetypeResources );
-
-        DefaultArchetypeFilesResolver resolver = new DefaultArchetypeFilesResolver();
-
-        List fileSetResources = resolver.filterFiles( "", fileSet, archetypeResources );
-        System.out.println( "Result:" + fileSetResources );
-        assertEquals( 2, fileSetResources.size() );
+        assertTrue( "Exception not correct",
+                    result.getCause().getMessage().startsWith( "Archetype archetypes:basic:1.0 is not configured" )
+                        && result.getCause().getMessage().endsWith( "Property property-without-default-4 is missing." ) );
     }
 
     protected void tearDown()
-        throws
-        Exception
+        throws Exception
     {
         super.tearDown();
+
+        outputDirectory = null;
     }
 
     protected void setUp()
-        throws
-        Exception
+        throws Exception
     {
         super.setUp();
 
+        String repositories = new File( getBasedir(), "target/test-classes/repositories" ).toURI().toString();
+
         localRepository =
-            new DefaultArtifactRepository(
-                "local",
-                new File( getBasedir(), "target/test-classes/repositories/local" ).toURI()
-                    .toString(),
-                new DefaultRepositoryLayout()
-            );
+            new DefaultArtifactRepository( "local", repositories + "/local", new DefaultRepositoryLayout() );
+
+        remoteRepository = repositories + "/central";
+
+        instance = (ArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
+        assertNotNull( instance );
+        assertNotNull( getVariableValueFromObject( instance, "archetypeArtifactManager" ) );
+        assertNotNull( getVariableValueFromObject( instance, "oldArchetype" ) );
+        assertNotNull( getVariableValueFromObject( instance, "filesetGenerator" ) );
+    }
+
+    private ArchetypeGenerationRequest createArchetypeGenerationRequest( String project, String groupId,
+                                                                         String artifactId, String version )
+    {
+        outputDirectory = getBasedir() + "/target/test-classes/projects/" + project;
+
+        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
+        request.setLocalRepository( localRepository );
+        request.setArchetypeRepository( remoteRepository );
+        request.setOutputDirectory( outputDirectory );
+
+        request.setArchetypeGroupId( groupId );
+        request.setArchetypeArtifactId( artifactId );
+        request.setArchetypeVersion( version );
+
+        return request;
     }
 
     /**
@@ -973,10 +655,8 @@
         }
     }
 
-    private void assertTemplateContent( final File projectDirectory,
-                                        final String template )
-        throws
-        IOException
+    private void assertTemplateContent( final File projectDirectory, final String template )
+        throws IOException
     {
         Properties properties = loadProperties( projectDirectory, template );
         assertEquals( "file-value", properties.getProperty( "groupId" ) );
@@ -993,13 +673,9 @@
         assertEquals( "file-value", properties.getProperty( "property-without-default-4" ) );
     }
 
-    private void assertTemplateContentGeneratedWithFileSetArchetype(
-        File projectDirectory,
-        String template,
-        String artifactId
-    )
-        throws
-        IOException
+    private void assertTemplateContentGeneratedWithFileSetArchetype( File projectDirectory, String template,
+                                                                     String artifactId )
+        throws IOException
     {
         Properties properties = loadProperties( projectDirectory, template );
         assertEquals( "file-value", properties.getProperty( "groupId" ) );
@@ -1009,12 +685,8 @@
         assertEquals( "file/value/package", properties.getProperty( "packageInPathFormat" ) );
     }
 
-    private void assertTemplateContentGeneratedWithOldArchetype(
-        final File projectDirectory,
-        final String template
-    )
-        throws
-        IOException
+    private void assertTemplateContentGeneratedWithOldArchetype( final File projectDirectory, final String template )
+        throws IOException
     {
         Properties properties = loadProperties( projectDirectory, template );
         assertEquals( "file-value", properties.getProperty( "groupId" ) );
@@ -1023,10 +695,8 @@
         assertEquals( "file.value.package", properties.getProperty( "package" ) );
     }
 
-    private void assertTemplateCopiedWithFileSetArchetype( File projectDirectory,
-                                                           String template )
-        throws
-        IOException
+    private void assertTemplateCopiedWithFileSetArchetype( File projectDirectory, String template )
+        throws IOException
     {
         Properties properties = loadProperties( projectDirectory, template );
         assertEquals( "${groupId}", properties.getProperty( "groupId" ) );
@@ -1036,107 +706,74 @@
         assertEquals( "${packageInPathFormat}", properties.getProperty( "packageInPathFormat" ) );
     }
 
-    private void copy( final File in,
-                       final File out )
-        throws
-        IOException,
-        FileNotFoundException
+    private void copy( final File in, final File out )
+        throws IOException, FileNotFoundException
     {
         assertTrue( !out.exists() || out.delete() );
         assertFalse( out.exists() );
-        IOUtil.copy( new FileReader( in ), new FileWriter( out ) );
+
+        FileUtils.copyFile( in, out );
+
         assertTrue( out.exists() );
         assertTrue( in.exists() );
     }
 
-    private void instanceDefined( DefaultArchetypeGenerator instance )
-        throws
-        IllegalAccessException
-    {
-        assertNotNull( instance );
-        assertNotNull( getVariableValueFromObject( instance, "archetypeArtifactManager" ) );
-        assertNotNull( getVariableValueFromObject( instance, "oldArchetype" ) );
-        assertNotNull( getVariableValueFromObject( instance, "filesetGenerator" ) );
-    }
-
     private Properties loadProperties( File propertyFile )
-        throws
-        IOException,
-        FileNotFoundException
+        throws IOException, FileNotFoundException
     {
         Properties properties = new Properties();
         properties.load( new FileInputStream( propertyFile ) );
         return properties;
     }
 
-    private Properties loadProperties( final File projectDirectory,
-                                       final String template )
-        throws
-        IOException
+    private Properties loadProperties( final File projectDirectory, final String template )
+        throws IOException
     {
         File templateFile = new File( projectDirectory, template );
         if ( !templateFile.exists() )
         {
-            fail( "Missing File:" + templateFile );
+            fail( "Missing File: " + templateFile );
         }
 
         Properties properties = loadProperties( templateFile );
         return properties;
     }
 
-    private String getProjectDirectory( String project )
+    private File getProjectFile()
     {
-        return getBasedir() + "/target/test-classes/projects/" + project;
+        return new File( outputDirectory, "/pom.xml" );
     }
 
-    private File getProjectFile( String project )
+    private File getProjectSampleFile()
     {
-        return new File( getProjectDirectory( project ), "/pom.xml" );
+        return new File( outputDirectory, "/pom.xml.sample" );
     }
 
-    private File getProjectSampleFile( String project )
+    private File getPropertiesFile()
     {
-        return
-            new File(
-                getProjectDirectory( project ), "/pom.xml.sample"
-            );
+        return new File( outputDirectory, "/archetype.properties" );
     }
 
-    private File getPropertiesFile( String project )
+    private File getPropertiesSampleFile()
     {
-        return
-            new File(
-                getProjectDirectory( project ), "/archetype.properties"
-            );
-    }
-
-    private File getPropertiesSampleFile( final String project )
-    {
-        return
-            new File(
-                getProjectDirectory( project ), "/archetype.properties.sample"
-            );
+        return new File( outputDirectory, "/archetype.properties.sample" );
     }
 
     private Model readPom( final File pomFile )
-        throws
-        IOException,
-        XmlPullParserException
+        throws IOException, XmlPullParserException
     {
-        Model generatedModel;
-        FileReader pomReader = null;
+        Reader pomReader = null;
         try
         {
-            pomReader = new FileReader( pomFile );
+            pomReader = ReaderFactory.newXmlReader( pomFile );
 
             MavenXpp3Reader reader = new MavenXpp3Reader();
 
-            generatedModel = reader.read( pomReader );
+            return reader.read( pomReader );
         }
         finally
         {
             IOUtil.close( pomReader );
         }
-        return generatedModel;
     }
 }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
index 9074eab..a9a5804 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -61,20 +62,6 @@
     {
         FileUtils.deleteDirectory( getTestFile( "target/quickstart" ) );
 
-        Map parameters = new HashMap();
-
-        parameters.put( "name", "jason" );
-
-        parameters.put( "groupId", "maven" );
-
-        parameters.put( "artifactId", "quickstart" );
-
-        parameters.put( "version", "1.0-alpha-1-SNAPSHOT" );
-
-        parameters.put( "package", "org.apache.maven.quickstart" );
-
-        parameters.put( "basedir", getTestFile( "target" ).getAbsolutePath() );
-
         // ----------------------------------------------------------------------
         // This needs to be encapsulated in a maven test case.
         // ----------------------------------------------------------------------
@@ -94,16 +81,33 @@
 
         remoteRepositories.add( remoteRepository );
 
-        String archetypeGroupId = "org.apache.maven.archetypes";
-        String archetypeArtifactId = "maven-archetype-quickstart";
-        String archetypeVersion = "1.0-alpha-1-SNAPSHOT";
-        archetype.createArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion, remoteRepository, localRepository,
-                                   remoteRepositories, parameters );
+        ArchetypeGenerationRequest request = new ArchetypeGenerationRequest()
+            .setPackage( "org.apache.maven.quickstart" )
+            .setGroupId( "maven" )
+            .setArtifactId( "quickstart" )
+            .setVersion( "1.0-alpha-1-SNAPSHOT" )
+            .setArchetypeGroupId( "org.apache.maven.archetypes" )
+            .setArchetypeArtifactId( "maven-archetype-quickstart" )
+            .setArchetypeVersion( "1.0-alpha-1-SNAPSHOT" )
+            .setLocalRepository( localRepository )
+            .setRemoteArtifactRepositories( remoteRepositories )
+            .setOutputDirectory( getTestFile( "target" ).getAbsolutePath() );
+        //parameters.put( "name", "jason" );
+
+        archetype.createArchetype( request, remoteRepository );
 
         // ----------------------------------------------------------------------
         // Set up the Velocity context
         // ----------------------------------------------------------------------
 
+        Map parameters = new HashMap();
+        parameters.put( "basedir", request.getOutputDirectory() );
+        parameters.put( "package", request.getPackage() );
+        parameters.put( "packageName", request.getPackage() );
+        parameters.put( "groupId", request.getGroupId() );
+        parameters.put( "artifactId", request.getArtifactId() );
+        parameters.put( "version", request.getVersion() );
+
         Context context = new VelocityContext();
 
         for ( Iterator iterator = parameters.keySet().iterator(); iterator.hasNext(); )
@@ -120,8 +124,8 @@
         // ----------------------------------------------------------------------
 
         ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.class.getName() );
-        Artifact archetypeArtifact = artifactFactory.createArtifact( archetypeGroupId, archetypeArtifactId,
-                                                                     archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" );
+        Artifact archetypeArtifact = artifactFactory.createArtifact( request.getArchetypeGroupId(), request.getArchetypeArtifactId(),
+                                                                     request.getArchetypeVersion(), Artifact.SCOPE_RUNTIME, "jar" );
 
         StringWriter writer = new StringWriter();
 
@@ -231,46 +235,81 @@
     public void testAddModuleToParentPOM()
         throws DocumentException, IOException, ArchetypeTemplateProcessingException
     {
-        String pom = "<project>\n  <packaging>pom</packaging>\n</project>";
+        String pom = "<project>\n"
+            + "  <packaging>pom</packaging>\n"
+            + "</project>";
 
         StringWriter out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId1", new StringReader( pom ), out ) );
 
-        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project>\n" +
-            "  <packaging>pom</packaging>\n" + "  <modules>\n" + "    <module>myArtifactId1</module>\n" +
-            "  </modules>\n" + "</project>", out.toString() );
+        assertEquals(
+                     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                     + "<project>\n"
+                     + "  <packaging>pom</packaging>\n"
+                     + "  <modules>\n"
+                     + "    <module>myArtifactId1</module>\n"
+                     + "  </modules>\n"
+                     + "</project>", out.toString() );
 
-        pom = "<project>\n  <modelVersion>4.0.0</modelVersion>\n" + "  <packaging>pom</packaging>\n" + "</project>";
+        pom = "<project>\n"
+            + "  <modelVersion>4.0.0</modelVersion>\n"
+            + "  <packaging>pom</packaging>\n"
+            + "</project>";
 
         out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId2", new StringReader( pom ), out ) );
 
-        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project>\n" +
-            "  <modelVersion>4.0.0</modelVersion>\n" + "  <packaging>pom</packaging>\n" + "  <modules>\n" +
-            "    <module>myArtifactId2</module>\n" + "  </modules>\n" + "</project>", out.toString() );
+        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                      + "<project>\n"
+                      + "  <modelVersion>4.0.0</modelVersion>\n"
+                      + "  <packaging>pom</packaging>\n"
+                      + "  <modules>\n"
+                      + "    <module>myArtifactId2</module>\n"
+                      + "  </modules>\n"
+                      + "</project>", out.toString() );
 
-        pom = "<project><modelVersion>4.0.0</modelVersion>\n" + "  <packaging>pom</packaging>\n" + "  <modules>\n" +
-            "  </modules>\n" + "</project>";
+        pom = "<project><modelVersion>4.0.0</modelVersion>\n"
+            + "  <packaging>pom</packaging>\n"
+            + "  <modules>\n"
+            + "  </modules>\n"
+            + "</project>";
 
         out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId3", new StringReader( pom ), out ) );
 
-        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project><modelVersion>4.0.0</modelVersion>\n" +
-            "  <packaging>pom</packaging>\n" + "  <modules>\n" + "    <module>myArtifactId3</module>\n" +
-            "  </modules>\n" + "</project>", out.toString() );
+        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                      + "<project><modelVersion>4.0.0</modelVersion>\n"
+                      + "  <packaging>pom</packaging>\n"
+                      + "  <modules>\n"
+                      + "    <module>myArtifactId3</module>\n"
+                      + "  </modules>\n"
+                      + "</project>", out.toString() );
 
-        pom = "<project><modelVersion>4.0.0</modelVersion>\n" + "  <packaging>pom</packaging>\n" + "  <modules>\n" +
-            "    <module>myArtifactId3</module>\n" + "  </modules>\n" + "</project>";
+        pom = "<project><modelVersion>4.0.0</modelVersion>\n"
+            + "  <packaging>pom</packaging>\n"
+            + "  <modules>\n"
+            + "    <module>myArtifactId3</module>\n"
+            + "  </modules>\n"
+            + "</project>";
 
         out = new StringWriter();
         assertTrue( DefaultOldArchetype.addModuleToParentPom( "myArtifactId4", new StringReader( pom ), out ) );
 
-        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project><modelVersion>4.0.0</modelVersion>\n" +
-            "  <packaging>pom</packaging>\n" + "  <modules>\n" + "    <module>myArtifactId3</module>\n" +
-            "    <module>myArtifactId4</module>\n" + "  </modules>\n" + "</project>", out.toString() );
+        assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                      + "<project><modelVersion>4.0.0</modelVersion>\n"
+                      + "  <packaging>pom</packaging>\n"
+                      + "  <modules>\n"
+                      + "    <module>myArtifactId3</module>\n"
+                      + "    <module>myArtifactId4</module>\n"
+                      + "  </modules>\n"
+                      + "</project>", out.toString() );
 
-        pom = "<project><modelVersion>4.0.0</modelVersion>\n" + "  <packaging>pom</packaging>\n" + "  <modules>\n" +
-            "    <module>myArtifactId3</module>\n" + "  </modules>\n" + "</project>";
+        pom = "<project><modelVersion>4.0.0</modelVersion>\n"
+            + "  <packaging>pom</packaging>\n"
+            + "  <modules>\n"
+            + "    <module>myArtifactId3</module>\n"
+            + "  </modules>\n"
+            + "</project>";
 
         out = new StringWriter();
         assertFalse( DefaultOldArchetype.addModuleToParentPom( "myArtifactId3", new StringReader( pom ), out ) );
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
index f0f9e98..6a4b43c 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
@@ -5,13 +5,11 @@
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.io.File;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
 /** @author Jason van Zyl */
 public class CatalogArchetypeDataSinkTest
@@ -60,32 +58,4 @@
 
         assertEquals( "http://magicbunny.com/maven2", a1.getRepository()  );
     }
-
-    public void testPuttingTheWikiSourceIntoACatalogSink()
-        throws Exception
-    {
-        Writer writer = new StringWriter();
-
-        ArchetypeDataSink sink = new CatalogArchetypeDataSink();
-
-        Properties p = new Properties();
-
-        File wikiSource = new File( getBasedir(), "src/test/sources/wiki/wiki-source.txt" );
-
-        assertTrue( wikiSource.exists() );
-
-        ArchetypeDataSource ads = new InternalCatalogArchetypeDataSource();
-
-        sink.putArchetypes( ads, p, writer );
-
-        StringReader reader = new StringReader( writer.toString() );
-
-        ArchetypeCatalogXpp3Reader catalogReader = new ArchetypeCatalogXpp3Reader();
-
-        ArchetypeCatalog catalog = catalogReader.read( reader );
-
-        int catalogSize = catalog.getArchetypes().size();
-
-        assertEquals( 46, catalogSize );
-    }
 }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/WikiArchetypeDataSource.java b/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSource.java
similarity index 72%
rename from archetype-common/src/test/java/org/apache/maven/archetype/test/WikiArchetypeDataSource.java
rename to archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSource.java
index 21a58a5..70b64d0 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/WikiArchetypeDataSource.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSource.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.source;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,17 +19,14 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.test;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.source.ArchetypeDataSource;
 import org.apache.maven.archetype.source.ArchetypeDataSourceException;
+import org.codehaus.plexus.util.IOUtil;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 
 import java.net.URL;
 
@@ -38,18 +37,22 @@
 import java.util.regex.Pattern;
 
 /**
+ * An archetype data source getting its content from a Confluence Wiki page.
+ * By default, <a href="http://docs.codehaus.org/display/MAVENUSER/Archetypes+List">MAVENUSER/Archetypes List</a>
+ * is used.
+ *
  * @author            Jason van Zyl
  * @plexus.component  role-hint="wiki"
  */
 public class WikiArchetypeDataSource
-implements ArchetypeDataSource
+    implements ArchetypeDataSource
 {
     private static String DEFAULT_ARCHETYPE_INVENTORY_PAGE =
         "http://docs.codehaus.org/pages/viewpagesrc.action?pageId=48400";
 
     static String cleanup( String val )
     {
-        val = val.replaceAll( "\\r|\\n|\\s{2,}", "" );
+        val = val.replaceAll( "\\r|\\n|\\s{2,}|\\[|\\|[^\\]]+]|\\]", "" );
         return val;
     }
 
@@ -59,7 +62,7 @@
     }
 
     public ArchetypeCatalog getArchetypeCatalog( Properties properties )
-    throws ArchetypeDataSourceException
+        throws ArchetypeDataSourceException
     {
         ArchetypeCatalog ac = new ArchetypeCatalog();
         ac.setArchetypes( getArchetypes( properties ) );
@@ -67,49 +70,43 @@
     }
 
     public List getArchetypes( Properties properties )
-    throws ArchetypeDataSourceException
+        throws ArchetypeDataSourceException
     {
         String url = properties.getProperty( "url" );
 
-        if( url == null )
+        if ( url == null )
         {
             url = DEFAULT_ARCHETYPE_INVENTORY_PAGE;
         }
 
         List archetypes = new ArrayList();
 
-        StringBuffer sb = new StringBuffer();
-
+        String pageSource = "";
+        InputStream in = null;
         try
         {
-            InputStream in = new URL( cleanupUrl( url ) ).openStream();
+            in = new URL( cleanupUrl( url ) ).openStream();
 
-            BufferedReader reader = new BufferedReader( new InputStreamReader( in ) );
-
-            char[] buffer = new char[1024];
-
-            int len = 0;
-
-            while( ( len = reader.read( buffer ) ) > -1 )
-            {
-                sb.append( buffer, 0, len );
-            }
+            pageSource = IOUtil.toString( in );
         }
-        catch( IOException e )
+        catch ( IOException e )
         {
-            throw new ArchetypeDataSourceException(
-                "Error retrieving list of archetypes from " + url
-            );
+            throw new ArchetypeDataSourceException( "Error retrieving list of archetypes from " + url );
+        }
+        finally
+        {
+            IOUtil.close( in );
         }
 
+        // | ArtifactId | GroupId | Version | Repository | Description |
         Pattern ptn =
             Pattern.compile(
-                "<br>\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_.:/ \\[\\],]+)\\|([^|]+)\\|"
+                "<br>\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_. ]+)\\|([-a-zA-Z0-9_.:/ \\[\\],]+)\\|(.*) \\|"
             );
 
-        Matcher m = ptn.matcher( sb.toString() );
+        Matcher m = ptn.matcher( pageSource );
 
-        while( m.find() )
+        while ( m.find() )
         {
             Archetype archetype = new Archetype();
 
@@ -118,12 +115,10 @@
             archetype.setGroupId( m.group( 2 ).trim() );
 
             String version = m.group( 3 ).trim();
-
-            if( version.equals( "" ) )
+            if ( version.equals( "" ) )
             {
                 version = "RELEASE";
             }
-
             archetype.setVersion( version );
 
             archetype.setRepository( cleanupUrl( m.group( 4 ).trim() ) );
@@ -136,7 +131,7 @@
     }
 
     public void updateCatalog( Properties properties, Archetype archetype )
-    throws ArchetypeDataSourceException
+        throws ArchetypeDataSourceException
     {
         throw new UnsupportedOperationException( "Not supported yet." );
     }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
index 62e8b51..0d0ec64 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
@@ -1,27 +1,76 @@
 package org.apache.maven.archetype.source;
 
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.util.List;
+import java.io.File;
 import java.util.Properties;
-import org.apache.maven.archetype.Archetype;
 
 /** @author Jason van Zyl */
 public class WikiArchetypeDataSourceTest
     extends PlexusTestCase
 {
+    private static final String[][] REFERENCE =
+        {
+            { "appfuse-basic-jsf", "org.appfuse.archetypes", "2.0", "http://static.appfuse.org/releases",
+                "AppFuse archetype for creating a web application with Hibernate, Spring and JSF" },
+            { "maven-archetype-profiles", "org.apache.maven.archetypes", "RELEASE", "http://repo1.maven.org/maven2", "" },
+            { "struts2-archetype-starter", "org.apache.struts", "2.0.9-SNAPSHOT",
+                "http://people.apache.org/repo/m2-snapshot-repository",
+                "A starter Struts 2 application with Sitemesh, DWR, and Spring" },
+            { "maven-archetype-har", "net.sf.maven-har", "0.9", "", "Hibernate Archive" },
+            { "maven-archetype-archetype", "org.apache.maven.archetypes", "RELEASE", "", "" }
+        };
+
     public void testWikiArchetypeDataSource()
         throws Exception
     {
+        File wikiSource = new File( getBasedir(), "src/test/resources/wiki/wiki-source.txt" );
+
+        assertTrue( wikiSource.exists() );
+
         Properties p = new Properties();
-        ArchetypeDataSource ads = new InternalCatalogArchetypeDataSource();
-        List archetypes = ads.getArchetypeCatalog( p ).getArchetypes();
+        p.put( "url", wikiSource.toURL().toExternalForm() );
 
-        assertEquals( 46, archetypes.size() );
+        ArchetypeDataSource ads = new WikiArchetypeDataSource();
 
-        Archetype a = (Archetype) lookup(Archetype.class.getName());
-        archetypes=a.getInternalCatalog().getArchetypes();
+        ArchetypeCatalog catalog = ads.getArchetypeCatalog( p );
 
-        assertEquals( 46, archetypes.size() );
+        int catalogSize = catalog.getArchetypes().size();
+
+        assertEquals( REFERENCE.length, catalogSize );
+
+        for ( int i = 0; i < catalogSize; i++ )
+        {
+            String[] reference = REFERENCE[i];
+
+            Archetype ar = (Archetype) catalog.getArchetypes().get( i );
+
+            assertEquals( "#" + i + " artifactId", reference[0], ar.getArtifactId() );
+            assertEquals( "#" + i + " groupId", reference[1], ar.getGroupId() );
+            assertEquals( "#" + i + " version", reference[2], ar.getVersion() );
+            assertEquals( "#" + i + " repository", reference[3], ar.getRepository() );
+            assertEquals( "#" + i + " description", reference[4], ar.getDescription() );
+        }
     }
 }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetypeGenerationTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetypeGenerationTest.java
index 409ca98..0c40c1d 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetypeGenerationTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetypeGenerationTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.test;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,17 +19,17 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.test;
-
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
-import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.File;
 import java.util.Properties;
+
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -38,7 +40,7 @@
     public void testProjectGenerationFromAnArchetype()
         throws Exception
     {
-        Archetype archetype = (Archetype) lookup( Archetype.ROLE );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.ROLE );
 
         // In the embedder the localRepository will be retrieved from the embedder itself and users won't
         // have to go through this muck.
@@ -49,7 +51,7 @@
             new File( getBasedir(), "target/test-classes/repositories/local" )
                 .toURI().toURL().toExternalForm(), "local-repo" );
 
-        ArchetypeCatalog catalog = archetype.getLocalCatalog( 
+        ArchetypeCatalog catalog = archetype.getLocalCatalog(
             new File( getBasedir(), "target/test-classes/repositories/central" ).getAbsolutePath()
                  );
 
@@ -57,8 +59,7 @@
         // Here I am just grabbing a OldArchetype but in a UI you would take the OldArchetype objects and present
         // them to the user.
 
-        org.apache.maven.archetype.catalog.Archetype selection = (org.apache.maven.archetype.catalog.Archetype) 
-            catalog.getArchetypes().get( catalog.getArchetypes().size() - 1 );
+        Archetype selection = (Archetype) catalog.getArchetypes().get( catalog.getArchetypes().size() - 1 );
 
         System.err.println( "Selected OldArchetype = " + selection );
         // Now you will present a dialog, or whatever, and grab the following values.
@@ -74,7 +75,7 @@
         // With the selected OldArchetype and the parameters you can create a generation request as follows:
         File outputDirectory = new File( getBasedir(), "target/test-classes/projects/archetyper-generate-1" );
         FileUtils.forceDelete(outputDirectory);
-        
+
         ArchetypeGenerationRequest agr = new ArchetypeGenerationRequest( selection )
             .setOutputDirectory( outputDirectory.getAbsolutePath() )
             .setLocalRepository( localRepository )
@@ -104,5 +105,5 @@
             fail( result.getCause().getMessage() );
         }
     }
-    
+
 }
\ No newline at end of file
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
index 39ab975..486d23b 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.test;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,15 +18,14 @@
  * 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.ArchetypeManager;
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
@@ -46,9 +47,7 @@
 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.Properties;
@@ -63,23 +62,21 @@
         throws Exception
     {
 
-        Archetype archetype = (Archetype) lookup( Archetype.ROLE );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.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 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" );
+        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
@@ -93,9 +90,10 @@
         // (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-1-project" );
-        FileUtils.forceDelete(new File(workingProject, "target"));
+        File workingProject =
+            new File( getBasedir(), "target" + File.separator + "test-classes" + File.separator + "projects"
+                + File.separator + "roundtrip-1-project" );
+        FileUtils.forceDelete( new File( workingProject, "target" ) );
 
         // (2) create an archetype from the project
         File pom = new File( workingProject, "pom.xml" );
@@ -112,44 +110,45 @@
 
         if ( creationResult.getCause() != null )
         {
-            fail( creationResult.getCause().getMessage() );
+            throw creationResult.getCause();
         }
 
         // (3) create our own archetype catalog properties in memory
-        File catalogDirectory = new File( getBasedir(), "target"+File.separator+"catalog" );
+        File catalogDirectory = new File( getBasedir(), "target" + File.separator + "catalog" );
         catalogDirectory.mkdirs();
 
         File catalogFile = new File( catalogDirectory, "archetype-catalog.xml" );
 
         // (5) install the archetype we just created
-        File generatedArchetypeDirectory = new File( project.getBasedir(),
-            "target"+File.separator+"generated-sources"+File.separator+"archetype" );
+        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 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" );
+        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();
+        Archetype generatedArchetype = new Archetype();
         generatedArchetype.setGroupId( generatedArchetypeProject.getGroupId() );
         generatedArchetype.setArtifactId( generatedArchetypeProject.getArtifactId() );
         generatedArchetype.setVersion( generatedArchetypeProject.getVersion() );
@@ -162,9 +161,10 @@
         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-1-recreatedproject" ).getAbsolutePath();
-        FileUtils.forceDelete(outputDirectory);
+        String outputDirectory =
+            new File( getBasedir(), "target" + File.separator + "test-classes" + File.separator + "projects"
+                + File.separator + "roundtrip-1-recreatedproject" ).getAbsolutePath();
+        FileUtils.forceDelete( outputDirectory );
 
         ArchetypeGenerationRequest agr =
             new ArchetypeGenerationRequest().setArchetypeGroupId(
@@ -179,33 +179,33 @@
 
         if ( generationResult.getCause() != null )
         {
-            fail( generationResult.getCause().getMessage() );
+            throw generationResult.getCause();
         }
 
         //ASSERT symbol_pound replacement (archetype-180 archetype-183)
         String content = FileUtils.fileRead(
-                outputDirectory + File.separator + "myapp" + File.separator + 
-                "src" + File.separator + "main" + File.separator + "java" + 
-                File.separator + "com" + File.separator + "mycompany" + 
+                outputDirectory + File.separator + "myapp" + File.separator +
+                "src" + File.separator + "main" + File.separator + "java" +
+                File.separator + "com" + File.separator + "mycompany" +
                 File.separator + "myapp" + File.separator + "App.java");
-        System.err.println("content="+content);
-        assertTrue(content.indexOf("//A   #\\{some}")>0);
-        assertTrue(content.indexOf("//B   #{some}")>0);
-        assertTrue(content.indexOf("//C   #{some other}")>0);
-        assertTrue(content.indexOf("//D   \\#{some other}")>0);
-        assertTrue(content.indexOf("//E   #{}")>0);
-        assertTrue(content.indexOf("//F   {some}")>0);
-        assertTrue(content.indexOf("//G   ${someOtherProperty}")>0);
-        assertTrue(content.indexOf("//H   ${someValue}")>0);
-        assertTrue(content.indexOf("/*")>0);
-        assertTrue(content.indexOf("  A   #\\{some}")>0);
-        assertTrue(content.indexOf("  B   #{some}")>0);
-        assertTrue(content.indexOf("  C   #{some other}")>0);
-        assertTrue(content.indexOf("  D   \\#{some other}")>0);
-        assertTrue(content.indexOf("  E   #{}") > 0);
-        assertTrue(content.indexOf("  F   {some}")>0);
-        assertTrue(content.indexOf("  G   ${someOtherProperty}")>0);
-        assertTrue(content.indexOf("  H   ${someValue}")>0);
+        System.err.println( "content=" + content );
+        assertTrue( content.indexOf( "//A   #\\{some}" ) > 0 );
+        assertTrue( content.indexOf( "//B   #{some}" ) > 0 );
+        assertTrue( content.indexOf( "//C   #{some other}" ) > 0 );
+        assertTrue( content.indexOf( "//D   \\#{some other}" ) > 0 );
+        assertTrue( content.indexOf( "//E   #{}" ) > 0 );
+        assertTrue( content.indexOf( "//F   {some}" ) > 0 );
+        assertTrue( content.indexOf( "//G   ${someOtherProperty}" ) > 0 );
+        assertTrue( content.indexOf( "//H   ${someValue}" ) > 0 );
+        assertTrue( content.indexOf( "/*" ) > 0 );
+        assertTrue( content.indexOf( "  A   #\\{some}" ) > 0 );
+        assertTrue( content.indexOf( "  B   #{some}" ) > 0 );
+        assertTrue( content.indexOf( "  C   #{some other}" ) > 0 );
+        assertTrue( content.indexOf( "  D   \\#{some other}" ) > 0 );
+        assertTrue( content.indexOf( "  E   #{}" ) > 0 );
+        assertTrue( content.indexOf( "  F   {some}" ) > 0 );
+        assertTrue( content.indexOf( "  G   ${someOtherProperty}" ) > 0 );
+        assertTrue( content.indexOf( "  H   ${someValue}" ) > 0 );
         //Assert symbol_dollar archetype-138
     }
 
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripWithProxyTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripWithProxyTest.java
index 229276f..774cff9 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripWithProxyTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripWithProxyTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.test;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,18 +18,18 @@
  * 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.ArchetypeManager;
+import org.apache.maven.archetype.catalog.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.manager.WagonManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
@@ -52,7 +54,6 @@
 import java.io.Writer;
 import java.net.URL;
 import java.util.Properties;
-import org.apache.maven.artifact.manager.WagonManager;
 
 /** @author Jason van Zyl */
 public class ArchetyperRoundtripWithProxyTest
@@ -64,22 +65,20 @@
     public void testArchetyper()
         throws Exception
     {
-        Archetype archetype = (Archetype) lookup( Archetype.ROLE );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.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" );
+        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
@@ -93,9 +92,10 @@
         // (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-2-project" );
-        FileUtils.forceDelete(new File(workingProject, "target"));
+        File workingProject =
+            new File( getBasedir(), "target" + File.separator + "test-classes" + File.separator + "projects"
+                + File.separator + "roundtrip-2-project" );
+        FileUtils.forceDelete( new File( workingProject, "target" ) );
 
         // (2) create an archetype from the project
         File pom = new File( workingProject, "pom.xml" );
@@ -110,11 +110,11 @@
 
         if ( creationResult.getCause() != null )
         {
-            fail( creationResult.getCause().getMessage() );
+            throw creationResult.getCause();
         }
 
         // (3) create our own archetype catalog properties in memory
-        File catalogDirectory = new File( getBasedir(), "target"+File.separator+"catalog" );
+        File catalogDirectory = new File( getBasedir(), "target" + File.separator + "catalog" );
 
         File catalogFile = new File( catalogDirectory, "archetype-catalog.xml" );
 
@@ -130,34 +130,35 @@
         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 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 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" );
+        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();
+        Archetype generatedArchetype = new Archetype();
         generatedArchetype.setGroupId( generatedArchetypeProject.getGroupId() );
         generatedArchetype.setArtifactId( generatedArchetypeProject.getArtifactId() );
         generatedArchetype.setVersion( generatedArchetypeProject.getVersion() );
@@ -170,12 +171,13 @@
         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-2-recreatedproject" ).getAbsolutePath();
-        FileUtils.forceDelete(outputDirectory);
+        String outputDirectory =
+            new File( getBasedir(), "target" + File.separator + "test-classes" + File.separator + "projects"
+                + File.separator + "roundtrip-2-recreatedproject" ).getAbsolutePath();
+        FileUtils.forceDelete( outputDirectory );
 
-        WagonManager manager = (WagonManager) lookup(WagonManager.class.getName());
-        manager.addProxy("http", "localhost", 18882, null, null, null);
+        WagonManager manager = (WagonManager) lookup( WagonManager.class.getName() );
+        manager.addProxy( "http", "localhost", 18882, null, null, null );
 
         ArchetypeGenerationRequest agr =
             new ArchetypeGenerationRequest().setArchetypeGroupId(
@@ -189,7 +191,7 @@
 
         if ( generationResult.getCause() != null )
         {
-            fail( generationResult.getCause().getMessage() );
+            throw generationResult.getCause();
         }
 
     }
@@ -221,8 +223,8 @@
         deployer.deploy( war,
             new URLDeployableMonitor( new URL( "http://localhost:18882/dummy" ) ) );
         deployer.start( war );
-        
-        
+
+
         Jetty6xEmbeddedStandaloneLocalConfiguration configuration2 =
             new Jetty6xEmbeddedStandaloneLocalConfiguration( "target/repository-webapp" );
         configuration2.setProperty( ServletPropertySet.PORT, "18881" );
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerification.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerification.java
index ca857b1..f54235d 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerification.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerification.java
@@ -23,9 +23,10 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
@@ -37,22 +38,22 @@
  * @author rafale
  */
 public class InternalCatalogArchetypesVerification
-        extends PlexusTestCase {
+    extends PlexusTestCase
+{
 
     public void testInternalCatalog()
-            throws Exception {
-        ArchetypeRegistryManager registryManager = (ArchetypeRegistryManager) lookup(ArchetypeRegistryManager.ROLE);
+        throws Exception
+    {
+        ArchetypeRegistryManager registryManager = (ArchetypeRegistryManager) lookup( ArchetypeRegistryManager.ROLE );
 
-        ArtifactRepository localRepository = registryManager.createRepository(new File(getBasedir(),
-                "target/test-classes/repositories/local").toURI().
-                toURL().
-                toExternalForm(),
+        ArtifactRepository localRepository = registryManager.createRepository( new File( getBasedir(),
+                "target/test-classes/repositories/local" ).toURI().toURL().toExternalForm(),
                 "local-repo");
 
-        File outputDirectory = new File(getBasedir(), "target/internal-archetypes-projects");
+        File outputDirectory = new File( getBasedir(), "target/internal-archetypes-projects" );
         outputDirectory.mkdirs();
 
-        Archetype archetype = (Archetype) lookup(Archetype.class.getName());
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.class.getName() );
 
         ArchetypeCatalog result = archetype.getInternalCatalog();
 
@@ -60,45 +61,67 @@
         List archetypesRemoved = new ArrayList();
         Iterator archetypes = result.getArchetypes().iterator();
         int count = 1;
-        while (archetypes.hasNext()) {
-            org.apache.maven.archetype.catalog.Archetype a = (org.apache.maven.archetype.catalog.Archetype) archetypes.next();
-            org.apache.maven.archetype.catalog.Archetype ar = new org.apache.maven.archetype.catalog.Archetype();
+        while ( archetypes.hasNext() )
+        {
+            Archetype a = (Archetype) archetypes.next();
+            Archetype ar = new Archetype();
 
-            ar.setGroupId(a.getGroupId());
-            ar.setArtifactId(a.getArtifactId());
-            ar.setVersion("RELEASE");
-            ar.setDescription(a.getDescription());
-            ar.setGoals(a.getGoals());
-            ar.setProperties(a.getProperties());
-            ar.setRepository(a.getRepository());
-            if (ar.getRepository() == null) {
-                ar.setRepository("http://repo1.maven.org/maven2");
+            ar.setGroupId( a.getGroupId() );
+            ar.setArtifactId( a.getArtifactId() );
+            ar.setVersion( "RELEASE" );
+            ar.setDescription( a.getDescription() );
+            ar.setGoals( a.getGoals() );
+            ar.setProperties( a.getProperties() );
+            ar.setRepository( a.getRepository() );
+            if ( ar.getRepository() == null )
+            {
+                ar.setRepository( "http://repo1.maven.org/maven2" );
             }
-            System.err.println("\n\n\n\n\n\nTesting archetype " + ar);
-            ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(ar).setGroupId("groupId" + count).setArtifactId("artifactId" + count).setVersion("version" + count).setPackage("package" + count).setOutputDirectory(outputDirectory.getPath()).setLocalRepository(localRepository);
-            ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype(request);
-            if (generationResult != null && generationResult.getCause() != null) {
-                ar.setVersion(a.getVersion());
-                request = new ArchetypeGenerationRequest(ar).setGroupId("groupId" + count).setArtifactId("artifactId" + count).setVersion("version" + count).setPackage("package" + count).setOutputDirectory(outputDirectory.getPath()).setLocalRepository(localRepository);
-                generationResult = archetype.generateProjectFromArchetype(request);
-                if (generationResult != null && generationResult.getCause() != null) {
-                    archetypesRemoved.add(a);
-                } else {
-                    archetypesUsed.add(a);
+            System.err.println( "\n\n\n\n\n\nTesting archetype " + ar );
+            ArchetypeGenerationRequest request =
+                new ArchetypeGenerationRequest( ar )
+                .setGroupId( "groupId" + count )
+                .setArtifactId( "artifactId" + count )
+                .setVersion( "version" + count )
+                .setPackage( "package" + count )
+                .setOutputDirectory( outputDirectory.getPath() )
+                .setLocalRepository( localRepository );
+            ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( request );
+            if ( generationResult != null && generationResult.getCause() != null )
+            {
+                ar.setVersion( a.getVersion() );
+                request =
+                    new ArchetypeGenerationRequest( ar )
+                    .setGroupId( "groupId" + count )
+                    .setArtifactId( "artifactId" + count )
+                    .setVersion( "version" + count )
+                    .setPackage( "package" + count )
+                    .setOutputDirectory( outputDirectory.getPath() )
+                    .setLocalRepository( localRepository );
+                generationResult = archetype.generateProjectFromArchetype( request );
+                if ( generationResult != null && generationResult.getCause() != null )
+                {
+                    archetypesRemoved.add( a );
                 }
-            } else {
-                archetypesUsed.add(a);
+                else
+                {
+                    archetypesUsed.add( a );
+                }
+            }
+            else
+            {
+                archetypesUsed.add( a );
             }
             count++;
-            System.err.println("\n\n\n\n\n");
+            System.err.println( "\n\n\n\n\n" );
         }
-        result.setArchetypes(archetypesUsed);
+        result.setArchetypes( archetypesUsed );
 
         StringWriter sw = new StringWriter();
         ArchetypeCatalogXpp3Writer acxw = new ArchetypeCatalogXpp3Writer();
-        acxw.write(sw, result);
+        acxw.write( sw, result );
 
-        System.err.println("Resulting catalog is\n" + sw.toString());
-        System.err.println("Removed archetypes are \n" + archetypesRemoved);
+        System.err.println( "Resulting catalog is\n" + sw.toString() );
+        System.err.println( "Removed archetypes are \n" + archetypesRemoved );
     }
 }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogFromWiki.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogFromWiki.java
index 95e1a55..0eb795c 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogFromWiki.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogFromWiki.java
@@ -1,12 +1,14 @@
+package org.apache.maven.archetype.test;
+
 /*
  *  Copyright 2008 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.
@@ -14,172 +16,279 @@
  *  limitations under the License.
  *  under the License.
  */
-package org.apache.maven.archetype.test;
 
-import java.io.File;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.exception.UnknownArchetype;
 import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
 import org.apache.maven.archetype.metadata.RequiredProperty;
 import org.apache.maven.archetype.source.ArchetypeDataSource;
+import org.apache.maven.archetype.source.ArchetypeDataSourceException;
+import org.apache.maven.archetype.source.WikiArchetypeDataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.WriterFactory;
+
+import java.io.File;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
 
 /**
+ * Generate catalog content from Wiki to replace internal catalog.
  *
  * @author rafale
  */
 public class InternalCatalogFromWiki
-        extends PlexusTestCase {
+    extends PlexusTestCase
+{
+    private static final String CENTRAL = "http://repo1.maven.org/maven2";
 
-    public void testInternalCatalog()
-            throws Exception {
-        ArchetypeRegistryManager registryManager = (ArchetypeRegistryManager) lookup(ArchetypeRegistryManager.ROLE);
+    private ArtifactRepository localRepository;
 
-        ArtifactRepository localRepository = registryManager.createRepository(new File(getBasedir(),
-                "target/test-classes/repositories/local").toURI().
-                toURL().
-                toExternalForm(),
-                "local-repo");
+    private ArchetypeArtifactManager aam;
 
-        File outputDirectory = new File(getBasedir(), "target/internal-archetypes-projects");
-        outputDirectory.mkdirs();
+    private ArchetypeRegistryManager arm;
 
-        org.apache.maven.archetype.Archetype plexusarchetype = (org.apache.maven.archetype.Archetype) lookup(org.apache.maven.archetype.Archetype.class.getName());
-        ArchetypeArtifactManager aam = (ArchetypeArtifactManager) lookup(ArchetypeArtifactManager.class.getName());
-        ArchetypeRegistryManager arm = (ArchetypeRegistryManager) lookup(ArchetypeRegistryManager.class.getName());
+    private ArchetypeManager plexusarchetype;
 
+    private File outputDirectory;
 
-//        ArchetypeDataSource ads =  (ArchetypeDataSource) lookup( ArchetypeDataSource.ROLE, "wiki" );
+    private ArchetypeCatalog fetchArchetypeCatalogFromWiki()
+        throws ArchetypeDataSourceException
+    {
+        // ArchetypeDataSource ads =  (ArchetypeDataSource) lookup( ArchetypeDataSource.ROLE, "wiki" );
         ArchetypeDataSource ads = new WikiArchetypeDataSource();
 
-        ArchetypeCatalog ac = ads.getArchetypeCatalog(new Properties());
-        List modifiedArchetypes = new ArrayList();
-        Iterator archetypes = ac.getArchetypes().iterator();
-        while (archetypes.hasNext()) {
+        // fetch and parse Wiki page content
+        ArchetypeCatalog ac = ads.getArchetypeCatalog( new Properties() );
+
+        for ( Iterator archetypes = ac.getArchetypes().iterator(); archetypes.hasNext(); )
+        {
             Archetype archetype = (Archetype) archetypes.next();
-            if (archetype.getRepository() != null &&
-                    archetype.getRepository().indexOf("repo1.apache.org/maven2") >= 0) {
-                archetype.setRepository(null);
+
+            if ( "".equals( archetype.getRepository() )
+                || ( archetype.getRepository() != null && archetype.getRepository().indexOf( CENTRAL.substring( 7 ) ) >= 0 ) )
+            {
+                archetype.setRepository( null );
             }
-            modifiedArchetypes.add(archetype);
         }
-        ac.setArchetypes(modifiedArchetypes);
 
-        System.out.println("AR=" + ac.getArchetypes());
+        System.out.println( "found " + ac.getArchetypes().size() + " archetypes on http://docs.codehaus.org/display/MAVENUSER/Archetypes+List" );
 
-        StringWriter sw = new StringWriter();
+        for ( Iterator archetypes = ac.getArchetypes().iterator(); archetypes.hasNext(); )
+        {
+            Archetype archetype = (Archetype) archetypes.next();
+            System.out.println( "  " + archetype );
+        }
 
-        ArchetypeCatalogXpp3Writer acxw = new ArchetypeCatalogXpp3Writer();
-        acxw.write(sw, ac);
+        return ac;
+    }
 
-        System.out.println("AC=" + sw.toString());
+    private ArchetypeGenerationResult testArchetype( int count, Archetype archetype )
+        throws UnknownArchetype
+    {
+        System.out.println( "\n\nTesting archetype #" + count + ": " + archetype );
 
+        ArchetypeGenerationRequest request =
+            new ArchetypeGenerationRequest( archetype )
+            .setGroupId( "groupId" + count )
+            .setArtifactId( "artifactId" + count + "-" + archetype.getArtifactId() )
+            .setVersion( "version" + count )
+            .setPackage( "package" + count )
+            .setOutputDirectory( outputDirectory.getPath() )
+            .setLocalRepository( localRepository );
 
+        Properties properties = new Properties();
 
-        List archetypesUsed = new ArrayList();
-        List archetypesRemoved = new ArrayList();
-        archetypes = ac.getArchetypes().iterator();
+        ArtifactRepository repository =
+            arm.createRepository( archetype.getRepository(), archetype.getRepository() + "-repo" );
+
+        if ( aam.isFileSetArchetype( archetype.getGroupId(), archetype.getArtifactId(), archetype.getVersion(),
+                                     repository, localRepository, new ArrayList( /* repositories */) ) )
+        {
+            ArchetypeDescriptor descriptor =
+                aam.getFileSetArchetypeDescriptor( archetype.getGroupId(), archetype.getArtifactId(),
+                                                   archetype.getVersion(), repository, localRepository,
+                                                   new ArrayList( /* repositories */) );
+
+            for ( Iterator required = descriptor.getRequiredProperties().iterator(); required.hasNext(); )
+            {
+                RequiredProperty prop = (RequiredProperty) required.next();
+
+                properties.setProperty( prop.getKey(), prop.getDefaultValue() != null
+                    && !"".equals( prop.getDefaultValue() ) ? prop.getDefaultValue() : "test-value" );
+            }
+
+        }
+        request.setProperties( properties );
+
+        return plexusarchetype.generateProjectFromArchetype( request );
+    }
+
+    public void testInternalCatalog()
+        throws Exception
+    {
+        ArchetypeCatalog ac = fetchArchetypeCatalogFromWiki();
+
+        System.out.println( "Testing archetypes to " + outputDirectory.getPath() );
+
+        List validArchetypes = new ArrayList();
+
         int count = 1;
 
-        while (archetypes.hasNext()) {
-            org.apache.maven.archetype.catalog.Archetype a = (org.apache.maven.archetype.catalog.Archetype) archetypes.next();
-            org.apache.maven.archetype.catalog.Archetype ar = new org.apache.maven.archetype.catalog.Archetype();
+        List errors = new ArrayList();
+        List warnings = new ArrayList();
 
-            ar.setGroupId(a.getGroupId());
-            ar.setArtifactId(a.getArtifactId());
-            ar.setVersion("RELEASE");
-            ar.setDescription(a.getDescription());
-            ar.setGoals(a.getGoals());
-            ar.setProperties(a.getProperties());
-            ar.setRepository(a.getRepository());
+        for ( Iterator archetypes = ac.getArchetypes().iterator(); archetypes.hasNext(); )
+        {
+            Archetype a = (Archetype) archetypes.next();
+            Archetype ar = new Archetype();
 
-            if (ar.getRepository() == null) {
-                ar.setRepository("http://repo1.maven.org/maven2");
+            ar.setGroupId( a.getGroupId() );
+            ar.setArtifactId( a.getArtifactId() );
+            ar.setVersion( "RELEASE" );
+            ar.setDescription( a.getDescription() );
+            ar.setGoals( a.getGoals() );
+            ar.setProperties( a.getProperties() );
+            ar.setRepository( a.getRepository() );
+
+            if ( ar.getRepository() == null )
+            {
+                ar.setRepository( CENTRAL );
             }
-            System.err.println("\n\n\n\n\n\nTesting archetype " + ar);
-            ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(ar).setGroupId("groupId" + count).setArtifactId("artifactId" + count).setVersion("version" + count).setPackage("package" + count).setOutputDirectory(outputDirectory.getPath()).setLocalRepository(localRepository);
 
-            Properties properties = new Properties();
-            if (aam.isFileSetArchetype(a.getGroupId(), a.getArtifactId(), "RELEASE", arm.createRepository(
-                    a.getRepository(),
-                    a.getRepository() + "-repo"), localRepository, new ArrayList( /*repositories*/))) {
-                ArchetypeDescriptor descriptor = aam.getFileSetArchetypeDescriptor(a.getGroupId(), a.getArtifactId(), "RELEASE", arm.createRepository(
-                        a.getRepository(),
-                        a.getRepository() + "-repo"), localRepository, new ArrayList( /*repositories*/));
+            ArchetypeGenerationResult releaseGenerationResult = testArchetype( count, ar );
 
-                Iterator required = descriptor.getRequiredProperties().iterator();
-                while (required.hasNext()) {
-                    RequiredProperty prop = (RequiredProperty) required.next();
+            if ( releaseGenerationResult.getCause() != null )
+            {
+                // RELEASE version failed: try with the version specified in the Wiki
+                ar.setVersion( a.getVersion() );
 
-                    properties.setProperty(prop.getKey(), prop.getDefaultValue() != null && !"".equals(prop.getDefaultValue()) ? prop.getDefaultValue() : "test-value");
-                }
+                ArchetypeGenerationResult generationResult = testArchetype( count, ar );
 
-            }
-            request.setProperties(properties);
-            ArchetypeGenerationResult generationResult = plexusarchetype.generateProjectFromArchetype(request);
-            if (generationResult != null && generationResult.getCause() != null) {
-                ar.setVersion(a.getVersion());
-                request = new ArchetypeGenerationRequest(ar).setGroupId("groupId" + count).setArtifactId("artifactId" + count).setVersion("version" + count).setPackage("package" + count).setOutputDirectory(outputDirectory.getPath()).setLocalRepository(localRepository);
-                properties = new Properties();
-                if (aam.isFileSetArchetype(a.getGroupId(), a.getArtifactId(), a.getVersion(), arm.createRepository(
-                        a.getRepository(),
-                        a.getRepository() + "-repo"), localRepository, new ArrayList( /*repositories*/))) {
-                    ArchetypeDescriptor descriptor = aam.getFileSetArchetypeDescriptor(a.getGroupId(), a.getArtifactId(), a.getVersion(), arm.createRepository(
-                            a.getRepository(),
-                            a.getRepository() + "-repo"), localRepository, new ArrayList( /*repositories*/));
-
-                    Iterator required = descriptor.getRequiredProperties().iterator();
-                    while (required.hasNext()) {
-                        RequiredProperty prop = (RequiredProperty) required.next();
-
-                        properties.setProperty(prop.getKey(), prop.getDefaultValue() != null && !"".equals(prop.getDefaultValue()) ? prop.getDefaultValue() : "test-value");
-                    }
-
-                }
-                request.setProperties(properties);
-                generationResult = plexusarchetype.generateProjectFromArchetype(request);
-                if (generationResult != null && generationResult.getCause() != null) {
-                    if ("http://repo1.maven.org/maven2".equals(ar.getRepository())) {
-                        ar.setRepository(null);
-                    }
-//                    archetypesRemoved.add(ar);
-                } else {
-                    if ("http://repo1.maven.org/maven2".equals(ar.getRepository())) {
-                        ar.setRepository(null);
-                    }
-                    if( !(ar.getVersion().indexOf("SNAPSHOT") > 0) && !(ar.getVersion().indexOf("snapshot") > 0) )
+                if ( generationResult.getCause() == null )
+                {
+                    if ( !( ar.getVersion().indexOf( "SNAPSHOT" ) > 0 )
+                        && !( ar.getVersion().indexOf( "snapshot" ) > 0 ) )
                     {
-                        archetypesUsed.add(ar);
+                        validArchetypes.add( ar );
+
+                        warnings.add( "#" + count + ' ' + ar + ": error for RELEASE - " + releaseGenerationResult.getCause().getMessage() );
                     }
                 }
-            } else {
-                if ("http://repo1.maven.org/maven2".equals(ar.getRepository())) {
-                    ar.setRepository(null);
+                else
+                {
+                    errors.add( "#" + count + ' ' + ar + ' ' + generationResult.getCause().getMessage() );
                 }
-                archetypesUsed.add(ar);
             }
+            else
+            {
+                validArchetypes.add( ar );
+
+                if ( !"RELEASE".equals( a.getVersion() ) )
+                {
+                    warnings.add( "#" + count + ' ' + ar + ": Wiki page mentions " + a.getVersion() +", should be empty since RELEASE is ok." );
+                }
+            }
+
+            if ( CENTRAL.equals( ar.getRepository() ) )
+            {
+                ar.setRepository( null );
+            }
+
             count++;
-            System.err.println("\n\n\n\n\n");
+
+            System.out.println( "\n\n" );
         }
-        ac = new ArchetypeCatalog();
-        ac.setArchetypes(archetypesUsed);
 
-        sw = new StringWriter();
-        acxw = new ArchetypeCatalogXpp3Writer();
-        acxw.write(sw, ac);
+        ArchetypeCatalog fac = new ArchetypeCatalog();
+        fac.setArchetypes( validArchetypes );
 
-        System.err.println("Resulting catalog is\n" + sw.toString());
-        System.err.println("Removed archetypes are \n" + archetypesRemoved);
+        File catalog = new File( getBasedir(), "target/archetype-catalog.xml" );
+        Writer writer = null;
+
+        try
+        {
+            writer = WriterFactory.newXmlWriter( catalog );
+
+            ArchetypeCatalogXpp3Writer acxw = new ArchetypeCatalogXpp3Writer();
+
+            acxw.write( writer, fac );
+        }
+        finally
+        {
+            IOUtil.close( writer );
+        }
+
+        if ( warnings.size() > 0 )
+        {
+            System.err.println();
+            System.err.println( "Warnings: " );
+            for ( Iterator iterator = warnings.iterator(); iterator.hasNext(); )
+            {
+                System.err.println( "  " + iterator.next() );
+            }
+        }
+
+        System.err.println();
+        System.err.println( "Resulting catalog file: " + catalog );
+
+        System.err.println( "This catalog contains " + fac.getArchetypes().size() + " archetypes." );
+
+        if ( ac.getArchetypes().size() > fac.getArchetypes().size() )
+        {
+            System.err.println();
+            System.err.println( "Removed " + ( ac.getArchetypes().size() - fac.getArchetypes().size() )
+                + " archetype(s) from Wiki page:" );
+
+            List removedArchetypes = new ArrayList( ac.getArchetypes() );
+            removedArchetypes.removeAll( validArchetypes );
+
+            for ( Iterator archetypes = removedArchetypes.iterator(); archetypes.hasNext(); )
+            {
+                Archetype archetype = (Archetype) archetypes.next();
+                System.err.println( "  " + archetype );
+            }
+
+            System.err.println();
+            System.err.println( "Got " + errors.size() + " error message(s): " );
+            for ( Iterator iterator = errors.iterator(); iterator.hasNext(); )
+            {
+                System.err.println( "  " + iterator.next() );
+            }
+        }
+    }
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        ArchetypeRegistryManager registryManager = (ArchetypeRegistryManager) lookup( ArchetypeRegistryManager.ROLE );
+
+        File local = new File( getBasedir(), "target/test-classes/repositories/local" );
+        localRepository = registryManager.createRepository( local.toURI().toURL().toExternalForm(), "local-repo");
+
+        aam = (ArchetypeArtifactManager) lookup( ArchetypeArtifactManager.class.getName() );
+        arm = (ArchetypeRegistryManager) lookup( ArchetypeRegistryManager.class.getName() );
+
+        plexusarchetype =
+            (org.apache.maven.archetype.ArchetypeManager) lookup( org.apache.maven.archetype.ArchetypeManager.class.getName() );
+
+        outputDirectory = new File( getBasedir(), "target/internal-archetypes-projects" );
+        outputDirectory.mkdirs();
+
+        FileUtils.cleanDirectory( outputDirectory );
     }
 }
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java
index a0f6c54..916b4cf 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/RoundtripMultiModuleTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.test;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,15 +18,14 @@
  * 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.ArchetypeManager;
+import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
@@ -65,22 +66,20 @@
         throws Exception
     {
 
-        Archetype archetype = (Archetype) lookup( Archetype.ROLE );
+        ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.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(),
+            "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(),
+            "target" + File.separator + "test-classes" + File.separator + "repositories" + File.separator + "central" )
+            .toURI().toURL().toExternalForm(),
             "central-repo" );
 
         // (1) create a project from scratch
@@ -96,39 +95,38 @@
 //        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" );
-        FileUtils.forceDelete(new File(workingProject, "target"));
+            "target" + File.separator + "test-classes" + File.separator + "projects" + File.separator + "roundtrip-multi" );
+        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 )
+        ArchetypeCreationRequest acr = new ArchetypeCreationRequest()
+            .setProject( project )
+            .setLocalRepository( localRepository )
             .setFiltereds(Constants.DEFAULT_FILTERED_EXTENSIONS)
             .setLanguages(Constants.DEFAULT_LANGUAGES)
-            .setPostPhase( "package" )
-            ;
+            .setPostPhase( "package" );
 
         ArchetypeCreationResult creationResult = archetype.createArchetypeFromProject( acr );
 
         if ( creationResult.getCause() != null )
         {
-            fail( creationResult.getCause().getMessage() );
+            throw creationResult.getCause();
         }
         else
         {
-            assertArchetypeCreated(workingProject);
+            assertArchetypeCreated( workingProject );
         }
 
         // (3) create our own archetype catalog properties in memory
-        File catalogDirectory = new File( getBasedir(), "target"+File.separator+"catalog" );
+        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" );
+        File catalogProperties = new File( catalogDirectory, "archetype-catalog.properties" );
 
         catalogDirectory.mkdirs();
 
@@ -139,34 +137,34 @@
         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 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 );
+        MavenProject generatedArchetypeProject = projectBuilder.build( generatedArchetypePom, localRepository, null );
 
-        File archetypeDirectory = new File( generatedArchetypeDirectory,
-            "src"+File.separator+"main"+File.separator+"resources" );
+        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" );
+        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();
+        Archetype generatedArchetype = new Archetype();
         generatedArchetype.setGroupId( generatedArchetypeProject.getGroupId() );
         generatedArchetype.setArtifactId( generatedArchetypeProject.getArtifactId() );
         generatedArchetype.setVersion( generatedArchetypeProject.getVersion() );
@@ -179,38 +177,45 @@
         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-recreated" ).getAbsolutePath();
+        String outputDirectory =
+            new File( getBasedir(), "target" + File.separator + "test-classes" + File.separator + "projects"
+                + File.separator + "roundtrip-multi-recreated" ).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/" );
+            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() );
         }
-        
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-api", ".classpath").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-cli", ".classpath").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-core", ".classpath").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-model", ".classpath").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-stores" + File.separator + "myapp-store-memory", ".classpath").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-stores" + File.separator + "myapp-store-xstream", ".classpath").exists());
 
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-api", ".checkstyle").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-cli", ".checkstyle").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-core", ".checkstyle").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-model", ".checkstyle").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-stores" + File.separator + "myapp-store-memory", ".checkstyle").exists());
-        assertTrue(new File(outputDirectory + File.separator + "myapp" + File.separator + "myapp-stores" + File.separator + "myapp-store-xstream", ".checkstyle").exists());
+        String myapp = outputDirectory + File.separator + "myapp" + File.separator;
+        assertTrue( new File( myapp + "myapp-api", ".classpath" ).exists() );
+        assertTrue( new File( myapp + "myapp-cli", ".classpath" ).exists() );
+        assertTrue( new File( myapp + "myapp-core", ".classpath" ).exists() );
+        assertTrue( new File( myapp + "myapp-model", ".classpath" ).exists() );
+        assertTrue( new File( myapp + File.separator + "myapp-stores" + File.separator + "myapp-store-memory",
+                              ".classpath" ).exists() );
+        assertTrue( new File( myapp + "myapp-stores" + File.separator + "myapp-store-xstream", ".classpath" ).exists() );
+
+        assertTrue( new File( myapp + "myapp-api", ".checkstyle" ).exists() );
+        assertTrue( new File( myapp + "myapp-cli", ".checkstyle" ).exists() );
+        assertTrue( new File( myapp + "myapp-core", ".checkstyle" ).exists() );
+        assertTrue( new File( myapp + "myapp-model", ".checkstyle" ).exists() );
+        assertTrue( new File( myapp + "myapp-stores" + File.separator + "myapp-store-memory", ".checkstyle" ).exists() );
+        assertTrue( new File( myapp + "myapp-stores" + File.separator + "myapp-store-xstream", ".checkstyle" ).exists() );
 
     }
 
@@ -253,54 +258,63 @@
         jettyContainer.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())
+    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"));
-        
+            File f = (File) i.next();
+            System.err.println( f.getPath() );
+        }
+
+        File api = FileUtils.resolveFile( archetypeResourcesDirectory, "__rootArtifactId__-api" );
+        assertExistDirectory( api );
+        assertExistFile( FileUtils.resolveFile( api, "pom.xml" ) );
+
+        File cli = FileUtils.resolveFile( archetypeResourcesDirectory, "__rootArtifactId__-cli" );
+        assertExistDirectory( cli );
+        assertExistFile( FileUtils.resolveFile( cli, "pom.xml" ) );
+
+        File core = FileUtils.resolveFile( archetypeResourcesDirectory, "__rootArtifactId__-core" );
+        assertExistDirectory( core );
+        assertExistFile( FileUtils.resolveFile( core, "pom.xml" ) );
+
+        File model = FileUtils.resolveFile( archetypeResourcesDirectory, "__rootArtifactId__-model" );
+        assertExistDirectory( model );
+        assertExistFile( FileUtils.resolveFile( model, "pom.xml" ) );
+
+        File stores = FileUtils.resolveFile( archetypeResourcesDirectory, "__rootArtifactId__-stores" );
+        assertExistDirectory( stores );
+        assertExistFile( FileUtils.resolveFile( stores, "pom.xml" ) );
+        assertExistDirectory( FileUtils.resolveFile( stores, "__rootArtifactId__-store-memory" ) );
+        assertExistFile( FileUtils.resolveFile( FileUtils.resolveFile( stores, "__rootArtifactId__-store-memory" ),
+                                                "pom.xml" ) );
+        assertExistDirectory( FileUtils.resolveFile( stores, "__rootArtifactId__-store-xstream" ) );
+        assertExistFile( FileUtils.resolveFile( FileUtils.resolveFile( stores, "__rootArtifactId__-store-xstream" ),
+                                                "pom.xml" ) );
+        assertExistFile( FileUtils.resolveFile( archetypeResourcesDirectory, "pom.xml" ) );
+
+        assertExistDirectory( archetypeMetadataDirectory );
+        assertExistFile( FileUtils.resolveFile( archetypeMetadataDirectory, "archetype-metadata.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 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());
+    private void assertExistFile( File resolveFile )
+    {
+        assertTrue( "resolveFile " + resolveFile + " !exists", resolveFile.exists() );
+        assertTrue( "resolveFile " + resolveFile + " !isFile", resolveFile.isFile() );
     }
 }
diff --git a/archetype-common/src/test/resources/projects/create-1/pom.xml.sample b/archetype-common/src/test/resources/projects/create-1/pom.xml.sample
index 17d55b9..0fa55d5 100644
--- a/archetype-common/src/test/resources/projects/create-1/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/create-1/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/create-2/pom.xml.sample b/archetype-common/src/test/resources/projects/create-2/pom.xml.sample
index 23bd2f2..afdcb33 100644
--- a/archetype-common/src/test/resources/projects/create-2/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/create-2/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/create-3/pom.xml.sample b/archetype-common/src/test/resources/projects/create-3/pom.xml.sample
index 108787c..bad174b 100644
--- a/archetype-common/src/test/resources/projects/create-3/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/create-3/pom.xml.sample
@@ -17,7 +17,7 @@
   ~ 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">
+<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/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.maven.archetype.test</groupId>
     <artifactId>test-create-3</artifactId>
diff --git a/archetype-common/src/test/resources/projects/generate-5/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-5/pom.xml.sample
index 5d19540..a5a8b4b 100644
--- a/archetype-common/src/test/resources/projects/generate-5/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-5/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/generate-7/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-7/pom.xml.sample
index f4146ea..6f3b39d 100644
--- a/archetype-common/src/test/resources/projects/generate-7/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-7/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/generate-8/file-value/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-8/file-value/pom.xml.sample
index fcdbbee..cba72c9 100644
--- a/archetype-common/src/test/resources/projects/generate-8/file-value/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-8/file-value/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/generate-8/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-8/pom.xml.sample
index f517c03..a3f5fa3 100644
--- a/archetype-common/src/test/resources/projects/generate-8/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-8/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/generate-9/file-value/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-9/file-value/pom.xml.sample
index 1eccdd9..7d07d2c 100644
--- a/archetype-common/src/test/resources/projects/generate-9/file-value/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-9/file-value/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/projects/generate-9/pom.xml.sample b/archetype-common/src/test/resources/projects/generate-9/pom.xml.sample
index 72f685e..031618b 100644
--- a/archetype-common/src/test/resources/projects/generate-9/pom.xml.sample
+++ b/archetype-common/src/test/resources/projects/generate-9/pom.xml.sample
@@ -20,7 +20,7 @@
 <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">
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetype-common/src/test/resources/wiki/wiki-source.txt b/archetype-common/src/test/resources/wiki/wiki-source.txt
new file mode 100644
index 0000000..d1fa6b2
--- /dev/null
+++ b/archetype-common/src/test/resources/wiki/wiki-source.txt
@@ -0,0 +1,91 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+    <title>View Source - Codehaus</title>
+
+
+    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+    <META HTTP-EQUIV="Expires" CONTENT="-1">
+    <script language="javascript">
+        var contextPath = '';
+        var i18n = [];
+    </script>
+
+                            <link rel="stylesheet" href="/s/811/1/3/_/styles/main-action.css" type="text/css" />
+
+            <meta name="robots" content="noindex,nofollow">
+        <meta name="robots" content="noarchive">
+        <link rel="shortcut icon" href="/images/icons/favicon.ico">
+    <link rel="icon" type="image/png" href="/images/icons/favicon.png">
+
+            <script type="text/javascript" src="/s/811/1/_/decorators/effects.js"></script>
+
+
+
+
+</head>
+<body onload="placeFocus()">
+
+<div id="PageContent">
+    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%">
+        <tr>
+            <td valign="top" class="pagebody">
+                <div class="pageheader">
+                    <span class="pagetitle">View Source</span>
+                </div>
+
+                <div class="monospaceInput"><div class="padded">
+        This page will hold the complete list of archetype (even not hosted at apache).
+<br>
+<br>Each archetype page should enforce the following pattern :
+<br>* Archetype name
+<br>* Command line to call the archetype
+<br>* If the archetype can be used in an existing projects directory
+<br>* A tree view of the resulting files
+<br>* Some additional information like the additional properties used by the plugin
+<br>
+<br>To use an archetype:
+<br>{code}
+<br>mvn archetype:create -DgroupId=&lt;your group&gt; -DartifactId=&lt;your artifact&gt; -DarchetypeArtifactId=&lt;wanted artifact&gt; -DarchetypeGroupId=&lt;wanted artifact group&gt;
+<br>{code}
+<br>Read more [here|http://maven.apache.org/plugins/maven-archetype-plugin/usage.html].
+<br>
+<br>h3. Quick Reference
+<br>
+<br>A quick reference of available archetypes and their repositories.  This list is designed so it can be automatically retrieved from archetype front-ends such as Archy - [http://code.google.com/p/archy].  Only archetypes that don&#39;t have any &quot;released&quot; artifacts need a version number.
+<br>|| Artifact || Group || Version || Repository || Description ||
+<br>| appfuse-basic-jsf | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and JSF |
+<br>| maven-archetype-profiles | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
+<br>| struts2-archetype-starter | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A starter Struts 2 application with Sitemesh, DWR, and Spring |
+<br>| maven-archetype-har | net.sf.maven-har | 0.9 | | [Hibernate|http://hibernate.org] Archive |
+<br>| maven-archetype-archetype | org.apache.maven.archetypes | | | |
+<br>
+<br>h3. Additional Information
+<br>
+<br>* There is a maven-archetypes project on java.net:
+<br>** [https://maven-archetypes.dev.java.net/]
+<br>** [https://maven-archetypes.dev.java.net/source/browse/maven-archetypes/trunk/archetypes/org/jvnet/archetypes/]
+<br>
+<br>* Webtide has some archetypes available for download and installation locally.  (Not in a public repository as far as I know.)
+<br>** [http://www.webtide.com/resources.jsp]
+<br>
+<br>* A SEAM archetype is available from Lunar Logic
+<br>** [http://www.nabble.com/Announcement%3A-Seam-Archetype-t2735410s177.html]
+<br>** [http://www.lunarlogic.com/blog/show/maven_archetype_for_jboss_seam]
+<br>* JSF archetypes from SoftEU
+<br>** [http://software.softeu.cz/archetypes/jsf/] JSF+Facelets
+<br>** [http://software.softeu.cz/archetypes/seam/] JSF+Facelets+Seam ([http://software.softeu.cz/seam/] Maven Seam integration)
+<br>** [http://software.softeu.cz/archetypes/seam-simple/] JSF+Facelets+Seam (no hibernate)
+    </div></div>
+            </td>
+        </tr>
+    </table>
+</div>
+
+  	                                                    <div class="license license-nonprofit">
+                    Site powered by a free <b>Open Source Project / Non-profit License</b> (<a href="http://www.atlassian.com">more</a>) of <b><a href="/c/conf/10138">Confluence - the Enterprise wiki</a>.<br/> <a href="http://www.atlassian.com">Learn more</a> or <a href="/c/conf/10137">evaluate Confluence for your organisation</a>.
+                    </div>
+                                            <div class="bottomshadow"></div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/archetype-common/src/test/sources/wiki/wiki-source.txt b/archetype-common/src/test/sources/wiki/wiki-source.txt
deleted file mode 100644
index 764f3c6..0000000
--- a/archetype-common/src/test/sources/wiki/wiki-source.txt
+++ /dev/null
@@ -1,123 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-    <title>View Source - Codehaus</title>
-
-        
-    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-    <META HTTP-EQUIV="Expires" CONTENT="-1">
-    <script language="javascript">
-        var contextPath = '';
-        var i18n = [];
-    </script>
-
-                            <link rel="stylesheet" href="/s/811/1/3/_/styles/main-action.css" type="text/css" />
-            
-            <meta name="robots" content="noindex,nofollow">
-        <meta name="robots" content="noarchive">
-        <link rel="shortcut icon" href="/images/icons/favicon.ico">
-    <link rel="icon" type="image/png" href="/images/icons/favicon.png">
-        
-            <script type="text/javascript" src="/s/811/1/_/decorators/effects.js"></script>
-    
-
-        
-
-</head>
-<body onload="placeFocus()">
-
-<div id="PageContent">
-    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%">
-        <tr>
-            <td valign="top" class="pagebody">
-                <div class="pageheader">
-                    <span class="pagetitle">View Source</span>
-                </div>
-
-                <div class="monospaceInput"><div class="padded">
-        This page will hold the complete list of archetype (even not hosted at apache).
-<br>
-<br>Each archetype page should enforce the following pattern :
-<br>* Archetype name
-<br>* Command line to call the archetype
-<br>* If the archetype can be used in an existing projects directory
-<br>* A tree view of the resulting files
-<br>* Some additional information like the additional properties used by the plugin
-<br>
-<br>To use an archetype:
-<br>{code}
-<br>mvn archetype:create -DgroupId=&lt;your group&gt; -DartifactId=&lt;your artifact&gt; -DarchetypeArtifactId=&lt;wanted artifact&gt; -DarchetypeGroupId=&lt;wanted artifact group&gt;
-<br>{code}
-<br>Read more [here|http://maven.apache.org/plugins/maven-archetype-plugin/usage.html].
-<br>
-<br>h3. Quick Reference
-<br>
-<br>A quick reference of available archetypes and their repositories.  This list is designed so it can be automatically retrieved from archetype front-ends such as Archy - [http://code.google.com/p/archy].  Only archetypes that don&#39;t have any &quot;released&quot; artifacts need a version number.
-<br>|| Artifact || Group || Version || Repository || Description ||
-<br>| appfuse-basic-jsf | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and JSF |
-<br>| appfuse-basic-spring | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC |
-<br>| appfuse-basic-struts | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2 |
-<br>| appfuse-basic-tapestry | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4 |
-<br>| appfuse-core | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a jar application with Hibernate and Spring and XFire |
-<br>| appfuse-modular-jsf | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and JSF |
-<br>| appfuse-modular-spring | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC |
-<br>| appfuse-modular-struts | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2 |
-<br>| appfuse-modular-tapestry | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4 |
-<br>| maven-archetype-j2ee-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple J2EE Java application |
-<br>| maven-archetype-marmalade-mojo | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A Maven plugin development project using marmalade |
-<br>| maven-archetype-mojo | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A Maven Java plugin development project |
-<br>| maven-archetype-portlet | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple portlet application |
-<br>| maven-archetype-profiles | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-quickstart | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-site-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple site generation project |
-<br>| maven-archetype-site | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A more complex site project |
-<br>| maven-archetype-webapp | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple Java web application |
-<br>| struts2-archetype-starter | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A starter Struts 2 application with Sitemesh, DWR, and Spring |
-<br>| struts2-archetype-blank | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A minimal Struts 2 application |
-<br>| struts2-archetype-portlet | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A minimal Struts 2 application that can be deployed as a portlet |
-<br>| struts2-archetype-dbportlet | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A starter Struts 2 portlet that demonstrates a simple CRUD interface with db backing |
-<br>| struts2-archetype-plugin | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A Struts 2 plugin |
-<br>| shale-archetype-blank | org.apache.shale | 1.0.3-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A blank Shale web application with JSF |
-<br>| maven-adf-archetype | org.apache.myfaces.adfbuild | 1.0-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | Archetype to ease the burden of creating a new application based with ADF |
-<br>| data-app | net.databinder | 0.4 | [http://repo1.maven.org/maven2] | A new Databinder application with sources and resources. |
-<br>| jini-service-archetype | org.jini.maven-jini-plugin | 2.0 | [http://repo1.maven.org/maven2] | Archetype for Jini service project creation |
-<br>| softeu-archetype-seam | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets+Seam Archetype |
-<br>| softeu-archetype-seam-simple | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets+Seam (no persistence) Archetype |
-<br>| softeu-archetype-jsf | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets Archetype |
-<br>| jpa-maven-archetype | com.rfc.maven.archetypes | | [http://maven.rodcoffin.com/repo] | JPA application |
-<br>| spring-osgi-bundle-archetype | org.springframework.osgi | 1.0-m3-SNAPSHOT | [http://static.springframework.org/maven2-snapshots] | Spring-OSGi archetype |
-<br>| confluence-plugin-archetype | com.atlassian.maven.archetypes | | [http://repository.atlassian.com/maven2] | Atlassian Confluence plugin archetype |
-<br>| maven-archetype-har | net.sf.maven-har | 0.9 | [http://repo1.maven.org/maven2] | Hibernate Archive |
-<br>| maven-archetype-sar | net.sf.maven-sar | 0.9 | [http://repo1.maven.org/maven2] | JBoss Service Archive |
-<br>| wicket-archetype-quickstart | org.apache.wicket | 1.3.0-beta3 | [http://repo1.maven.org/maven2] | A simple Apache Wicket project |
-<br>
-<br>h3. Additional Information
-<br>
-<br>* There is a maven-archetypes project on java.net:
-<br>** [https://maven-archetypes.dev.java.net/]
-<br>** [https://maven-archetypes.dev.java.net/source/browse/maven-archetypes/trunk/archetypes/org/jvnet/archetypes/]
-<br>
-<br>* Webtide has some archetypes available for download and installation locally.  (Not in a public repository as far as I know.)
-<br>** [http://www.webtide.com/resources.jsp]
-<br>
-<br>* A SEAM archetype is available from Lunar Logic
-<br>** [http://www.nabble.com/Announcement%3A-Seam-Archetype-t2735410s177.html]
-<br>** [http://www.lunarlogic.com/blog/show/maven_archetype_for_jboss_seam]
-<br>* JSF archetypes from SoftEU
-<br>** [http://software.softeu.cz/archetypes/jsf/] JSF+Facelets
-<br>** [http://software.softeu.cz/archetypes/seam/] JSF+Facelets+Seam ([http://software.softeu.cz/seam/] Maven Seam integration)
-<br>** [http://software.softeu.cz/archetypes/seam-simple/] JSF+Facelets+Seam (no hibernate)
-    </div></div>
-            </td>
-        </tr>
-    </table>
-</div>
-
-  	                                                    <div class="license license-nonprofit">
-                    Site powered by a free <b>Open Source Project / Non-profit License</b> (<a href="http://www.atlassian.com">more</a>) of <b><a href="/c/conf/10138">Confluence - the Enterprise wiki</a>.<br/> <a href="http://www.atlassian.com">Learn more</a> or <a href="/c/conf/10137">evaluate Confluence for your organisation</a>.
-                    </div>
-                                            <div class="bottomshadow"></div>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/archetype-packaging/pom.xml b/archetype-packaging/pom.xml
index ffe963b..2807b69 100644
--- a/archetype-packaging/pom.xml
+++ b/archetype-packaging/pom.xml
@@ -1,5 +1,25 @@
-<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/xsd/maven-4.0.0.xsd">
+<?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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -11,6 +31,7 @@
   <artifactId>archetype-packaging</artifactId>
 
   <name>Maven Archetype Packaging</name>
+  <description>'maven-archetype' packaging configuration for archetypes.</description>
 
   <dependencies>
     <dependency>
diff --git a/archetype-packaging/src/site/site.xml b/archetype-packaging/src/site/site.xml
new file mode 100644
index 0000000..d8fdce1
--- /dev/null
+++ b/archetype-packaging/src/site/site.xml
@@ -0,0 +1,28 @@
+<?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/DECORATION/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" inherit="top" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/archetype-plugin/pom.xml b/archetype-plugin/pom.xml
index 4f93ce5..7002810 100644
--- a/archetype-plugin/pom.xml
+++ b/archetype-plugin/pom.xml
@@ -1,4 +1,24 @@
 <?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/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
@@ -16,27 +36,18 @@
   -->
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-archetype-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
 
   <name>Maven Archetype Plugin</name>
-  <url>http://maven.apache.org/plugins/maven-archetype-plugin</url>
-  <packaging>maven-plugin</packaging>
 
   <prerequisites>
     <maven>2.0.7</maven>
   </prerequisites>
 
-  <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5/archetype-plugin</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5/archetype-plugin</developerConnection>
-    <url>http://svn.apache.org/viewvc/maven/archetype/tags/maven-archetype-2.0-alpha-5/archetype-plugin</url>
-  </scm>
-
-
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.archetype</groupId>
       <artifactId>archetype-common</artifactId>
-      <version>2.0-alpha-5</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -53,7 +64,6 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-invoker</artifactId>
-      <version>2.0.10</version>
     </dependency>
     <dependency>
       <groupId>easymock</groupId>
@@ -64,25 +74,14 @@
     <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
-      <version>3.2.1</version>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-      <version>1.5.8</version>
     </dependency>
   </dependencies>
 
-  <properties>
-      <pluginPluginVersion>2.4.3</pluginPluginVersion>
-  </properties>
-
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plugin-plugin</artifactId>
-        <version>${pluginPluginVersion}</version>
         <configuration>
           <goalPrefix>archetype</goalPrefix>
         </configuration>
@@ -95,12 +94,6 @@
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <artifactId>maven-site-plugin</artifactId>
-        <configuration>
-          <stagingSiteURL>scp://people.apache.org/www/maven.apache.org/plugins/${project.artifactId}-${project.version}</stagingSiteURL>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
@@ -109,7 +102,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plugin-plugin</artifactId>
-        <version>${pluginPluginVersion}</version>
+        <version>2.4.3</version><!-- same version as build plugin -->
         <reportSets>
           <reportSet>
             <reports>
@@ -147,13 +140,4 @@
       </build>
     </profile>
   </profiles>
-
-  <distributionManagement>
-    <site>
-      <id>apache.website</id>
-      <!-- The stage plugin don't propagate correctly the menu item's links -->
-      <!--url>scp://people.apache.org/home/rafale/public_html/site/maven-archetype-plugin</url-->
-      <url>scp://people.apache.org/www/maven.apache.org/plugins/maven-archetype-plugin</url>
-    </site>
-  </distributionManagement>
 </project>
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
index 4c4b328..fdac97d 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
@@ -1,91 +1,84 @@
-/*

- * 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.mojos;

-

-import org.apache.maven.artifact.Artifact;

-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;

-import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;

-import org.apache.maven.artifact.repository.metadata.Versioning;

-import org.apache.maven.plugin.AbstractMojo;

-import org.apache.maven.plugin.MojoExecutionException;

-import org.apache.maven.project.MavenProject;

-

-/**

- * Inject any plugin-specific artifact metadata to the project's artifact, for subsequent

- * installation and deployment. The first use-case for this is to add the LATEST metadata (which is

- * plugin-specific) for shipping alongside the plugin's artifact.

- *

- * @phase package

- * @goal add-archetype-metadata

- */

-public class AddArchetypeMetadataMojo

-    extends AbstractMojo

-{

-    /**

-     * The prefix for the plugin goal.

-     *

-     * @parameter

-     */

-    private String goalPrefix;

-

-    /**

-     * The project artifact, which should have the LATEST metadata added to it.

-     *

-     * @parameter expression="${project}"

-     * @required

-     * @readonly

-     */

-    private MavenProject project;

-

-    public void execute()

-        throws

-        MojoExecutionException

-    {

-        Artifact projectArtifact = project.getArtifact();

-

-        Versioning versioning = new Versioning();

-        versioning.setLatest( projectArtifact.getVersion() );

-        versioning.updateTimestamp();

-

-        ArtifactRepositoryMetadata metadata =

-            new ArtifactRepositoryMetadata( projectArtifact, versioning );

-        projectArtifact.addMetadata( metadata );

-

-        GroupRepositoryMetadata groupMetadata =

-            new GroupRepositoryMetadata( project.getGroupId() );

-        groupMetadata.addPluginMapping(

-            getGoalPrefix(),

-            project.getArtifactId(),

-            project.getName()

-        );

-

-        projectArtifact.addMetadata( groupMetadata );

-    }

-

-    private String getGoalPrefix()

-    {

-        if ( goalPrefix == null )

-        {

-            goalPrefix = project.getArtifactId();

-        }

-

-        return goalPrefix;

-    }

-}

+package org.apache.maven.archetype.mojos;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Inject any plugin-specific artifact metadata to the project's artifact, for subsequent
+ * installation and deployment. The first use-case for this is to add the LATEST metadata (which is
+ * plugin-specific) for shipping alongside the plugin's artifact.
+ *
+ * @phase package
+ * @goal add-archetype-metadata
+ */
+public class AddArchetypeMetadataMojo
+    extends AbstractMojo
+{
+    /**
+     * The prefix for the plugin goal.
+     *
+     * @parameter
+     */
+    private String goalPrefix;
+
+    /**
+     * The project artifact, which should have the LATEST metadata added to it.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        Artifact projectArtifact = project.getArtifact();
+
+        Versioning versioning = new Versioning();
+        versioning.setLatest( projectArtifact.getVersion() );
+        versioning.updateTimestamp();
+
+        ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
+        projectArtifact.addMetadata( metadata );
+
+        GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata( project.getGroupId() );
+        groupMetadata.addPluginMapping( getGoalPrefix(), project.getArtifactId(), project.getName() );
+
+        projectArtifact.addMetadata( groupMetadata );
+    }
+
+    private String getGoalPrefix()
+    {
+        if ( goalPrefix == null )
+        {
+            goalPrefix = project.getArtifactId();
+        }
+
+        return goalPrefix;
+    }
+}
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
index c0ff2d8..c6498d9 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
@@ -1,53 +1,51 @@
-/*

- * 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.mojos;

-

-import org.apache.maven.plugin.AbstractMojo;

-import org.apache.maven.plugin.MojoExecutionException;

-import org.apache.maven.plugin.MojoFailureException;

-

-import java.io.File;

-

-/**

- * Clean archetype properties file.

- *

- * @author rafale

- * @requiresProject false

- * //@ //goal clean

- * @deprecated 

- */

-public class CleanMojo

-    extends AbstractMojo

-{

-    /**

-     * The property file to delete.

-     *

-     * @parameter default-value="archetype.properties" expression="${archetype.properties}"

-     */

-    private File propertyFile;

-

-    public void execute()

-        throws

-        MojoExecutionException,

-        MojoFailureException

-    {

-        propertyFile.delete();

-    }

-}

+package org.apache.maven.archetype.mojos;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * Clean archetype properties file.
+ *
+ * @author rafale
+ * @requiresProject false
+ * //@ //goal clean
+ * @deprecated
+ */
+public class CleanMojo
+    extends AbstractMojo
+{
+    /**
+     * The property file to delete.
+     *
+     * @parameter default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        propertyFile.delete();
+    }
+}
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java
index f46a81d..a583cb4 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.mojos;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.mojos;
-
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.repositorycrawler.RepositoryCrawler;
 import org.apache.maven.plugin.AbstractMojo;
@@ -28,15 +28,14 @@
 import java.io.File;
 
 /**
- * Crawl a Maven 2 repository (Filesystem, not HTTP)
- * and creates a catalog file.
- * 
+ * Crawl a Maven 2 repository (filesystem, not HTTP) and creates a catalog file.
+ *
  * @author           rafale
  * @requiresProject  false
  * @goal             crawl
  */
 public class CrawlRepositoryMojo
-extends AbstractMojo
+    extends AbstractMojo
 {
     /**
      * The archetype's catalog to update.
@@ -58,22 +57,23 @@
     private File repository;
 
     public void execute ()
-    throws MojoExecutionException, MojoFailureException
+        throws MojoExecutionException, MojoFailureException
     {
         System.err.println ( "repository " + repository );
         System.err.println ( "catalogFile " + catalogFile );
+
         if ( repository == null )
         {
-            throw new MojoFailureException (
-                "The repository is not defined. Use -Drepository=/path/to/repository"
-            );
+            throw new MojoFailureException( "The repository is not defined. Use -Drepository=/path/to/repository" );
         }
 
         ArchetypeCatalog catalog = crawler.crawl ( repository );
+
         if ( catalogFile == null )
         {
             catalogFile = new File ( repository, "archetype-catalog.xml" );
         }
+
         crawler.writeCatalog ( catalog, catalogFile );
     }
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
index 7dd0418..0e9b6bd 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.mojos;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,32 +19,30 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.mojos;
-
-import java.io.IOException;
 import org.apache.maven.archetype.ArchetypeCreationRequest;
 import org.apache.maven.archetype.ArchetypeCreationResult;
-import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.common.Constants;
 import org.apache.maven.archetype.ui.ArchetypeCreationConfigurator;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
-import org.apache.maven.archetype.common.Constants;
-import org.apache.maven.execution.MavenSession;
-import org.codehaus.plexus.util.StringUtils;
 
 /**
- * Creates sample archetype from current project.
+ * Creates an archetype from the current project.
  *
  * @author rafale
  * @requiresProject true
@@ -67,7 +67,7 @@
     ArchetypeRegistryManager archetypeRegistryManager;
 
     /** @component */
-    Archetype archetype;
+    ArchetypeManager archetype;
 
     /**
      * File extensions which are checked for project's text files (vs binary files).
@@ -105,8 +105,8 @@
     private boolean partialArchetype = false;
 
     /**
-     * Create pom's velocity templates with CDATA preservasion. This uses the String replaceAll
-     * method and risk to have some overly replacement capabilities (beware of '1.0' value).
+     * Create pom's velocity templates with CDATA preservation. This uses the <code>String.replaceAll()</code>
+     * method and risks to have some overly replacement capabilities (beware of '1.0' value).
      *
      * @parameter expression="${archetype.preserveCData}"
      */
@@ -138,10 +138,10 @@
      * @parameter expression="${archetype.properties}"
      */
     private File propertyFile;
-    
+
     /**
-     * The property telling which phase call on the generated archetype.
-     * Interresting values are: package, instal and deploy
+     * The property telling which phase to call on the generated archetype.
+     * Interesting values are: <code>package</code>, <code>install</code> and <code>deploy</code>
      *
      * @parameter expression="${archetype.postPhase}" default-value="package"
      */
@@ -154,18 +154,16 @@
     private boolean testMode;
 
     /** @parameter expression="${packageName}" */
-    private String packageName;//Find a better way to resolve the package!!! enforce usage of the configurator
+    private String packageName; //Find a better way to resolve the package!!! enforce usage of the configurator
 
-    /** 
-     *  @parameter expression="${session}" 
+    /**
+     *  @parameter expression="${session}"
      *  @readonly
      */
     private MavenSession session;
 
     public void execute()
-        throws
-        MojoExecutionException,
-        MojoFailureException
+        throws MojoExecutionException, MojoFailureException
     {
         Properties executionProperties = session.getExecutionProperties();
         try
@@ -177,20 +175,12 @@
 
             List languages = getLanguages( archetypeLanguages, propertyFile );
 
-            Properties properties = configurator.configureArchetypeCreation(
-                project,
-                new Boolean( interactive ),
-                executionProperties,
-                propertyFile,
-                languages
-            );
+            Properties properties =
+                configurator.configureArchetypeCreation( project, Boolean.valueOf( interactive ), executionProperties,
+                                                         propertyFile, languages );
 
-            List filtereds =
-                getFilteredExtensions(
-                    archetypeFilteredExtentions,
-                    propertyFile
-                );
-            
+            List filtereds = getFilteredExtensions( archetypeFilteredExtentions, propertyFile );
+
             ArchetypeCreationRequest request = new ArchetypeCreationRequest()
                 .setProject( project )
                 /*Used when in interactive mode*/
@@ -206,18 +196,15 @@
                 .setArchetypeRegistryFile( archetypeRegistryFile )
                 .setLocalRepository( localRepository )
                 /*this should be resolved and asked for user to verify*/
-                .setPackageName(packageName)
+                .setPackageName( packageName )
                 .setPostPhase( archetypePostPhase );
 
             ArchetypeCreationResult result = archetype.createArchetypeFromProject( request );
 
-            if( result.getCause() != null )
+            if ( result.getCause() != null )
             {
-                throw new MojoFailureException(
-                    result.getCause(),
-                    result.getCause().getMessage(),
-                    result.getCause().getMessage()
-                );
+                throw new MojoFailureException( result.getCause(), result.getCause().getMessage(),
+                                                result.getCause().getMessage() );
             }
 
             getLog().info( "Archetype created in target/generated-sources/archetype" );
@@ -250,73 +237,75 @@
     {
         List filteredExtensions = new ArrayList();
 
-        if( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )
+        if ( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )
         {
-            filteredExtensions.addAll(
-                Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) )
-            );
-            getLog().debug("Found in command line extensions = " + filteredExtensions);
+            filteredExtensions.addAll( Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) ) );
+
+            getLog().debug( "Found in command line extensions = " + filteredExtensions );
         }
 
-        if( filteredExtensions.isEmpty() && propertyFile != null && propertyFile.exists() )
+        if ( filteredExtensions.isEmpty() && propertyFile != null && propertyFile.exists() )
         {
             try
             {
                 Properties properties = new Properties();
                 properties.load( new FileInputStream( propertyFile ) );
 
-                String extensions =
-                    properties.getProperty( Constants.ARCHETYPE_FILTERED_EXTENSIONS );
-                if( StringUtils.isNotEmpty( extensions ) )
+                String extensions = properties.getProperty( Constants.ARCHETYPE_FILTERED_EXTENSIONS );
+                if ( StringUtils.isNotEmpty( extensions ) )
                 {
-                    filteredExtensions.addAll(
-                        Arrays.asList( StringUtils.split( extensions, "," ) )
-                    );
+                    filteredExtensions.addAll( Arrays.asList( StringUtils.split( extensions, "," ) ) );
                 }
-            getLog().debug("Found in propertyFile " +  propertyFile.getName() + " extensions = " + filteredExtensions);
+
+                getLog().debug(
+                                "Found in propertyFile " + propertyFile.getName() + " extensions = "
+                                    + filteredExtensions );
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 getLog().warn( "Can not read " + propertyFile.getName() );
             }
         }
 
-        if( filteredExtensions.isEmpty() )
+        if ( filteredExtensions.isEmpty() )
         {
             filteredExtensions.addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );
-            getLog().debug("Using default extensions = " + filteredExtensions);
+
+            getLog().debug( "Using default extensions = " + filteredExtensions );
         }
 
         return filteredExtensions;
     }
 
-    private List getLanguages(String archetypeLanguages, File propertyFile) {
+    private List getLanguages( String archetypeLanguages, File propertyFile )
+    {
         List resultingLanguages = new ArrayList();
 
         if ( StringUtils.isNotEmpty( archetypeLanguages ) )
         {
             resultingLanguages.addAll( Arrays.asList( StringUtils.split( archetypeLanguages, "," ) ) );
-            getLog().debug("Found in command line languages = " + resultingLanguages);
+
+            getLog().debug( "Found in command line languages = " + resultingLanguages );
         }
 
-        if( resultingLanguages.isEmpty() && propertyFile != null && propertyFile.exists() )
+        if ( resultingLanguages.isEmpty() && propertyFile != null && propertyFile.exists() )
         {
             try
             {
                 Properties properties = new Properties();
                 properties.load( new FileInputStream( propertyFile ) );
 
-                String languages =
-                    properties.getProperty( Constants.ARCHETYPE_LANGUAGES );
-                if( StringUtils.isNotEmpty( languages ) )
+                String languages = properties.getProperty( Constants.ARCHETYPE_LANGUAGES );
+                if ( StringUtils.isNotEmpty( languages ) )
                 {
-                    resultingLanguages.addAll(
-                        Arrays.asList( StringUtils.split( languages, "," ) )
-                    );
+                    resultingLanguages.addAll( Arrays.asList( StringUtils.split( languages, "," ) ) );
                 }
-            getLog().debug("Found in propertyFile " +  propertyFile.getName() + " languages = " + resultingLanguages);
+
+                getLog().debug(
+                                "Found in propertyFile " + propertyFile.getName() + " languages = "
+                                    + resultingLanguages );
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 getLog().warn( "Can not read " + propertyFile.getName() );
             }
@@ -325,7 +314,8 @@
         if ( resultingLanguages.isEmpty() )
         {
             resultingLanguages.addAll( Constants.DEFAULT_LANGUAGES );
-            getLog().debug("Using default languages = " + resultingLanguages);
+
+            getLog().debug( "Using default languages = " + resultingLanguages );
         }
 
         return resultingLanguages;
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
index e89d002..1c5d769 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.mojos;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,9 +19,7 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.mojos;
-
-import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.ArchetypeGenerationResult;
 import org.apache.maven.archetype.generator.ArchetypeGenerator;
@@ -43,7 +43,7 @@
 import java.util.Properties;
 
 /**
- * Generates sample project from archetype.
+ * Generates a new project from an archetype.
  *
  * @author rafale
  * @requiresProject false
@@ -55,7 +55,7 @@
     implements ContextEnabled
 {
     /** @component */
-    private Archetype archetype;
+    private ArchetypeManager archetype;
 
     /** @component */
     private ArchetypeSelector selector;
@@ -101,14 +101,16 @@
      * 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
+     * <ul>
+     * <li>'<code>file://...</code>' with <code>archetype-catalog.xml</code> automatically appended when pointing to a directory</li>
+     * <li>'<code>http://...</code>' with <code>archetype-catalog.xml</code> always appended</li>
+     * <li>'<code>local</code>' which is the shortcut for '<code>file://~/.m2/archetype-catalog.xml</code>'</li>
+     * <li>'<code>remote</code>' which is the shortcut for Maven Central repository, ie '<code>http://repo1.maven.org/maven2</code>'</li>
+     * <li>'<code>internal</code>' which is an internal catalog</li>
+     * </ul>
      *
-     * Since 2.0-alpha-5, default value is no longer internal,local but remote,local
-     * This can only work if central has a catalog file at root.
+     * Since 2.0-alpha-5, default value is no longer <code>internal,local</code> but <code>remote,local</code>.
+     * If Maven Central repository catalog file is empty, <code>internal</code> catalog is used instead.
      *
      * @parameter expression="${archetypeCatalog}" default-value="remote,local"
      */
@@ -122,7 +124,7 @@
      * @readonly
      */
     private ArtifactRepository localRepository;
-    
+
     /**
      * List of Remote Repositories used by the resolver.
      *
@@ -148,6 +150,7 @@
      *  @readonly
      */
     private MavenSession session;
+
     /**
      * Additional goals that can be specified by the user during the creation of the archetype.
      *
@@ -166,12 +169,12 @@
             .setArchetypeVersion( archetypeVersion )
             .setOutputDirectory( basedir.getAbsolutePath() )
             .setLocalRepository( localRepository )
-            .setArchetypeRepository(archetypeRepository)
-            .setRemoteArtifactRepositories(remoteArtifactRepositories);
+            .setArchetypeRepository( archetypeRepository )
+            .setRemoteArtifactRepositories( remoteArtifactRepositories );
 
         try
         {
-            if( interactiveMode.booleanValue() )
+            if ( interactiveMode.booleanValue() )
             {
                 getLog().info( "Generating project in Interactive mode" );
             }
@@ -184,15 +187,12 @@
 
             configurator.configureArchetype( request, interactiveMode, executionProperties );
 
-            ArchetypeGenerationResult generationResult =
-                archetype.generateProjectFromArchetype( request );
-            if( generationResult.getCause() != null )
+            ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( request );
+
+            if ( generationResult.getCause() != null )
             {
-                throw new MojoFailureException(
-                    generationResult.getCause(),
-                    generationResult.getCause().getMessage(),
-                    generationResult.getCause().getMessage()
-                );
+                throw new MojoFailureException( generationResult.getCause(), generationResult.getCause().getMessage(),
+                                                generationResult.getCause().getMessage() );
             }
         }
         catch ( MojoFailureException ex )
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
index 7f87052..ec8f39c 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
@@ -1,316 +1,283 @@
-/*

- * 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.mojos;

-

-import org.apache.commons.collections.CollectionUtils;

-import org.apache.maven.archetype.common.Constants;

-import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;

-import org.apache.maven.archetype.exception.ArchetypeNotConfigured;

-import org.apache.maven.archetype.exception.OutputFileExists;

-import org.apache.maven.archetype.exception.PomFileExists;

-import org.apache.maven.archetype.exception.ProjectDirectoryExists;

-import org.apache.maven.archetype.exception.UnknownArchetype;

-import org.apache.maven.archetype.generator.FilesetArchetypeGenerator;

-import org.apache.maven.plugin.AbstractMojo;

-import org.apache.maven.plugin.MojoExecutionException;

-import org.apache.maven.plugin.MojoFailureException;

-import org.apache.maven.project.MavenProject;

-import org.codehaus.plexus.util.FileUtils;

-import org.codehaus.plexus.util.StringUtils;

-

-import java.io.File;

-import java.io.FileInputStream;

-import java.io.FileNotFoundException;

-import java.io.IOException;

-import java.io.StringWriter;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Properties;

-

-/**

- * Execute the archetype integration tests.

- *

- * @author rafale

- * @requiresProject true

- * @goal integration-test

- */

-public class IntegrationTestMojo

-    extends AbstractMojo

-{

-    /** @component */

-    FilesetArchetypeGenerator filesetGenerator;

-

-    /**

-     * The archetype project to execute the integration tests on.

-     *

-     * @parameter expression="${project}"

-     * @required

-     * @readonly

-     */

-    private MavenProject project;

-

-    /**

-     * Skip the integration test.

-     *

-     * @parameter expression="${archetype.test.skip}"

-     * @readonly

-     */

-    private boolean skip = false;

-

-    public void execute()

-        throws

-        MojoExecutionException,

-        MojoFailureException

-    {

-        if ( !skip )

-        {

-            try

-            {

-                File projectsDirectory =

-                    new File( project.getBasedir(), "target/test-classes/projects" );

-

-                if ( projectsDirectory.exists() )

-                {

-                    File archetypeFile = project.getArtifact().getFile();

-

-                    List projectsGoalFiles =

-                        FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );

-

-                    Iterator goalFiles = projectsGoalFiles.iterator();

-

-                    StringWriter errorWriter = new StringWriter();

-                    while ( goalFiles.hasNext() )

-                    {

-                        File goalFile = (File) goalFiles.next();

-

-                        try

-                        {

-                            processIntegrationTest( goalFile, archetypeFile );

-                        }

-                        catch ( IntegrationTestFailure ex )

-                        {

-                            errorWriter.write(

-                                "Test " + goalFile.getParentFile().getName() + " failed\n"

-                            );

-

-                            errorWriter.write( ex.getStackTrace() + "\n" );

-                            errorWriter.write( ex.getMessage() + "\n" );

-                            errorWriter.write( "\n" );

-                        }

-                    }

-

-                    String errors = errorWriter.toString();

-                    if ( !StringUtils.isEmpty( errors ) )

-                    {

-                        throw new MojoExecutionException( errors );

-                    }

-                }

-            }

-            catch ( IOException ex )

-            {

-                throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );

-            }

-        }

-    }

-

-    private void assertTest( File reference,

-                             File basedir )

-        throws

-        IntegrationTestFailure,

-        IOException

-    {

-        List referenceFiles = FileUtils.getFileNames( reference, "**", null, false );

-        List projectFiles = FileUtils.getFileNames( basedir, "**", null, false );

-

-        boolean fileNamesEquals =

-            CollectionUtils.isEqualCollection( referenceFiles, projectFiles );

-

-        {

-            Iterator refs = referenceFiles.iterator();

-            while ( refs.hasNext() )

-            {

-                String ref = (String) refs.next();

-

-                if ( projectFiles.contains( ref ) )

-                {

-                    projectFiles.remove( ref );

-                    getLog().debug( "Contained " + ref );

-                }

-                else

-                {

-                    getLog().debug( "Not contained " + ref );

-                }

-            }

-            getLog().debug( "Remains " + projectFiles );

-        }

-

-        if ( !fileNamesEquals )

-        {

-            throw new IntegrationTestFailure( "Reference and generated project differs" );

-        }

-

-        boolean contentEquals = true;

-        Iterator files = referenceFiles.iterator();

-        while ( files.hasNext() )

-        {

-            String file = (String) files.next();

-

-            if ( file.endsWith( "pom.xml" ) )

-            {

-                if ( !modelEquals( new File( reference, file ), new File( basedir, file ) ) )

-                {

-                    getLog().warn( "Contents of file " + file + " are not equal" );

-                    contentEquals = false;

-                }

-            }

-            else

-            {

-                if ( !FileUtils.contentEquals(

-                    new File( reference, file ),

-                    new File( basedir, file )

-                )

-                    )

-                {

-                    getLog().warn( "Contents of file " + file + " are not equal" );

-                    contentEquals = false;

-                }

-            }

-        }

-        if ( !contentEquals )

-        {

-            throw new IntegrationTestFailure( "Some content are not equals" );

-        }

-    }

-

-    private Properties loadProperties( final File propertiesFile )

-        throws

-        IOException,

-        FileNotFoundException

-    {

-        Properties properties = new Properties();

-

-        properties.load( new FileInputStream( propertiesFile ) );

-

-        return properties;

-    }

-

-    private boolean modelEquals( File referencePom,

-                                 File generatedPom )

-        throws

-        IOException

-    {

-        return FileUtils.contentEquals( referencePom, generatedPom );

-    }

-

-    private void processIntegrationTest( File goalFile,

-                                         File archetypeFile )

-        throws

-        IntegrationTestFailure

-    {

-        try

-        {

-            Properties testProperties = getTestProperties( goalFile );

-

-            Properties properties = getProperties( goalFile );

-

-            String basedir = goalFile.getParentFile().getPath() + "/project";

-

-            FileUtils.mkdir( basedir );

-//TODO: fix this to use request

-            filesetGenerator.generateArchetype( null, archetypeFile, basedir );

-

-            File reference = new File( goalFile.getParentFile(), "reference" );

-

-            assertTest(

-                reference,

-                new File( basedir, properties.getProperty( Constants.ARTIFACT_ID ) )

-            );

-        }

-        catch ( ArchetypeNotConfigured ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( UnknownArchetype ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( PomFileExists ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( ProjectDirectoryExists ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( ArchetypeGenerationFailure ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( IOException ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-        catch ( OutputFileExists ex )

-        {

-            throw new IntegrationTestFailure( ex );

-        }

-    }

-

-    private Properties getProperties( File goalFile )

-        throws

-        IOException

-    {

-        File propertiesFile = new File( goalFile.getParentFile(), "archetype.properties" );

-

-        return loadProperties( propertiesFile );

-    }

-

-    private Properties getTestProperties( File goalFile )

-        throws

-        IOException

-    {

-        return loadProperties( goalFile );

-    }

-

-    class IntegrationTestFailure

-        extends Exception

-    {

-        IntegrationTestFailure()

-        {

-            super();

-        }

-

-        IntegrationTestFailure( String message )

-        {

-            super( message );

-        }

-

-        IntegrationTestFailure( Throwable cause )

-        {

-            super( cause );

-        }

-

-        IntegrationTestFailure( String message,

-                                Throwable cause )

-        {

-            super( message, cause );

-        }

-    }

-}

+package org.apache.maven.archetype.mojos;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
+import org.apache.maven.archetype.ArchetypeGenerationResult;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.archetype.generator.ArchetypeGenerator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Execute the archetype integration tests.
+ *
+ * @author rafale
+ * @requiresProject true
+ * @goal integration-test
+ */
+public class IntegrationTestMojo
+    extends AbstractMojo
+{
+    /** @component */
+    ArchetypeGenerator archetypeGenerator;
+
+    /**
+     * The archetype project to execute the integration tests on.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * Skip the integration test.
+     *
+     * @parameter expression="${archetype.test.skip}"
+     * @readonly
+     */
+    private boolean skip = false;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( !skip )
+        {
+            try
+            {
+                File projectsDirectory = new File( project.getBasedir(), "target/test-classes/projects" );
+
+                if ( projectsDirectory.exists() )
+                {
+                    File archetypeFile = project.getArtifact().getFile();
+
+                    List projectsGoalFiles = FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );
+
+                    Iterator goalFiles = projectsGoalFiles.iterator();
+
+                    StringWriter errorWriter = new StringWriter();
+                    while ( goalFiles.hasNext() )
+                    {
+                        File goalFile = (File) goalFiles.next();
+
+                        try
+                        {
+                            processIntegrationTest( goalFile, archetypeFile );
+                        }
+                        catch ( IntegrationTestFailure ex )
+                        {
+                            errorWriter.write( "Test " + goalFile.getParentFile().getName() + " failed\n" );
+                            errorWriter.write( ex.getStackTrace() + "\n" );
+                            errorWriter.write( ex.getMessage() + "\n" );
+                            errorWriter.write( "\n" );
+                        }
+                    }
+
+                    String errors = errorWriter.toString();
+                    if ( !StringUtils.isEmpty( errors ) )
+                    {
+                        throw new MojoExecutionException( errors );
+                    }
+                }
+            }
+            catch ( IOException ex )
+            {
+                throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );
+            }
+        }
+    }
+
+    private void assertTest( File reference, File basedir )
+        throws IntegrationTestFailure, IOException
+    {
+        List referenceFiles = FileUtils.getFileNames( reference, "**", null, false );
+        List projectFiles = FileUtils.getFileNames( basedir, "**", null, false );
+
+        boolean fileNamesEquals = CollectionUtils.isEqualCollection( referenceFiles, projectFiles );
+
+        if ( !fileNamesEquals )
+        {
+            for ( Iterator refs = referenceFiles.iterator(); refs.hasNext(); )
+            {
+                String ref = (String) refs.next();
+
+                if ( projectFiles.contains( ref ) )
+                {
+                    projectFiles.remove( ref );
+                    getLog().debug( "Contained " + ref );
+                }
+                else
+                {
+                    getLog().error( "Not contained " + ref );
+                }
+            }
+            getLog().error( "Remains " + projectFiles );
+
+            throw new IntegrationTestFailure( "Reference and generated project differs" );
+        }
+
+        boolean contentEquals = true;
+
+        for ( Iterator files = referenceFiles.iterator(); files.hasNext(); )
+        {
+            String file = (String) files.next();
+
+            if ( file.endsWith( "pom.xml" ) )
+            {
+                if ( !modelEquals( new File( reference, file ), new File( basedir, file ) ) )
+                {
+                    getLog().warn( "Contents of file " + file + " are not equal" );
+                    contentEquals = false;
+                }
+            }
+            else
+            {
+                if ( !FileUtils.contentEquals( new File( reference, file ), new File( basedir, file ) ) )
+                {
+                    getLog().warn( "Contents of file " + file + " are not equal" );
+                    contentEquals = false;
+                }
+            }
+        }
+        if ( !contentEquals )
+        {
+            throw new IntegrationTestFailure( "Some content are not equals" );
+        }
+    }
+
+    private Properties loadProperties( final File propertiesFile )
+        throws IOException, FileNotFoundException
+    {
+        Properties properties = new Properties();
+
+        properties.load( new FileInputStream( propertiesFile ) );
+
+        return properties;
+    }
+
+    private boolean modelEquals( File referencePom, File generatedPom )
+        throws IOException
+    {
+        return FileUtils.contentEquals( referencePom, generatedPom );
+    }
+
+    private void processIntegrationTest( File goalFile, File archetypeFile )
+        throws IntegrationTestFailure
+    {
+        try
+        {
+            Properties testProperties = getTestProperties( goalFile );
+
+            Properties properties = getProperties( goalFile );
+
+            String basedir = goalFile.getParentFile().getPath() + "/project";
+
+            FileUtils.deleteDirectory( basedir );
+
+            FileUtils.mkdir( basedir );
+
+            ArchetypeGenerationRequest request = new ArchetypeGenerationRequest()
+                .setArchetypeGroupId( project.getGroupId() )
+                .setArchetypeArtifactId( project.getArtifactId() )
+                .setArchetypeVersion( project.getVersion() )
+                .setGroupId( properties.getProperty( Constants.GROUP_ID ) )
+                .setArtifactId( properties.getProperty( Constants.ARTIFACT_ID ) )
+                .setVersion( properties.getProperty( Constants.VERSION ) )
+                .setPackage( properties.getProperty( Constants.PACKAGE ) )
+                .setOutputDirectory( basedir )
+                .setProperties( properties );
+
+            ArchetypeGenerationResult result = new ArchetypeGenerationResult();
+
+            archetypeGenerator.generateArchetype( request, archetypeFile, result );
+
+            File reference = new File( goalFile.getParentFile(), "reference" );
+
+            if ( reference.exists() )
+            {
+                // compare generated project with reference
+                assertTest( reference, new File( basedir, request.getArtifactId() ) );
+            }
+
+            if ( result.getCause() != null )
+            {
+                throw new IntegrationTestFailure( result.getCause() );
+            }
+        }
+        catch ( IOException ioe )
+        {
+            throw new IntegrationTestFailure( ioe );
+        }
+    }
+
+    private Properties getProperties( File goalFile )
+        throws IOException
+    {
+        File propertiesFile = new File( goalFile.getParentFile(), "archetype.properties" );
+        System.out.println( propertiesFile );
+
+        return loadProperties( propertiesFile );
+    }
+
+    private Properties getTestProperties( File goalFile )
+        throws IOException
+    {
+        return loadProperties( goalFile );
+    }
+
+    class IntegrationTestFailure
+        extends Exception
+    {
+        IntegrationTestFailure()
+        {
+            super();
+        }
+
+        IntegrationTestFailure( String message )
+        {
+            super( message );
+        }
+
+        IntegrationTestFailure( Throwable cause )
+        {
+            super( cause );
+        }
+
+        IntegrationTestFailure( String message, Throwable cause )
+        {
+            super( message, cause );
+        }
+    }
+}
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
index e26d90b..5cf8897 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.mojos;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,16 +19,15 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.mojos;
-
-import java.io.IOException;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+
 import java.io.File;
-import org.apache.maven.archetype.Archetype;
+import java.io.IOException;
 
 /**
  * @author           rafale
@@ -75,7 +76,7 @@
      *
      * @component
      */
-    private Archetype archetype;
+    private ArchetypeManager archetype;
 
     public void execute( )
         throws MojoExecutionException, MojoFailureException
@@ -88,11 +89,11 @@
         }
         catch ( DependencyResolutionRequiredException ex )
         {
-            throw new MojoExecutionException( ex.getMessage(  ), ex );
+            throw new MojoExecutionException( ex.getMessage(), ex );
         }
         catch ( IOException ex )
         {
-            throw new MojoExecutionException( ex.getMessage(  ), ex );
+            throw new MojoExecutionException( ex.getMessage(), ex );
         }
     }
 }
\ No newline at end of file
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
index a2296af..c949abb 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.exception.UnknownArchetype;
 import org.apache.maven.archetype.old.OldArchetype;
 import org.apache.maven.archetype.old.ArchetypeDescriptorException;
@@ -34,12 +35,10 @@
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
- * The archetype creation goal looks for an archetype with a given groupId, 
+ * The archetype creation goal looks for an archetype with a given groupId,
  * artifactId, and version and retrieves it from the remote repository. Once the
  * archetype is retrieved, it is then processed against a set of user parameters
  * to create a working Maven project.
@@ -53,9 +52,9 @@
     extends AbstractMojo
 {
     /**
-     * Used to create the Archetype specified by the groupId, artifactId, and 
+     * Used to create the Archetype specified by the groupId, artifactId, and
      * version from the remote repository.
-     * 
+     *
      * @component
      */
     private OldArchetype archetype;
@@ -63,14 +62,14 @@
     /**
      * Used to create ArtifactRepository objects given the urls of the remote
      * repositories.
-     * 
+     *
      * @component
      */
     private ArtifactRepositoryFactory artifactRepositoryFactory;
 
     /**
      * Determines whether the layout is legacy or not.
-     * 
+     *
      * @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout" roleHint="default"
      */
     private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
@@ -78,7 +77,7 @@
 
     /**
      * Maven's local repository.
-     * 
+     *
      * @parameter expression="${localRepository}"
      * @required
      */
@@ -86,7 +85,7 @@
 
     /**
      * The Archetype Group Id to be used.
-     * 
+     *
      * @parameter expression="${archetypeGroupId}" default-value="org.apache.maven.archetypes"
      * @required
      */
@@ -94,7 +93,7 @@
 
     /**
      * The Archetype Artifact Id to be used.
-     * 
+     *
      * @parameter expression="${archetypeArtifactId}" default-value="maven-archetype-quickstart"
      * @required
      */
@@ -102,7 +101,7 @@
 
     /**
      * The Archetype Version to be used.
-     * 
+     *
      * @parameter expression="${archetypeVersion}" default-value="RELEASE"
      * @required
      */
@@ -110,21 +109,21 @@
 
     /**
      * The Group Id of the project to be build.
-     * 
+     *
      * @parameter expression="${groupId}"
      */
     private String groupId;
 
     /**
      * The Artifact Id of the project to be build.
-     * 
+     *
      * @parameter expression="${artifactId}"
      */
     private String artifactId;
 
     /**
      * The Version of the project to be build.
-     * 
+     *
      * @parameter expression="${version}" default-value="1.0-SNAPSHOT"
      * @required
      */
@@ -132,7 +131,7 @@
 
     /**
      * The Package Name of the project to be build.
-     * 
+     *
      * @parameter expression="${packageName}" alias="package"
      */
     private String packageName;
@@ -140,7 +139,7 @@
     /**
      * The remote repositories available for discovering dependencies and extensions as indicated
      * by the POM.
-     * 
+     *
      * @parameter expression="${project.remoteArtifactRepositories}"
      * @required
      */
@@ -148,14 +147,14 @@
 
     /**
      * Other remote repositories available for discovering dependencies and extensions.
-     * 
+     *
      * @parameter expression="${remoteRepositories}"
      */
     private String remoteRepositories;
 
     /**
      * The project to be created an archetype of.
-     * 
+     *
      * @parameter expression="${project}"
      */
     private MavenProject project;
@@ -194,20 +193,6 @@
             packageName = groupId;
         }
 
-        // TODO: context mojo more appropriate?
-        Map map = new HashMap();
-
-        map.put( "basedir", basedir );
-
-        map.put( "package", packageName );
-
-        map.put( "packageName", packageName );
-
-        map.put( "groupId", groupId );
-
-        map.put( "artifactId", artifactId );
-
-        map.put( "version", version );
 
         List archetypeRemoteRepositories = new ArrayList( pomRemoteRepositories );
 
@@ -227,16 +212,21 @@
 
         try
         {
-            archetype.createArchetype(
-                    archetypeGroupId, 
-                    archetypeArtifactId, 
-                    archetypeVersion, 
-                    createRepository("http://repo1.maven.org/maven2", "central"), 
-                    localRepository, 
-                    archetypeRemoteRepositories, 
-                    map);            
+            ArchetypeGenerationRequest request = new ArchetypeGenerationRequest()
+                .setPackage( packageName )
+                .setGroupId( groupId )
+                .setArtifactId( artifactId )
+                .setVersion( version )
+                .setArchetypeGroupId( archetypeGroupId )
+                .setArchetypeArtifactId( archetypeArtifactId )
+                .setArchetypeVersion( archetypeVersion )
+                .setLocalRepository( localRepository )
+                .setRemoteArtifactRepositories( archetypeRemoteRepositories )
+                .setOutputDirectory( basedir );
+
+            archetype.createArchetype( request, createRepository( "http://repo1.maven.org/maven2", "central" ) );
         }
-        catch (UnknownArchetype e) 
+        catch ( UnknownArchetype e )
         {
             throw new MojoExecutionException( "Error creating from archetype", e );
         }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
index 898e8dd..230f8bd 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.mojos;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,20 +19,19 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.mojos;
-
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.ContextEnabled;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
-import org.codehaus.plexus.util.StringUtils;
 
 
 /**
@@ -46,8 +47,8 @@
     implements ContextEnabled
 {
     /** @component */
-    private org.apache.maven.archetype.Archetype archetyper;
-    
+    private ArchetypeManager archetyper;
+
     /** @component role="org.apache.maven.archetype.source.ArchetypeDataSource" */
     private Map archetypeSources;
 
@@ -78,30 +79,32 @@
      */
     private Settings settings;
 
-    public void execute( )
+    public void execute()
         throws MojoExecutionException
     {
-        Archetype archetype = new Archetype(  );
-        archetype.setGroupId( project.getGroupId(  ) );
-        archetype.setArtifactId( project.getArtifactId(  ) );
-        archetype.setVersion( project.getVersion(  ) );
-        if (StringUtils.isNotEmpty(project.getDescription()))
+        Archetype archetype = new Archetype();
+        archetype.setGroupId( project.getGroupId() );
+        archetype.setArtifactId( project.getArtifactId() );
+        archetype.setVersion( project.getVersion() );
+
+        if ( StringUtils.isNotEmpty( project.getDescription() ) )
         {
-            archetype.setDescription(project.getDescription());
+            archetype.setDescription( project.getDescription() );
         }
         else
         {
-            archetype.setDescription(project.getName());
+            archetype.setDescription( project.getName() );
         }
-//        archetype.setRepository( localRepository.toString(  ) );
-//            archetype.setGoals(project.get);
-//            archetype.setProperties(project.get);
-        
-        archetyper.updateLocalCatalog(archetype);
+
+//        archetype.setRepository( localRepository.toString() );
+//            archetype.setGoals( project.get );
+//            archetype.setProperties( project.get );
+
+        archetyper.updateLocalCatalog( archetype );
         /*
         File archetypeCatalogPropertiesFile = new File( System.getProperty( "user.home" ), ".m2/archetype-catalog.properties" );
 
-        if ( archetypeCatalogPropertiesFile.exists(  ) )
+        if ( archetypeCatalogPropertiesFile.exists() )
         {
             Properties archetypeCatalogProperties = PropertyUtils.loadProperties( archetypeCatalogPropertiesFile );
 
@@ -115,19 +118,19 @@
 
                 try
                 {
-                    getLog(  ).debug( "Updating catalog " + sourceRoleHint );
+                    getLog().debug( "Updating catalog " + sourceRoleHint );
 
                     ArchetypeDataSource source = (ArchetypeDataSource) archetypeSources.get( sourceRoleHint );
 
                     source.updateCatalog( getArchetypeSourceProperties( sourceRoleHint, archetypeCatalogProperties ), archetype, settings );
 
-                    getLog(  ).
-                        info( "Updated " + sourceRoleHint + " using repository " + localRepository.toString(  ) );
+                    getLog().
+                        info( "Updated " + sourceRoleHint + " using repository " + localRepository.toString() );
                 }
                 catch ( ArchetypeDataSourceException ex )
                 {
-                    getLog(  ).
-                        warn( "Can't update " + sourceRoleHint + " using repository " + localRepository.toString(  ) );
+                    getLog().
+                        warn( "Can't update " + sourceRoleHint + " using repository " + localRepository.toString() );
                 }
             }
         }
@@ -140,15 +143,15 @@
 
     private Properties getArchetypeSourceProperties( String sourceRoleHint, Properties archetypeCatalogProperties )
     {
-        Properties p = new Properties(  );
+        Properties p = new Properties();
 
-        for ( Iterator i = archetypeCatalogProperties.keySet(  ).iterator(  ); i.hasNext(  ); )
+        for ( Iterator i = archetypeCatalogProperties.keySet().iterator(); i.hasNext(); )
         {
             String key = (String) i.next();
 
             if ( key.startsWith( sourceRoleHint ) )
             {
-                String k = key.substring( sourceRoleHint.length(  ) + 1 );
+                String k = key.substring( sourceRoleHint.length() + 1 );
 
                 p.setProperty( k, archetypeCatalogProperties.getProperty( key ) );
             }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java
index f143c9e..7d81ef3 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
 import org.apache.maven.archetype.exception.ArchetypeNotDefined;
 import org.apache.maven.archetype.exception.TemplateCreationException;
@@ -35,18 +35,8 @@
 {
     String ROLE = ArchetypeCreationConfigurator.class.getName();
 
-    Properties configureArchetypeCreation(
-        MavenProject project,
-        Boolean interactiveMode,
-        Properties commandLineProperties,
-        File propertyFile,
-        List languages
-    )
-        throws
-        FileNotFoundException,
-        IOException,
-        ArchetypeNotDefined,
-        ArchetypeNotConfigured,
-        PrompterException,
+    Properties configureArchetypeCreation( MavenProject project, Boolean interactiveMode,
+                                           Properties commandLineProperties, File propertyFile, List languages )
+        throws FileNotFoundException, IOException, ArchetypeNotDefined, ArchetypeNotConfigured, PrompterException,
         TemplateCreationException;
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java
index bfade08..afeb161 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.codehaus.plexus.components.interactivity.PrompterException;
 
@@ -29,67 +29,55 @@
     /**
      */
     String getArchetypeArtifactId( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getArchetypeGroupId( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getArchetypeVersion( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getArtifactId( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     boolean askAddAnotherProperty()
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String askNewPropertyKey()
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
-    String askReplacementValue( String propertyKey,
-                                String defaultValue )
-        throws
-        PrompterException;
+    String askReplacementValue( String propertyKey, String defaultValue )
+        throws PrompterException;
 
     /**
      */
     boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getGroupId( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getPackage( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 
     /**
      */
     String getVersion( String defaultValue )
-        throws
-        PrompterException;
+        throws PrompterException;
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
index e359874..84907f3 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
@@ -29,35 +29,27 @@
 {
     String ROLE = ArchetypeFactory.class.getName();
 
+    /**
+     */
+    ArchetypeConfiguration createArchetypeConfiguration(
+                                                         org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor,
+                                                         Properties properties );
 
     /**
      */
     ArchetypeConfiguration createArchetypeConfiguration(
-        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor,
-        Properties properties
-    );
+                                                         org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
+                                                         Properties properties );
 
     /**
      */
-    ArchetypeConfiguration createArchetypeConfiguration(
-        org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
-        Properties properties
-    );
-
-    /**
-     */
-    ArchetypeConfiguration createArchetypeConfiguration(
-        MavenProject project,
-        ArchetypeDefinition archetypeDefinition,
-        Properties properties
-    );
+    ArchetypeConfiguration createArchetypeConfiguration( MavenProject project, ArchetypeDefinition archetypeDefinition,
+                                                         Properties properties );
 
     /**
      */
     ArchetypeDefinition createArchetypeDefinition( Properties properties );
 
-    void updateArchetypeConfiguration(
-        ArchetypeConfiguration archetypeConfiguration,
-        ArchetypeDefinition archetypeDefinition
-    );
+    void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration,
+                                       ArchetypeDefinition archetypeDefinition );
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
index 078b41c..e9f0f10 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.exception.ArchetypeGenerationConfigurationFailure;
 import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
@@ -33,15 +33,8 @@
 {
     String ROLE = ArchetypeGenerationConfigurator.class.getName();
 
-    public void configureArchetype(
-        ArchetypeGenerationRequest request,
-        Boolean interactiveMode,
-        Properties commandLineProperties )
-        throws
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        IOException,
-        PrompterException,
+    void configureArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode,
+                             Properties commandLineProperties )
+        throws ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, IOException, PrompterException,
         ArchetypeGenerationConfigurationFailure;
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java
index 1567ffb..91fae1a 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java
@@ -25,11 +25,8 @@
 public interface ArchetypeGenerationQueryer
 {
     boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
-        throws
-        PrompterException;
+        throws PrompterException;
 
-    String getPropertyValue( String requiredProperty,
-                             String defaultValue )
-        throws
-        PrompterException;
+    String getPropertyValue( String requiredProperty, String defaultValue )
+        throws PrompterException;
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
index d1fe8d1..187e866 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
@@ -1,24 +1,40 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
 package org.apache.maven.archetype.ui;
 
-import java.io.IOException;
-import java.util.List;
+/*
+ * 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.
+ */
+
 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;
 
+import java.io.IOException;
+import java.util.List;
+
 /**
- *
  * @author raphaelpieroni
  * @plexus.component role-hint="archetype"
  */
-public class ArchetypePrompter implements Prompter {
+public class ArchetypePrompter
+    implements Prompter
+{
 
     /**
      * @plexus.requirement
@@ -164,24 +180,11 @@
         StringBuffer formatted = new StringBuffer( message.length() * 2 );
 
         formatted.append( message );
-        /*if ( possibleValues != null && !possibleValues.isEmpty() )
-        {
-        formatted.append( " (" );
-
-        for ( Iterator it = possibleValues.iterator(); it.hasNext(); )
-        {
-        String possibleValue = (String) it.next();
-
-        formatted.append( possibleValue );
-
-        if ( it.hasNext() )
-        {
-        formatted.append( '/' );
-        }
-        }
-
-        formatted.append( ')' );
-        }*/
+        /*
+         * if ( possibleValues != null && !possibleValues.isEmpty() ) { formatted.append( " (" ); for ( Iterator it =
+         * possibleValues.iterator(); it.hasNext(); ) { String possibleValue = (String) it.next(); formatted.append(
+         * possibleValue ); if ( it.hasNext() ) { formatted.append( '/' ); } } formatted.append( ')' ); }
+         */
 
         if ( defaultReply != null )
         {
@@ -211,5 +214,4 @@
 
     }
 
-
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java
index 92d70d2..f13d6c9 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
 import org.codehaus.plexus.components.interactivity.PrompterException;
@@ -36,8 +36,7 @@
         throws PrompterException;
 
     boolean confirmSelection( ArchetypeDefinition archetypeDefinition )
-        throws
-        PrompterException;
+        throws PrompterException;
 
 //    Archetype selectArchetype( List list )
 //        throws
@@ -61,7 +60,8 @@
      * @param archetypes the archetypes to choose from
      * @param defaultDefinition the default archetype, if present in the map
      * @return the selected archetype
-     * @throws org.codehaus.plexus.components.interactivity.PrompterException if there is a problem in making a selection
+     * @throws org.codehaus.plexus.components.interactivity.PrompterException if there is a problem in making a
+     *             selection
      */
     Archetype selectArchetype( Map archetypes, ArchetypeDefinition defaultDefinition )
         throws PrompterException;
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
index 93298d0..e49fadc 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.exception.ArchetypeNotDefined;
 import org.apache.maven.archetype.exception.ArchetypeSelectionFailure;
@@ -47,11 +47,6 @@
 //        ArchetypeSelectionFailure;
 
     void selectArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs )
-        throws
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        UnknownGroup,
-        IOException,
-        PrompterException,
+        throws ArchetypeNotDefined, UnknownArchetype, UnknownGroup, IOException, PrompterException,
         ArchetypeSelectionFailure;
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java
index 16979ea..b437946 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
 import org.apache.maven.archetype.common.ArchetypeFilesResolver;
@@ -29,6 +29,7 @@
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.components.interactivity.PrompterException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
@@ -42,7 +43,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
-import org.codehaus.plexus.util.IOUtil;
 
 /** @plexus.component */
 public class DefaultArchetypeCreationConfigurator
@@ -58,25 +58,13 @@
     /** @plexus.requirement */
     private ArchetypeFilesResolver archetypeFilesResolver;
 
-    public Properties configureArchetypeCreation(
-        MavenProject project,
-        Boolean interactiveMode,
-        Properties commandLineProperties,
-        File propertyFile,
-        List languages
-    )
-        throws
-        IOException,
-        ArchetypeNotDefined,
-        ArchetypeNotConfigured,
-        PrompterException,
-        TemplateCreationException
+    public Properties configureArchetypeCreation( MavenProject project, Boolean interactiveMode,
+                                                  Properties commandLineProperties, File propertyFile, List languages )
+        throws IOException, ArchetypeNotDefined, ArchetypeNotConfigured, PrompterException, TemplateCreationException
     {
-        Properties properties =
-            initialiseArchetypeProperties( commandLineProperties, propertyFile );
+        Properties properties = initialiseArchetypeProperties( commandLineProperties, propertyFile );
 
-        ArchetypeDefinition archetypeDefinition =
-            archetypeFactory.createArchetypeDefinition( properties );
+        ArchetypeDefinition archetypeDefinition = archetypeFactory.createArchetypeDefinition( properties );
 
         if ( !archetypeDefinition.isDefined() )
         {
@@ -84,24 +72,14 @@
         }
 
         ArchetypeConfiguration archetypeConfiguration =
-            archetypeFactory.createArchetypeConfiguration(
-                project,
-                archetypeDefinition,
-                properties
-            );
+            archetypeFactory.createArchetypeConfiguration( project, archetypeDefinition, properties );
 
-        String resolvedPackage =
-            archetypeFilesResolver.resolvePackage( project.getBasedir(), languages );
+        String resolvedPackage = archetypeFilesResolver.resolvePackage( project.getBasedir(), languages );
 
         if ( !archetypeConfiguration.isConfigured() )
         {
             archetypeConfiguration =
-                defineDefaultConfiguration(
-                    project,
-                    archetypeDefinition,
-                    resolvedPackage,
-                    properties
-                );
+                defineDefaultConfiguration( project, archetypeDefinition, resolvedPackage, properties );
         }
 
         if ( interactiveMode.booleanValue() )
@@ -111,85 +89,62 @@
             boolean confirmed = false;
             while ( !confirmed )
             {
-                if ( !archetypeDefinition.isDefined() )//<editor-fold text="...">
+                if ( !archetypeDefinition.isDefined() )// <editor-fold text="...">
                 {
                     getLogger().debug( "Archetype is yet not defined" );
                     if ( !archetypeDefinition.isGroupDefined() )
                     {
                         getLogger().debug( "Asking for archetype's groupId" );
-                        archetypeDefinition.setGroupId(
-                            archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() )
-                        );
+                        archetypeDefinition.setGroupId( archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() ) );
                     }
                     if ( !archetypeDefinition.isArtifactDefined() )
                     {
                         getLogger().debug( "Asking for archetype's artifactId" );
-                        archetypeDefinition.setArtifactId(
-                            archetypeCreationQueryer.getArchetypeArtifactId(
-                                project.getArtifactId() + Constants.ARCHETYPE_SUFFIX
-                            )
-                        );
+                        archetypeDefinition.setArtifactId( archetypeCreationQueryer.getArchetypeArtifactId( project.getArtifactId()
+                            + Constants.ARCHETYPE_SUFFIX ) );
                     }
                     if ( !archetypeDefinition.isVersionDefined() )
                     {
                         getLogger().debug( "Asking for archetype's version" );
-                        archetypeDefinition.setVersion(
-                            archetypeCreationQueryer.getArchetypeVersion( project.getVersion() )
-                        );
+                        archetypeDefinition.setVersion( archetypeCreationQueryer.getArchetypeVersion( project.getVersion() ) );
                     }
 
-                    archetypeFactory.updateArchetypeConfiguration(
-                        archetypeConfiguration,
-                        archetypeDefinition
-                    );
-                }//</editor-fold>
+                    archetypeFactory.updateArchetypeConfiguration( archetypeConfiguration, archetypeDefinition );
+                } // </editor-fold>
 
-                if ( !archetypeConfiguration.isConfigured() )//<editor-fold text="...">
+                if ( !archetypeConfiguration.isConfigured() )// <editor-fold text="...">
                 {
                     getLogger().debug( "Archetype is not yet configured" );
                     if ( !archetypeConfiguration.isConfigured( Constants.GROUP_ID ) )
                     {
                         getLogger().debug( "Asking for project's groupId" );
                         archetypeConfiguration.setProperty(
-                            Constants.GROUP_ID,
-                            archetypeCreationQueryer.getGroupId(
-                                archetypeConfiguration.getDefaultValue( Constants.GROUP_ID )
-                            )
-                        );
+                                                            Constants.GROUP_ID,
+                                                            archetypeCreationQueryer.getGroupId( archetypeConfiguration.getDefaultValue( Constants.GROUP_ID ) ) );
                     }
                     if ( !archetypeConfiguration.isConfigured( Constants.ARTIFACT_ID ) )
                     {
                         getLogger().debug( "Asking for project's artifactId" );
                         archetypeConfiguration.setProperty(
-                            Constants.ARTIFACT_ID,
-                            archetypeCreationQueryer.getArtifactId(
-                                archetypeConfiguration.getDefaultValue( Constants.ARTIFACT_ID )
-                            )
-                        );
+                                                            Constants.ARTIFACT_ID,
+                                                            archetypeCreationQueryer.getArtifactId( archetypeConfiguration.getDefaultValue( Constants.ARTIFACT_ID ) ) );
                     }
                     if ( !archetypeConfiguration.isConfigured( Constants.VERSION ) )
                     {
                         getLogger().debug( "Asking for project's version" );
                         archetypeConfiguration.setProperty(
-                            Constants.VERSION,
-                            archetypeCreationQueryer.getVersion(
-                                archetypeConfiguration.getDefaultValue( Constants.VERSION )
-                            )
-                        );
+                                                            Constants.VERSION,
+                                                            archetypeCreationQueryer.getVersion( archetypeConfiguration.getDefaultValue( Constants.VERSION ) ) );
                     }
                     if ( !archetypeConfiguration.isConfigured( Constants.PACKAGE ) )
                     {
                         getLogger().debug( "Asking for project's package" );
                         archetypeConfiguration.setProperty(
-                            Constants.PACKAGE,
-                            archetypeCreationQueryer.getPackage(
-                                StringUtils.isEmpty( resolvedPackage )
-                                    ? archetypeConfiguration.getDefaultValue( Constants.PACKAGE )
-                                    : resolvedPackage
-                            )
-                        );
+                                                            Constants.PACKAGE,
+                                                            archetypeCreationQueryer.getPackage( StringUtils.isEmpty( resolvedPackage ) ? archetypeConfiguration.getDefaultValue( Constants.PACKAGE )
+                                                                            : resolvedPackage ) );
                     }
-                }//</editor-fold>
+                } // </editor-fold>
 
                 boolean stopAddingProperties = false;
                 while ( !stopAddingProperties )
@@ -206,9 +161,8 @@
 
                         String replacementValue =
                             archetypeCreationQueryer.askReplacementValue(
-                                propertyKey,
-                                archetypeConfiguration.getDefaultValue( propertyKey )
-                            );
+                                                                          propertyKey,
+                                                                          archetypeConfiguration.getDefaultValue( propertyKey ) );
                         archetypeConfiguration.setDefaultProperty( propertyKey, replacementValue );
                         archetypeConfiguration.setProperty( propertyKey, replacementValue );
                     }
@@ -243,10 +197,7 @@
         return archetypeConfiguration.toProperties();
     }
 
-    private ArchetypeDefinition defineDefaultArchetype(
-        MavenProject project,
-        Properties properties
-    )
+    private ArchetypeDefinition defineDefaultArchetype( MavenProject project, Properties properties )
     {
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ) )
         {
@@ -254,10 +205,8 @@
         }
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) )
         {
-            properties.setProperty(
-                Constants.ARCHETYPE_ARTIFACT_ID,
-                project.getArtifactId() + Constants.ARCHETYPE_SUFFIX
-            );
+            properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()
+                + Constants.ARCHETYPE_SUFFIX );
         }
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) )
         {
@@ -267,12 +216,9 @@
         return archetypeFactory.createArchetypeDefinition( properties );
     }
 
-    private ArchetypeConfiguration defineDefaultConfiguration(
-        MavenProject project,
-        ArchetypeDefinition archetypeDefinition,
-        String resolvedPackage,
-        Properties properties
-    )
+    private ArchetypeConfiguration defineDefaultConfiguration( MavenProject project,
+                                                               ArchetypeDefinition archetypeDefinition,
+                                                               String resolvedPackage, Properties properties )
     {
         if ( StringUtils.isEmpty( properties.getProperty( Constants.GROUP_ID ) ) )
         {
@@ -291,7 +237,7 @@
             getLogger().info( "Setting default version: " + project.getVersion() );
             properties.setProperty( Constants.VERSION, project.getVersion() );
         }
-        
+
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ) )
         {
             getLogger().info( "Setting default archetype's groupId: " + project.getGroupId() );
@@ -301,7 +247,8 @@
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) )
         {
             getLogger().info( "Setting default archetype's artifactId: " + project.getArtifactId() );
-            properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()+Constants.ARCHETYPE_SUFFIX );
+            properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()
+                + Constants.ARCHETYPE_SUFFIX );
         }
 
         if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) )
@@ -310,35 +257,22 @@
             properties.setProperty( Constants.ARCHETYPE_VERSION, project.getVersion() );
         }
 
-        if ( StringUtils.isEmpty(
-            properties.getProperty(
-                Constants.PACKAGE/*,
-                    properties.getProperty ( Constants.PACKAGE_NAME )*/
-            )
-        )
-            )
+        if ( StringUtils.isEmpty( properties.getProperty( Constants.PACKAGE /*, properties.getProperty ( Constants.PACKAGE_NAME ) */ ) ) )
         {
             if ( StringUtils.isEmpty( resolvedPackage ) )
             {
                 resolvedPackage = project.getGroupId();
             }
             getLogger().info( "Setting default package: " + resolvedPackage );
-            /*properties.setProperty ( Constants.PACKAGE_NAME, resolvedPackage );*/
+            /* properties.setProperty ( Constants.PACKAGE_NAME, resolvedPackage ); */
             properties.setProperty( Constants.PACKAGE, resolvedPackage );
         }
 
-        return
-            archetypeFactory.createArchetypeConfiguration(
-                project,
-                archetypeDefinition,
-                properties
-            );
+        return archetypeFactory.createArchetypeConfiguration( project, archetypeDefinition, properties );
     }
 
-    public void readProperties( Properties properties,
-                                File propertyFile )
-        throws
-        IOException
+    public void readProperties( Properties properties, File propertyFile )
+        throws IOException
     {
         getLogger().debug( "Reading property file " + propertyFile );
 
@@ -356,10 +290,8 @@
         }
     }
 
-    public void writeProperties( Properties properties,
-                                 File propertyFile )
-        throws
-        IOException
+    public void writeProperties( Properties properties, File propertyFile )
+        throws IOException
     {
         Properties storedProperties = new Properties();
         try
@@ -393,13 +325,9 @@
             IOUtil.close( os );
         }
     }
-    
-    private Properties initialiseArchetypeProperties(
-        Properties commandLineProperties,
-        File propertyFile
-    )
-        throws
-        IOException
+
+    private Properties initialiseArchetypeProperties( Properties commandLineProperties, File propertyFile )
+        throws IOException
     {
         Properties properties = new Properties();
 
@@ -418,25 +346,25 @@
         return properties;
     }
 
-    private Properties removeDottedProperties(Properties properties) {
-        List toRemove=new ArrayList(0);
-        Iterator keys = properties.keySet().iterator();
-        while (keys.hasNext())
+    private Properties removeDottedProperties( Properties properties )
+    {
+        List toRemove = new ArrayList( 0 );
+
+        for ( Iterator keys = properties.keySet().iterator(); keys.hasNext(); )
         {
             String key = (String) keys.next();
-            if (key.indexOf(".")>=0)
+            if ( key.indexOf( "." ) >= 0 )
             {
-                toRemove.add(key);
+                toRemove.add( key );
             }
         }
-        Iterator keysToRemove =toRemove.iterator();
-        while(keysToRemove.hasNext())
+
+        for ( Iterator keysToRemove = toRemove.iterator(); keysToRemove.hasNext(); )
         {
             String key = (String) keysToRemove.next();
-            properties.remove(key);
+
+            properties.remove( key );
         }
         return properties;
-            
-        
     }
 }
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java
index 43c1341..9979edf 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.apache.maven.archetype.common.Constants;
 import org.codehaus.plexus.components.interactivity.Prompter;
@@ -36,36 +36,31 @@
     private Prompter prompter;
 
     public String getArchetypeArtifactId( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.ARCHETYPE_ARTIFACT_ID, defaultValue );
     }
 
     public String getArchetypeGroupId( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.ARCHETYPE_GROUP_ID, defaultValue );
     }
 
     public String getArchetypeVersion( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.ARCHETYPE_VERSION, defaultValue );
     }
 
     public String getArtifactId( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.ARTIFACT_ID, defaultValue );
     }
 
     public boolean askAddAnotherProperty()
-        throws
-        PrompterException
+        throws PrompterException
     {
         String query = "Add a new custom property";
 
@@ -75,8 +70,7 @@
     }
 
     public String askNewPropertyKey()
-        throws
-        PrompterException
+        throws PrompterException
     {
         String query = "Define property key";
 
@@ -85,27 +79,23 @@
         return answer;
     }
 
-    public String askReplacementValue( String propertyKey,
-                                       String defaultValue )
-        throws
-        PrompterException
+    public String askReplacementValue( String propertyKey, String defaultValue )
+        throws PrompterException
     {
         return getValue( propertyKey, defaultValue );
     }
 
     public boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
-        throws
-        PrompterException
+        throws PrompterException
     {
-        String query = "Confirm archetype configuration:\n";
-        query += Constants.ARCHETYPE_GROUP_ID + "=" + archetypeConfiguration.getGroupId() + "\n";
-        query +=
-            Constants.ARCHETYPE_ARTIFACT_ID + "=" + archetypeConfiguration.getArtifactId() + "\n";
-        query += Constants.ARCHETYPE_VERSION + "=" + archetypeConfiguration.getVersion() + "\n";
+        String query =
+            "Confirm archetype configuration:\n" + Constants.ARCHETYPE_GROUP_ID + "="
+                + archetypeConfiguration.getGroupId() + "\n" + Constants.ARCHETYPE_ARTIFACT_ID + "="
+                + archetypeConfiguration.getArtifactId() + "\n" + Constants.ARCHETYPE_VERSION + "="
+                + archetypeConfiguration.getVersion() + "\n";
 
-        Iterator propertiesIter = archetypeConfiguration.getProperties().keySet().iterator();
-
-        while ( propertiesIter.hasNext() )
+        for ( Iterator propertiesIter = archetypeConfiguration.getProperties().keySet().iterator();
+            propertiesIter.hasNext(); )
         {
             String property = (String) propertiesIter.next();
             query += property + "=" + archetypeConfiguration.getProperty( property ) + "\n";
@@ -117,30 +107,25 @@
     }
 
     public String getGroupId( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.GROUP_ID, defaultValue );
     }
 
     public String getPackage( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.PACKAGE, defaultValue );
     }
 
     public String getVersion( String defaultValue )
-        throws
-        PrompterException
+        throws PrompterException
     {
         return getValue( Constants.VERSION, defaultValue );
     }
 
-    private String getValue( String requiredProperty,
-                             String defaultValue )
-        throws
-        PrompterException
+    private String getValue( String requiredProperty, String defaultValue )
+        throws PrompterException
     {
         String query = "Define value for " + requiredProperty + ": ";
         String answer;
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java
index 2201fc7..d6b1de1 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java
@@ -1,371 +1,373 @@
-/*

- * 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.ui;

-

-import org.apache.maven.archetype.common.ArchetypeConfiguration;

-import org.apache.maven.archetype.common.ArchetypeDefinition;

-import org.apache.maven.archetype.common.Constants;

-import org.apache.maven.project.MavenProject;

-

-import org.codehaus.plexus.logging.AbstractLogEnabled;

-

-import java.util.Iterator;

-import java.util.Properties;

-

-/**

- * @plexus.component

- */

-public class DefaultArchetypeFactory

-extends AbstractLogEnabled

-implements ArchetypeFactory

-{

-    public ArchetypeConfiguration createArchetypeConfiguration( ArchetypeDefinition archetypeDefinition,

-        Properties properties )

-    {

-        ArchetypeConfiguration configuration = new ArchetypeConfiguration();

-        getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition and Properties" );

-

-        configuration.setGroupId( archetypeDefinition.getGroupId() );

-        configuration.setArtifactId( archetypeDefinition.getArtifactId() );

-        configuration.setVersion( archetypeDefinition.getVersion() );

-

-        Iterator propertiesIterator = properties.keySet().iterator();

-        while ( propertiesIterator.hasNext() )

-        {

-            String property = (String) propertiesIterator.next();

-            if ( !Constants.ARCHETYPE_GROUP_ID.equals( property ) && !Constants.ARCHETYPE_ARTIFACT_ID.equals( property )

-                && !Constants.ARCHETYPE_VERSION.equals( property ) )

-            {

-                configuration.addRequiredProperty( property );

-

-                getLogger().debug( "Adding requiredProperty " + property );

-

-                configuration.setProperty( property, properties.getProperty( property ) );

-

-                getLogger().debug( "Adding property " + property + "=" + properties.getProperty( property ) );

-            }

-        }

-

-        return configuration;

-    }

-

-    public ArchetypeConfiguration createArchetypeConfiguration(

-        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor, Properties properties )

-    {

-        ArchetypeConfiguration configuration = new ArchetypeConfiguration();

-        getLogger().debug( "Creating ArchetypeConfiguration from legacy descriptor and Properties" );

-

-        configuration.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );

-        configuration.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );

-        configuration.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );

-

-        configuration.setName( archetypeDescriptor.getId() );

-

-        configuration.addRequiredProperty( Constants.GROUP_ID );

-        getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );

-        if ( null != properties.getProperty( Constants.GROUP_ID ) )

-        {

-            configuration.setProperty( Constants.GROUP_ID, properties.getProperty( Constants.GROUP_ID ) );

-            configuration.setDefaultProperty( Constants.GROUP_ID, configuration.getProperty( Constants.GROUP_ID ) );

-        }

-        getLogger().debug( "Setting property " + Constants.GROUP_ID + "="

-            + configuration.getProperty( Constants.GROUP_ID ) );

-

-        configuration.addRequiredProperty( Constants.ARTIFACT_ID );

-        getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );

-        if ( null != properties.getProperty( Constants.ARTIFACT_ID ) )

-        {

-            configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );

-            configuration.setDefaultProperty( Constants.ARTIFACT_ID,

-                configuration.getProperty( Constants.ARTIFACT_ID ) );

-        }

-        getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="

-            + configuration.getProperty( Constants.ARTIFACT_ID ) );

-

-        configuration.addRequiredProperty( Constants.VERSION );

-        getLogger().debug( "Adding requiredProperty " + Constants.VERSION );

-        if ( null != properties.getProperty( Constants.VERSION ) )

-        {

-            configuration.setProperty( Constants.VERSION, properties.getProperty( Constants.VERSION ) );

-            configuration.setDefaultProperty( Constants.VERSION, configuration.getProperty( Constants.VERSION ) );

-        }

-        else

-        {

-            configuration.setDefaultProperty( Constants.VERSION, "1.0-SNAPSHOT" );

-        }

-        getLogger().debug( "Setting property " + Constants.VERSION + "="

-            + configuration.getProperty( Constants.VERSION ) );

-

-        configuration.addRequiredProperty( Constants.PACKAGE );

-        getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );

-        if ( null != properties.getProperty( Constants.PACKAGE ) )

-        {

-            configuration.setProperty( Constants.PACKAGE, properties.getProperty( Constants.PACKAGE ) );

-            configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );

-        }

-        else if ( null != configuration.getProperty( Constants.GROUP_ID ) )

-        {

-            configuration.setProperty( Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ) );

-            configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );

-        }

-        getLogger().debug( "Setting property " + Constants.PACKAGE + "="

-            + configuration.getProperty( Constants.PACKAGE ) );

-

-        return configuration;

-    }

-

-    public ArchetypeConfiguration createArchetypeConfiguration(

-        org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor, Properties properties )

-    {

-        ArchetypeConfiguration configuration = new ArchetypeConfiguration();

-        getLogger().debug( "Creating ArchetypeConfiguration from fileset descriptor and Properties" );

-

-        configuration.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );

-        configuration.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );

-        configuration.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );

-

-        configuration.setName( archetypeDescriptor.getName() );

-

-        Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();

-

-        while ( requiredProperties.hasNext() )

-        {

-            org.apache.maven.archetype.metadata.RequiredProperty requiredProperty =

-                (org.apache.maven.archetype.metadata.RequiredProperty) requiredProperties.next();

-

-            configuration.addRequiredProperty( requiredProperty.getKey() );

-            getLogger().debug( "Adding requiredProperty " + requiredProperty.getKey() );

-

-            if ( null != properties.getProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() )

-                && !containsInnerProperty(requiredProperty.getDefaultValue()) )

-            {

-                configuration.setProperty( requiredProperty.getKey(),

-                    properties.getProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() ) );

-                getLogger().debug( "Setting property " + requiredProperty.getKey() + "="

-                    + configuration.getProperty( requiredProperty.getKey() ) );

-            }

-            if ( null != requiredProperty.getDefaultValue() )

-            {

-                configuration.setDefaultProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() );

-                getLogger().debug( "Setting defaultProperty " + requiredProperty.getKey() + "="

-                    + configuration.getDefaultValue( requiredProperty.getKey() ) );

-            }

-        } // end while

-

-        if ( !configuration.isConfigured( Constants.GROUP_ID )

-                        && null == configuration.getDefaultValue( Constants.GROUP_ID ) )

-        {

-            configuration.addRequiredProperty( Constants.GROUP_ID );

-            getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );

-            if ( null

-                != properties.getProperty( Constants.GROUP_ID, configuration.getDefaultValue( Constants.GROUP_ID ) )

-                && !containsInnerProperty( configuration.getDefaultValue( Constants.GROUP_ID ) ) )

-            {

-                configuration.setProperty( Constants.GROUP_ID,

-                    properties.getProperty( Constants.GROUP_ID, configuration.getDefaultValue( Constants.GROUP_ID ) ) );

-                configuration.setDefaultProperty( Constants.GROUP_ID, configuration.getProperty( Constants.GROUP_ID ) );

-            }

-            getLogger().debug( "Setting property " + Constants.GROUP_ID + "="

-                + configuration.getProperty( Constants.GROUP_ID ) );

-        }

-        if ( !configuration.isConfigured( Constants.ARTIFACT_ID )

-                        && null == configuration.getDefaultValue( Constants.ARTIFACT_ID ) )

-        {

-            configuration.addRequiredProperty( Constants.ARTIFACT_ID );

-            getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );

-            if ( null

-                != properties.getProperty( Constants.ARTIFACT_ID,

-                    configuration.getDefaultValue( Constants.ARTIFACT_ID ) )

-                && !containsInnerProperty( configuration.getDefaultValue( Constants.ARTIFACT_ID ) ) )

-            {

-                configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );

-                configuration.setDefaultProperty( Constants.ARTIFACT_ID,

-                    configuration.getProperty( Constants.ARTIFACT_ID ) );

-            }

-            getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="

-                + configuration.getProperty( Constants.ARTIFACT_ID ) );

-        }

-        if ( !configuration.isConfigured( Constants.VERSION )

-                        && null == configuration.getDefaultValue( Constants.VERSION ) )

-        {

-            configuration.addRequiredProperty( Constants.VERSION );

-            getLogger().debug( "Adding requiredProperty " + Constants.VERSION );

-            if ( null != properties.getProperty( Constants.VERSION,

-                    configuration.getDefaultValue( Constants.VERSION ) )

-                && !containsInnerProperty( configuration.getDefaultValue( Constants.VERSION ) ) )

-            {

-                configuration.setProperty( Constants.VERSION,

-                    properties.getProperty( Constants.VERSION, configuration.getDefaultValue( Constants.VERSION ) ) );

-                configuration.setDefaultProperty( Constants.VERSION, configuration.getProperty( Constants.VERSION ) );

-            }

-            else

-            {

-                configuration.setDefaultProperty( Constants.VERSION, "1.0-SNAPSHOT" );

-            }

-            getLogger().debug( "Setting property " + Constants.VERSION + "="

-                + configuration.getProperty( Constants.VERSION ) );

-        }

-        if ( !configuration.isConfigured( Constants.PACKAGE )

-                        && null == configuration.getDefaultValue( Constants.PACKAGE ) )

-        {

-            configuration.addRequiredProperty( Constants.PACKAGE );

-            getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );

-            if ( null != properties.getProperty( Constants.PACKAGE,

-                    configuration.getDefaultValue( Constants.PACKAGE ) )

-                && !containsInnerProperty(configuration.getDefaultValue( Constants.PACKAGE ) ) )

-            {

-                configuration.setProperty( Constants.PACKAGE,

-                    properties.getProperty( Constants.PACKAGE, configuration.getDefaultValue( Constants.PACKAGE ) ) );

-                configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );

-            }

-            else if ( null != configuration.getProperty( Constants.GROUP_ID )

-                && !containsInnerProperty(configuration.getDefaultValue( Constants.PACKAGE ) ) )

-            {

-                configuration.setProperty( Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ) );

-                configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );

-            }

-            getLogger().debug( "Setting property " + Constants.PACKAGE + "="

-                + configuration.getProperty( Constants.PACKAGE ) );

-        }

-

-        if ( null != properties.getProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS ) )

-        {

-            configuration.setProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS,

-                properties.getProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS ) );

-        }

-

-        return configuration;

-    }

-

-    public ArchetypeConfiguration createArchetypeConfiguration( MavenProject project,

-        ArchetypeDefinition archetypeDefinition, Properties properties )

-    {

-        ArchetypeConfiguration configuration = new ArchetypeConfiguration();

-        getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition, MavenProject and Properties" );

-

-        configuration.setGroupId( properties.getProperty(Constants.ARCHETYPE_GROUP_ID) );

-        configuration.setArtifactId( properties.getProperty(Constants.ARCHETYPE_ARTIFACT_ID) );

-        configuration.setVersion( properties.getProperty(Constants.ARCHETYPE_VERSION) );

-

-        Iterator requiredProperties = properties.keySet().iterator();

-

-        while ( requiredProperties.hasNext() )

-        {

-            String requiredProperty = (String) requiredProperties.next();

-

-            if ( requiredProperty.indexOf( "." ) < 0 )

-            {

-                configuration.addRequiredProperty( requiredProperty );

-                getLogger().debug( "Adding requiredProperty " + requiredProperty );

-                configuration.setProperty( requiredProperty, properties.getProperty( requiredProperty ) );

-                getLogger().debug( "Setting property " + requiredProperty + "="

-                    + configuration.getProperty( requiredProperty ) );

-            }

-        }

-

-        configuration.addRequiredProperty( Constants.GROUP_ID );

-        getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );

-        configuration.setDefaultProperty( Constants.GROUP_ID, project.getGroupId() );

-        if ( null != properties.getProperty( Constants.GROUP_ID, null ) )

-        {

-            configuration.setProperty( Constants.GROUP_ID, properties.getProperty( Constants.GROUP_ID ) );

-            getLogger().debug( "Setting property " + Constants.GROUP_ID + "="

-                + configuration.getProperty( Constants.GROUP_ID ) );

-        }

-

-        configuration.addRequiredProperty( Constants.ARTIFACT_ID );

-        getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );

-        configuration.setDefaultProperty( Constants.ARTIFACT_ID, project.getArtifactId() );

-        if ( null != properties.getProperty( Constants.ARTIFACT_ID, null ) )

-        {

-            configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );

-            getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="

-                + configuration.getProperty( Constants.ARTIFACT_ID ) );

-        }

-

-        configuration.addRequiredProperty( Constants.VERSION );

-        getLogger().debug( "Adding requiredProperty " + Constants.VERSION );

-        configuration.setDefaultProperty( Constants.VERSION, project.getVersion() );

-        if ( null != properties.getProperty( Constants.VERSION, null ) )

-        {

-            configuration.setProperty( Constants.VERSION, properties.getProperty( Constants.VERSION ) );

-            getLogger().debug( "Setting property " + Constants.VERSION + "="

-                + configuration.getProperty( Constants.VERSION ) );

-        }

-

-        configuration.addRequiredProperty( Constants.PACKAGE );

-        getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );

-        if ( null != properties.getProperty( Constants.PACKAGE ) )

-        {

-            configuration.setProperty( Constants.PACKAGE, properties.getProperty( Constants.PACKAGE ) );

-

-            getLogger().debug( "Setting property " + Constants.PACKAGE + "="

-                + configuration.getProperty( Constants.PACKAGE ) );

-        }

-

-        if ( null != properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) )

-        {

-            configuration.setProperty( Constants.ARCHETYPE_GROUP_ID, properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) );

-        }

-

-        if ( null != properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) )

-        {

-            configuration.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) );

-        }

-

-        if ( null != properties.getProperty( Constants.ARCHETYPE_VERSION, null ) )

-        {

-            configuration.setProperty( Constants.ARCHETYPE_VERSION, properties.getProperty( Constants.ARCHETYPE_VERSION ) );

-        }

-        return configuration;

-    }

-

-    public ArchetypeDefinition createArchetypeDefinition( Properties properties )

-    {

-        ArchetypeDefinition definition = new ArchetypeDefinition();

-

-        definition.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );

-

-        definition.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );

-

-        definition.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );

-

-        definition.setRepository( properties.getProperty( Constants.ARCHETYPE_REPOSITORY, null ) );

-

-        return definition;

-    }

-

-    public void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration,

-        ArchetypeDefinition archetypeDefinition )

-    {

-        archetypeConfiguration.setGroupId( archetypeDefinition.getGroupId() );

-        archetypeConfiguration.setArtifactId( archetypeDefinition.getArtifactId() );

-        archetypeConfiguration.setVersion( archetypeDefinition.getVersion() );

-    }

-

-    private boolean containsInnerProperty(String defaultValue)

-    {

-        if ( null == defaultValue )

-        {

-            return false;

-        }

-        return ( defaultValue.indexOf( "${" ) >= 0 ) && ( defaultValue.indexOf( "}" ) >= 0 );

-    }

-}

+package org.apache.maven.archetype.ui;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.archetype.common.ArchetypeConfiguration;
+import org.apache.maven.archetype.common.ArchetypeDefinition;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeFactory
+    extends AbstractLogEnabled
+    implements ArchetypeFactory
+{
+    public ArchetypeConfiguration createArchetypeConfiguration( ArchetypeDefinition archetypeDefinition,
+        Properties properties )
+    {
+        ArchetypeConfiguration configuration = new ArchetypeConfiguration();
+        getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition and Properties" );
+
+        configuration.setGroupId( archetypeDefinition.getGroupId() );
+        configuration.setArtifactId( archetypeDefinition.getArtifactId() );
+        configuration.setVersion( archetypeDefinition.getVersion() );
+
+        for ( Iterator propertiesIterator = properties.keySet().iterator(); propertiesIterator.hasNext(); )
+        {
+            String property = (String) propertiesIterator.next();
+
+            if ( !Constants.ARCHETYPE_GROUP_ID.equals( property ) && !Constants.ARCHETYPE_ARTIFACT_ID.equals( property )
+                && !Constants.ARCHETYPE_VERSION.equals( property ) )
+            {
+                configuration.addRequiredProperty( property );
+
+                getLogger().debug( "Adding requiredProperty " + property );
+
+                configuration.setProperty( property, properties.getProperty( property ) );
+
+                getLogger().debug( "Adding property " + property + "=" + properties.getProperty( property ) );
+            }
+        }
+
+        return configuration;
+    }
+
+    public ArchetypeConfiguration createArchetypeConfiguration(
+        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor, Properties properties )
+    {
+        ArchetypeConfiguration configuration = new ArchetypeConfiguration();
+        getLogger().debug( "Creating ArchetypeConfiguration from legacy descriptor and Properties" );
+
+        configuration.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );
+        configuration.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );
+        configuration.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );
+
+        configuration.setName( archetypeDescriptor.getId() );
+
+        configuration.addRequiredProperty( Constants.GROUP_ID );
+        getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );
+        if ( null != properties.getProperty( Constants.GROUP_ID ) )
+        {
+            configuration.setProperty( Constants.GROUP_ID, properties.getProperty( Constants.GROUP_ID ) );
+            configuration.setDefaultProperty( Constants.GROUP_ID, configuration.getProperty( Constants.GROUP_ID ) );
+        }
+        getLogger().debug( "Setting property " + Constants.GROUP_ID + "="
+            + configuration.getProperty( Constants.GROUP_ID ) );
+
+        configuration.addRequiredProperty( Constants.ARTIFACT_ID );
+        getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );
+        if ( null != properties.getProperty( Constants.ARTIFACT_ID ) )
+        {
+            configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );
+            configuration.setDefaultProperty( Constants.ARTIFACT_ID,
+                configuration.getProperty( Constants.ARTIFACT_ID ) );
+        }
+        getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="
+            + configuration.getProperty( Constants.ARTIFACT_ID ) );
+
+        configuration.addRequiredProperty( Constants.VERSION );
+        getLogger().debug( "Adding requiredProperty " + Constants.VERSION );
+        if ( null != properties.getProperty( Constants.VERSION ) )
+        {
+            configuration.setProperty( Constants.VERSION, properties.getProperty( Constants.VERSION ) );
+            configuration.setDefaultProperty( Constants.VERSION, configuration.getProperty( Constants.VERSION ) );
+        }
+        else
+        {
+            configuration.setDefaultProperty( Constants.VERSION, "1.0-SNAPSHOT" );
+        }
+        getLogger().debug( "Setting property " + Constants.VERSION + "="
+            + configuration.getProperty( Constants.VERSION ) );
+
+        configuration.addRequiredProperty( Constants.PACKAGE );
+        getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );
+        if ( null != properties.getProperty( Constants.PACKAGE ) )
+        {
+            configuration.setProperty( Constants.PACKAGE, properties.getProperty( Constants.PACKAGE ) );
+            configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );
+        }
+        else if ( null != configuration.getProperty( Constants.GROUP_ID ) )
+        {
+            configuration.setProperty( Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ) );
+            configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );
+        }
+        getLogger().debug( "Setting property " + Constants.PACKAGE + "="
+            + configuration.getProperty( Constants.PACKAGE ) );
+
+        return configuration;
+    }
+
+    public ArchetypeConfiguration createArchetypeConfiguration(
+        org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor, Properties properties )
+    {
+        ArchetypeConfiguration configuration = new ArchetypeConfiguration();
+        getLogger().debug( "Creating ArchetypeConfiguration from fileset descriptor and Properties" );
+
+        configuration.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );
+        configuration.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );
+        configuration.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );
+
+        configuration.setName( archetypeDescriptor.getName() );
+
+        for ( Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
+            requiredProperties.hasNext(); )
+        {
+            org.apache.maven.archetype.metadata.RequiredProperty requiredProperty =
+                (org.apache.maven.archetype.metadata.RequiredProperty) requiredProperties.next();
+
+            configuration.addRequiredProperty( requiredProperty.getKey() );
+            getLogger().debug( "Adding requiredProperty " + requiredProperty.getKey() );
+
+            if ( null != properties.getProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() )
+                && !containsInnerProperty( requiredProperty.getDefaultValue() ) )
+            {
+                configuration.setProperty( requiredProperty.getKey(),
+                    properties.getProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() ) );
+                getLogger().debug( "Setting property " + requiredProperty.getKey() + "="
+                    + configuration.getProperty( requiredProperty.getKey() ) );
+            }
+            if ( null != requiredProperty.getDefaultValue() )
+            {
+                configuration.setDefaultProperty( requiredProperty.getKey(), requiredProperty.getDefaultValue() );
+                getLogger().debug( "Setting defaultProperty " + requiredProperty.getKey() + "="
+                    + configuration.getDefaultValue( requiredProperty.getKey() ) );
+            }
+        }
+
+        if ( !configuration.isConfigured( Constants.GROUP_ID )
+                        && null == configuration.getDefaultValue( Constants.GROUP_ID ) )
+        {
+            configuration.addRequiredProperty( Constants.GROUP_ID );
+            getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );
+            if ( null
+                != properties.getProperty( Constants.GROUP_ID, configuration.getDefaultValue( Constants.GROUP_ID ) )
+                && !containsInnerProperty( configuration.getDefaultValue( Constants.GROUP_ID ) ) )
+            {
+                configuration.setProperty( Constants.GROUP_ID,
+                    properties.getProperty( Constants.GROUP_ID, configuration.getDefaultValue( Constants.GROUP_ID ) ) );
+                configuration.setDefaultProperty( Constants.GROUP_ID, configuration.getProperty( Constants.GROUP_ID ) );
+            }
+            getLogger().debug( "Setting property " + Constants.GROUP_ID + "="
+                + configuration.getProperty( Constants.GROUP_ID ) );
+        }
+
+        if ( !configuration.isConfigured( Constants.ARTIFACT_ID )
+                        && null == configuration.getDefaultValue( Constants.ARTIFACT_ID ) )
+        {
+            configuration.addRequiredProperty( Constants.ARTIFACT_ID );
+            getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );
+            if ( null
+                != properties.getProperty( Constants.ARTIFACT_ID,
+                    configuration.getDefaultValue( Constants.ARTIFACT_ID ) )
+                && !containsInnerProperty( configuration.getDefaultValue( Constants.ARTIFACT_ID ) ) )
+            {
+                configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );
+                configuration.setDefaultProperty( Constants.ARTIFACT_ID,
+                    configuration.getProperty( Constants.ARTIFACT_ID ) );
+            }
+            getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="
+                + configuration.getProperty( Constants.ARTIFACT_ID ) );
+        }
+
+        if ( !configuration.isConfigured( Constants.VERSION )
+                        && null == configuration.getDefaultValue( Constants.VERSION ) )
+        {
+            configuration.addRequiredProperty( Constants.VERSION );
+            getLogger().debug( "Adding requiredProperty " + Constants.VERSION );
+            if ( null != properties.getProperty( Constants.VERSION,
+                    configuration.getDefaultValue( Constants.VERSION ) )
+                && !containsInnerProperty( configuration.getDefaultValue( Constants.VERSION ) ) )
+            {
+                configuration.setProperty( Constants.VERSION,
+                    properties.getProperty( Constants.VERSION, configuration.getDefaultValue( Constants.VERSION ) ) );
+                configuration.setDefaultProperty( Constants.VERSION, configuration.getProperty( Constants.VERSION ) );
+            }
+            else
+            {
+                configuration.setDefaultProperty( Constants.VERSION, "1.0-SNAPSHOT" );
+            }
+            getLogger().debug( "Setting property " + Constants.VERSION + "="
+                + configuration.getProperty( Constants.VERSION ) );
+        }
+
+        if ( !configuration.isConfigured( Constants.PACKAGE )
+                        && null == configuration.getDefaultValue( Constants.PACKAGE ) )
+        {
+            configuration.addRequiredProperty( Constants.PACKAGE );
+            getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );
+            if ( null != properties.getProperty( Constants.PACKAGE,
+                    configuration.getDefaultValue( Constants.PACKAGE ) )
+                && !containsInnerProperty( configuration.getDefaultValue( Constants.PACKAGE ) ) )
+            {
+                configuration.setProperty( Constants.PACKAGE,
+                    properties.getProperty( Constants.PACKAGE, configuration.getDefaultValue( Constants.PACKAGE ) ) );
+                configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );
+            }
+            else if ( null != configuration.getProperty( Constants.GROUP_ID )
+                && !containsInnerProperty( configuration.getDefaultValue( Constants.PACKAGE ) ) )
+            {
+                configuration.setProperty( Constants.PACKAGE, configuration.getProperty( Constants.GROUP_ID ) );
+                configuration.setDefaultProperty( Constants.PACKAGE, configuration.getProperty( Constants.PACKAGE ) );
+            }
+            getLogger().debug( "Setting property " + Constants.PACKAGE + "="
+                + configuration.getProperty( Constants.PACKAGE ) );
+        }
+
+        if ( null != properties.getProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS ) )
+        {
+            configuration.setProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS,
+                properties.getProperty( Constants.ARCHETYPE_POST_GENERATION_GOALS ) );
+        }
+
+        return configuration;
+    }
+
+    public ArchetypeConfiguration createArchetypeConfiguration( MavenProject project,
+        ArchetypeDefinition archetypeDefinition, Properties properties )
+    {
+        ArchetypeConfiguration configuration = new ArchetypeConfiguration();
+        getLogger().debug( "Creating ArchetypeConfiguration from ArchetypeDefinition, MavenProject and Properties" );
+
+        configuration.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) );
+        configuration.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) );
+        configuration.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION ) );
+
+        Iterator requiredProperties = properties.keySet().iterator();
+
+        while ( requiredProperties.hasNext() )
+        {
+            String requiredProperty = (String) requiredProperties.next();
+
+            if ( requiredProperty.indexOf( "." ) < 0 )
+            {
+                configuration.addRequiredProperty( requiredProperty );
+                getLogger().debug( "Adding requiredProperty " + requiredProperty );
+                configuration.setProperty( requiredProperty, properties.getProperty( requiredProperty ) );
+                getLogger().debug( "Setting property " + requiredProperty + "="
+                    + configuration.getProperty( requiredProperty ) );
+            }
+        }
+
+        configuration.addRequiredProperty( Constants.GROUP_ID );
+        getLogger().debug( "Adding requiredProperty " + Constants.GROUP_ID );
+        configuration.setDefaultProperty( Constants.GROUP_ID, project.getGroupId() );
+        if ( null != properties.getProperty( Constants.GROUP_ID, null ) )
+        {
+            configuration.setProperty( Constants.GROUP_ID, properties.getProperty( Constants.GROUP_ID ) );
+            getLogger().debug( "Setting property " + Constants.GROUP_ID + "="
+                + configuration.getProperty( Constants.GROUP_ID ) );
+        }
+
+        configuration.addRequiredProperty( Constants.ARTIFACT_ID );
+        getLogger().debug( "Adding requiredProperty " + Constants.ARTIFACT_ID );
+        configuration.setDefaultProperty( Constants.ARTIFACT_ID, project.getArtifactId() );
+        if ( null != properties.getProperty( Constants.ARTIFACT_ID, null ) )
+        {
+            configuration.setProperty( Constants.ARTIFACT_ID, properties.getProperty( Constants.ARTIFACT_ID ) );
+            getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="
+                + configuration.getProperty( Constants.ARTIFACT_ID ) );
+        }
+
+        configuration.addRequiredProperty( Constants.VERSION );
+        getLogger().debug( "Adding requiredProperty " + Constants.VERSION );
+        configuration.setDefaultProperty( Constants.VERSION, project.getVersion() );
+        if ( null != properties.getProperty( Constants.VERSION, null ) )
+        {
+            configuration.setProperty( Constants.VERSION, properties.getProperty( Constants.VERSION ) );
+            getLogger().debug( "Setting property " + Constants.VERSION + "="
+                + configuration.getProperty( Constants.VERSION ) );
+        }
+
+        configuration.addRequiredProperty( Constants.PACKAGE );
+        getLogger().debug( "Adding requiredProperty " + Constants.PACKAGE );
+        if ( null != properties.getProperty( Constants.PACKAGE ) )
+        {
+            configuration.setProperty( Constants.PACKAGE, properties.getProperty( Constants.PACKAGE ) );
+
+            getLogger().debug( "Setting property " + Constants.PACKAGE + "="
+                + configuration.getProperty( Constants.PACKAGE ) );
+        }
+
+        if ( null != properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) )
+        {
+            configuration.setProperty( Constants.ARCHETYPE_GROUP_ID, properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) );
+        }
+
+        if ( null != properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) )
+        {
+            configuration.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) );
+        }
+
+        if ( null != properties.getProperty( Constants.ARCHETYPE_VERSION, null ) )
+        {
+            configuration.setProperty( Constants.ARCHETYPE_VERSION, properties.getProperty( Constants.ARCHETYPE_VERSION ) );
+        }
+        return configuration;
+    }
+
+    public ArchetypeDefinition createArchetypeDefinition( Properties properties )
+    {
+        ArchetypeDefinition definition = new ArchetypeDefinition();
+
+        definition.setGroupId( properties.getProperty( Constants.ARCHETYPE_GROUP_ID, null ) );
+
+        definition.setArtifactId( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID, null ) );
+
+        definition.setVersion( properties.getProperty( Constants.ARCHETYPE_VERSION, null ) );
+
+        definition.setRepository( properties.getProperty( Constants.ARCHETYPE_REPOSITORY, null ) );
+
+        return definition;
+    }
+
+    public void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration,
+        ArchetypeDefinition archetypeDefinition )
+    {
+        archetypeConfiguration.setGroupId( archetypeDefinition.getGroupId() );
+        archetypeConfiguration.setArtifactId( archetypeDefinition.getArtifactId() );
+        archetypeConfiguration.setVersion( archetypeDefinition.getVersion() );
+    }
+
+    private boolean containsInnerProperty( String defaultValue )
+    {
+        if ( null == defaultValue )
+        {
+            return false;
+        }
+        return ( defaultValue.indexOf( "${" ) >= 0 ) && ( defaultValue.indexOf( "}" ) >= 0 );
+    }
+}
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
index d3fbdf4..e0d7523 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
 import org.apache.maven.archetype.common.ArchetypeArtifactManager;
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
@@ -34,6 +34,7 @@
 
 import org.codehaus.plexus.components.interactivity.PrompterException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.IOException;
 
@@ -43,15 +44,14 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
-import org.codehaus.plexus.util.StringUtils;
 
 // TODO: this seems to have more responsibilities than just a configurator
 /**
  * @plexus.component
  */
 public class DefaultArchetypeGenerationConfigurator
-extends AbstractLogEnabled
-implements ArchetypeGenerationConfigurator
+    extends AbstractLogEnabled
+    implements ArchetypeGenerationConfigurator
 {
     /**
      * @plexus.requirement
@@ -84,12 +84,8 @@
     }
 
     public void configureArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode,
-        Properties executionProperties )
-    throws ArchetypeNotDefined,
-        UnknownArchetype,
-        ArchetypeNotConfigured,
-        IOException,
-        PrompterException,
+                                    Properties executionProperties )
+        throws ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, IOException, PrompterException,
         ArchetypeGenerationConfigurationFailure
     {
         ArtifactRepository localRepository = request.getLocalRepository();
@@ -121,8 +117,9 @@
         }
         if ( request.getArchetypeRepository() != null )
         {
-            archetypeRepository = archetypeRegistryManager.createRepository( request.getArchetypeRepository(),
-                    ad.getArtifactId() + "-repo" );
+            archetypeRepository =
+                archetypeRegistryManager.createRepository( request.getArchetypeRepository(),
+                                                           ad.getArtifactId() + "-repo" );
             repositories.add( archetypeRepository );
         }
         if ( request.getRemoteArtifactRepositories() != null )
@@ -142,20 +139,22 @@
         ArchetypeConfiguration archetypeConfiguration;
 
         if ( archetypeArtifactManager.isFileSetArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
-                archetypeRepository, localRepository, repositories ) )
+                                                          archetypeRepository, localRepository, repositories ) )
         {
-            org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager
-                .getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
-                    archetypeRepository, localRepository, repositories );
+            org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor =
+                archetypeArtifactManager.getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(),
+                                                                        ad.getVersion(), archetypeRepository,
+                                                                        localRepository, repositories );
 
             archetypeConfiguration = archetypeFactory.createArchetypeConfiguration( archetypeDescriptor, properties );
         }
         else if ( archetypeArtifactManager.isOldArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
-                archetypeRepository, localRepository, repositories ) )
+                                                           archetypeRepository, localRepository, repositories ) )
         {
-            org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager
-                .getOldArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository,
-                    localRepository, repositories );
+            org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor =
+                archetypeArtifactManager.getOldArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(),
+                                                                    ad.getVersion(), archetypeRepository,
+                                                                    localRepository, repositories );
 
             archetypeConfiguration = archetypeFactory.createArchetypeConfiguration( archetypeDescriptor, properties );
         }
@@ -174,49 +173,62 @@
                 getLogger().debug( "Required properties before content sort: " + propertiesRequired );
                 Collections.sort( propertiesRequired, new RequiredPropertyComparator( archetypeConfiguration ) );
                 getLogger().debug( "Required properties after content sort: " + propertiesRequired );
-                    Iterator requiredProperties = propertiesRequired.iterator();
+
                 if ( !archetypeConfiguration.isConfigured() )
                 {
-                    while ( requiredProperties.hasNext() )
+                    for ( Iterator requiredProperties = propertiesRequired.iterator(); requiredProperties.hasNext(); )
                     {
                         String requiredProperty = (String) requiredProperties.next();
 
                         if ( !archetypeConfiguration.isConfigured( requiredProperty ) )
                         {
-                            if ( "package".equals(requiredProperty) )
+                            if ( "package".equals( requiredProperty ) )
                             {
                                 // if the asked property is 'package', then
                                 // use its default and if not defined,
                                 // use the 'groupId' property value.
                                 String packageDefault = archetypeConfiguration.getDefaultValue( requiredProperty );
-                                packageDefault = ( null == packageDefault || "".equals( packageDefault ) ) ?
-                                    archetypeConfiguration.getProperty( "groupId" ) :
-                                    archetypeConfiguration.getDefaultValue( requiredProperty );
+                                packageDefault =
+                                    ( null == packageDefault || "".equals( packageDefault ) ) ? archetypeConfiguration.getProperty( "groupId" )
+                                                    : archetypeConfiguration.getDefaultValue( requiredProperty );
 
-                                archetypeConfiguration.setProperty( requiredProperty,
-                                    archetypeGenerationQueryer.getPropertyValue( requiredProperty,
-                                        getTransitiveDefaultValue(packageDefault, archetypeConfiguration) ) );
+                                archetypeConfiguration.setProperty(
+                                                                    requiredProperty,
+                                                                    archetypeGenerationQueryer.getPropertyValue(
+                                                                                                                 requiredProperty,
+                                                                                                                 getTransitiveDefaultValue(
+                                                                                                                                            packageDefault,
+                                                                                                                                            archetypeConfiguration ) ) );
                             }
                             else
                             {
-                                archetypeConfiguration.setProperty( requiredProperty,
-                                    archetypeGenerationQueryer.getPropertyValue( requiredProperty,
-                                        getTransitiveDefaultValue( archetypeConfiguration.getDefaultValue( requiredProperty ), archetypeConfiguration ) ) );
+                                archetypeConfiguration.setProperty(
+                                                                    requiredProperty,
+                                                                    archetypeGenerationQueryer.getPropertyValue(
+                                                                                                                 requiredProperty,
+                                                                                                                 getTransitiveDefaultValue(
+                                                                                                                                            archetypeConfiguration.getDefaultValue( requiredProperty ),
+                                                                                                                                            archetypeConfiguration ) ) );
                             }
                         }
                         else
                         {
-                            getLogger().info( "Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty( requiredProperty) );
+                            getLogger().info(
+                                              "Using property: " + requiredProperty + " = "
+                                                  + archetypeConfiguration.getProperty( requiredProperty ) );
                         }
                     }
                 }
                 else
                 {
 
-                    while ( requiredProperties.hasNext() )
+                    for ( Iterator requiredProperties = propertiesRequired.iterator(); requiredProperties.hasNext(); )
                     {
                         String requiredProperty = (String) requiredProperties.next();
-                        getLogger().info( "Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty( requiredProperty) );
+
+                        getLogger().info(
+                                          "Using property: " + requiredProperty + " = "
+                                              + archetypeConfiguration.getProperty( requiredProperty ) );
                     }
                 }
 
@@ -242,9 +254,8 @@
         {
             if ( !archetypeConfiguration.isConfigured() )
             {
-                Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
-
-                while ( requiredProperties.hasNext() )
+                for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+                    requiredProperties.hasNext(); )
                 {
                     String requiredProperty = (String) requiredProperties.next();
 
@@ -252,7 +263,7 @@
                         && ( archetypeConfiguration.getDefaultValue( requiredProperty ) != null ) )
                     {
                         archetypeConfiguration.setProperty( requiredProperty,
-                            archetypeConfiguration.getDefaultValue( requiredProperty ) );
+                                                            archetypeConfiguration.getDefaultValue( requiredProperty ) );
                     }
                 }
 
@@ -269,18 +280,20 @@
                     exceptionMessage.append( " is not configured" );
 
                     List missingProperties = new ArrayList( 0 );
-                    requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
-                    while ( requiredProperties.hasNext() )
+                    for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+                        requiredProperties.hasNext(); )
                     {
-                        String requiredProperty = (String)requiredProperties.next();
+                        String requiredProperty = (String) requiredProperties.next();
+
                         if ( !archetypeConfiguration.isConfigured( requiredProperty ) )
                         {
                             exceptionMessage.append( "\n\tProperty " );
                             exceptionMessage.append( requiredProperty );
                             missingProperties.add( requiredProperty );
                             exceptionMessage.append( " is missing." );
-                            getLogger().warn( "Property " + requiredProperty
-                                + " is missing. Add -D" + requiredProperty + "=someValue" );
+                            getLogger().warn(
+                                              "Property " + requiredProperty + " is missing. Add -D" + requiredProperty
+                                                  + "=someValue" );
                         }
                     }
 
@@ -309,14 +322,15 @@
         {
             return null;
         }
-        Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
-        while ( requiredProperties.hasNext() )
+        for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+            requiredProperties.hasNext(); )
         {
             String property = (String) requiredProperties.next();
+
             if ( result.indexOf( "${" + property + "}" ) >= 0 )
             {
                 result = StringUtils.replace( result, "${" + property + "}",
-                                              archetypeConfiguration.getProperty(property) );
+                                              archetypeConfiguration.getProperty( property ) );
             }
         }
         return result;
@@ -327,10 +341,10 @@
     {
         getLogger().debug( "Restoring command line properties" );
 
-        Iterator properties = archetypeConfiguration.getRequiredProperties().iterator();
-        while ( properties.hasNext() )
+        for ( Iterator properties = archetypeConfiguration.getRequiredProperties().iterator(); properties.hasNext(); )
         {
             String property = (String) properties.next();
+
             if ( executionProperties.containsKey( property ) )
             {
                 archetypeConfiguration.setProperty( property, executionProperties.getProperty( property ) );
@@ -363,11 +377,11 @@
                     return comparePropertyName( (String) left, (String) right );
                 }
                 else if ( leftDefault.indexOf( "${" + right + "}" ) >= 0 )
-                {//left contains right
+                { //left contains right
                     return 1;
                 }
                 else if ( rightDefault.indexOf( "${" + left + "}" ) >= 0 )
-                {//right contains left
+                { //right contains left
                     return -1;
                 }
                 else
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java
index 6ba04b7..4bb54e3 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,8 +19,6 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.maven.archetype.common.ArchetypeConfiguration;
 import org.codehaus.plexus.components.interactivity.Prompter;
 import org.codehaus.plexus.components.interactivity.PrompterException;
@@ -35,17 +35,15 @@
     private Prompter prompter;
 
     public boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
-        throws
-        PrompterException
+        throws PrompterException
     {
         String query = "Confirm properties configuration:\n";
 
-        Iterator requiredPropertiesIter =
-            archetypeConfiguration.getRequiredProperties().iterator();
-
-        while ( requiredPropertiesIter.hasNext() )
+        for ( Iterator requiredPropertiesIter = archetypeConfiguration.getRequiredProperties().iterator();
+            requiredPropertiesIter.hasNext(); )
         {
             String property = (String) requiredPropertiesIter.next();
+
             query += property + ": " + archetypeConfiguration.getProperty( property ) + "\n";
         }
 
@@ -54,10 +52,8 @@
         return "Y".equalsIgnoreCase( answer );
     }
 
-    public String getPropertyValue( String requiredProperty,
-                                    String defaultValue )
-        throws
-        PrompterException
+    public String getPropertyValue( String requiredProperty, String defaultValue )
+        throws PrompterException
     {
         String query = "Define value for property '" + requiredProperty + "': ";
         String answer;
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelectionQueryer.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelectionQueryer.java
index ad42fa3..93e34dd 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelectionQueryer.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelectionQueryer.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,16 +19,20 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
-//import org.apache.maven.archetype.common.Archetype;
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
 import org.codehaus.plexus.components.interactivity.Prompter;
 import org.codehaus.plexus.components.interactivity.PrompterException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /** @plexus.component */
 public class DefaultArchetypeSelectionQueryer
@@ -37,14 +43,13 @@
     private Prompter prompter;
 
     public boolean confirmSelection( ArchetypeDefinition archetypeDefinition )
-        throws
-        PrompterException
+        throws PrompterException
     {
         String query =
-            "Confirm archetype selection: \n" + archetypeDefinition.getGroupId() + "/"
-                + archetypeDefinition.getName() + "\n";
+            "Confirm archetype selection: \n" + archetypeDefinition.getGroupId() + "/" + archetypeDefinition.getName()
+                + "\n";
 
-        String answer = prompter.prompt( query, Arrays.asList( new String[]{"Y", "N"} ), "Y" );
+        String answer = prompter.prompt( query, Arrays.asList( new String[] { "Y", "N" } ), "Y" );
 
         return "Y".equalsIgnoreCase( answer );
     }
@@ -55,11 +60,11 @@
         String query = "Choose archetype:\n";
         Map answerMap = new HashMap();
         List answers = new ArrayList();
-        Iterator archetypeIterator = archetypes.iterator();
         int counter = 1;
-        while ( archetypeIterator.hasNext() )
+
+        for ( Iterator archetypeIterator = archetypes.iterator(); archetypeIterator.hasNext(); )
         {
-            org.apache.maven.archetype.catalog.Archetype archetype = (org.apache.maven.archetype.catalog.Archetype) archetypeIterator.next();
+            Archetype archetype = (Archetype) archetypeIterator.next();
 
             answerMap.put( "" + counter, archetype );
             query +=
@@ -73,7 +78,7 @@
 
         String answer = prompter.prompt( query, answers );
 
-        return (org.apache.maven.archetype.catalog.Archetype) answerMap.get( answer );
+        return (Archetype) answerMap.get( answer );
     }
 
     public Archetype selectArchetype( Map catalogs )
@@ -90,20 +95,21 @@
         Map reversedArchetypeAnswerMap = new HashMap();
         List answers = new ArrayList();
         List archetypeVersions;
-        Iterator catalogIterator = catalogs.keySet().iterator();
         int counter = 1;
         int defaultSelection = 0;
-        while ( catalogIterator.hasNext() )
+
+        for ( Iterator catalogIterator = catalogs.keySet().iterator(); catalogIterator.hasNext(); )
         {
             String catalog = (String) catalogIterator.next();
 
-            Iterator archetypeIterator = ((List) catalogs.get( catalog )).iterator();
-            while ( archetypeIterator.hasNext() )
+            for ( Iterator archetypeIterator = ( (List) catalogs.get( catalog ) ).iterator();
+                archetypeIterator.hasNext(); )
             {
-                org.apache.maven.archetype.catalog.Archetype archetype = (org.apache.maven.archetype.catalog.Archetype) archetypeIterator.next();
-                String mapKey = ""+counter;
-                String archetypeKey = archetype.getGroupId()+":"+archetype.getArtifactId();
-                if( reversedArchetypeAnswerMap.containsKey( archetypeKey ) )
+                Archetype archetype = (Archetype) archetypeIterator.next();
+
+                String mapKey = "" + counter;
+                String archetypeKey = archetype.getGroupId() + ":" + archetype.getArtifactId();
+                if ( reversedArchetypeAnswerMap.containsKey( archetypeKey ) )
                 {
                     mapKey = (String) reversedArchetypeAnswerMap.get( archetypeKey );
                     archetypeVersions = (List) archetypeAnswerMap.get( mapKey );
@@ -112,15 +118,15 @@
                 {
                     archetypeVersions = new ArrayList();
                     archetypeAnswerMap.put( mapKey, archetypeVersions );
-                    reversedArchetypeAnswerMap.put(archetypeKey, mapKey);
+                    reversedArchetypeAnswerMap.put( archetypeKey, mapKey );
                     query +=
-                        mapKey + ": " + catalog +
-                        " -> " + archetype.getArtifactId() + " (" + archetype.getDescription() + ")\n";
+                        mapKey + ": " + catalog
+                        + " -> " + archetype.getArtifactId() + " (" + archetype.getDescription() + ")\n";
                     answers.add( mapKey );
 
                     // the version is not tested. This is intentional.
-                    if ( defaultDefinition != null && archetype.getGroupId().equals( defaultDefinition.getGroupId() ) &&
-                        archetype.getArtifactId().equals( defaultDefinition.getArtifactId() ) )
+                    if ( defaultDefinition != null && archetype.getGroupId().equals( defaultDefinition.getGroupId() )
+                        && archetype.getArtifactId().equals( defaultDefinition.getArtifactId() ) )
                     {
                         defaultSelection = counter;
                     }
@@ -128,7 +134,6 @@
                     counter++;
                 }
                 archetypeVersions.add( archetype );
-
             }
 
         }
@@ -147,37 +152,37 @@
 
         archetypeVersions = (List) archetypeAnswerMap.get( answer );
 
-        if( archetypeVersions.size() == 1 )
+        if ( archetypeVersions.size() == 1 )
         {
-            return (org.apache.maven.archetype.catalog.Archetype) archetypeVersions.get( 0 );
+            return (Archetype) archetypeVersions.get( 0 );
         }
         else
         {
             return selectVersion( archetypeVersions );
         }
     }
-    private org.apache.maven.archetype.catalog.Archetype selectVersion( List archetypes )
-        throws
-        PrompterException
+
+    private Archetype selectVersion( List archetypes )
+        throws PrompterException
     {
         String query = "Choose version: \n";
         Map answerMap = new HashMap();
         List answers = new ArrayList();
 
-        Collections.sort(archetypes, new Comparator() {
-            public int compare( Object o1, Object o2 ) {
-                org.apache.maven.archetype.catalog.Archetype a1 = (org.apache.maven.archetype.catalog.Archetype) o1;
-                org.apache.maven.archetype.catalog.Archetype a2 = (org.apache.maven.archetype.catalog.Archetype) o2;
+        Collections.sort( archetypes, new Comparator()
+        {
+            public int compare( Object o1, Object o2 )
+            {
+                Archetype a1 = (Archetype) o1;
+                Archetype a2 = (Archetype) o2;
                 return a1.getVersion().compareTo( a2.getVersion() );
             }
-        });
+        } );
 
-        Iterator archetypeVersionsKeys = archetypes.iterator();
         int counter = 1;
-        org.apache.maven.archetype.catalog.Archetype archetype;
-        while ( archetypeVersionsKeys.hasNext() )
+        for ( Iterator archetypeVersionsKeys = archetypes.iterator(); archetypeVersionsKeys.hasNext(); )
         {
-            archetype = (org.apache.maven.archetype.catalog.Archetype) archetypeVersionsKeys.next();
+            Archetype archetype = (Archetype) archetypeVersionsKeys.next();
             String archetypeVersion = archetype.getVersion();
 
             answerMap.put( "" + counter, archetype );
diff --git a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
index 3ef3667..dacb6a4 100644
--- a/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
+++ b/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
@@ -1,3 +1,5 @@
+package org.apache.maven.archetype.ui;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,10 +19,9 @@
  * under the License.
  */
 
-package org.apache.maven.archetype.ui;
-
 import org.apache.commons.collections.iterators.ArrayIterator;
 import org.apache.maven.archetype.ArchetypeGenerationRequest;
+import org.apache.maven.archetype.ArchetypeManager;
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.common.ArchetypeDefinition;
 import org.apache.maven.archetype.exception.ArchetypeNotDefined;
@@ -52,16 +53,10 @@
     /** @plexus.requirement */
     private ArchetypeSelectionQueryer archetypeSelectionQueryer;
     /** @plexus.requirement */
-    private org.apache.maven.archetype.Archetype archetype;
+    private ArchetypeManager archetype;
 
-    public void selectArchetype( ArchetypeGenerationRequest request,
-            Boolean interactiveMode, String catalogs )
-        throws
-        ArchetypeNotDefined,
-        UnknownArchetype,
-        UnknownGroup,
-        IOException,
-        PrompterException,
+    public void selectArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs )
+        throws ArchetypeNotDefined, UnknownArchetype, UnknownGroup, IOException, PrompterException,
         ArchetypeSelectionFailure
     {
         //This should be an internal class
@@ -71,115 +66,113 @@
         definition.setArtifactId( request.getArchetypeArtifactId() );
         definition.setVersion( request.getArchetypeVersion() );
 
-        Map archetypes = getArchetypesByCatalog ( catalogs );
+        Map archetypes = getArchetypesByCatalog( catalogs );
 
-        if ( definition.isDefined ()
-            && StringUtils.isNotEmpty ( request.getArchetypeRepository () )
-        )
+        if ( definition.isDefined() && StringUtils.isNotEmpty( request.getArchetypeRepository() ) )
         {
-            getLogger ().info ( "Archetype defined by properties" );
+            getLogger().info( "Archetype defined by properties" );
         }
         else
         {
-            if ( definition.isDefined ()
-                && StringUtils.isEmpty ( request.getArchetypeRepository () )
-            )
+            if ( definition.isDefined() && StringUtils.isEmpty( request.getArchetypeRepository() ) )
             {
-                Iterator ca = new ArrayIterator ( StringUtils.split ( catalogs, "," ) );
+                Iterator ca = new ArrayIterator( StringUtils.split ( catalogs, "," ) );
                 boolean found = false;
-                while ( !found && ca.hasNext () )
+                while ( !found && ca.hasNext() )
                 {
-                    String catalogKey = (String) ca.next ();
-                    String[] keySplitted = catalogKey.split("-", 2);
-                    List catalog = (List) archetypes.get ( catalogKey );
-                    Archetype example = new Archetype ();
-                    example.setGroupId ( request.getArchetypeGroupId () );
-                    example.setArtifactId ( request.getArchetypeArtifactId () );
-                    if ( catalog.contains ( example ) )
+                    String catalogKey = (String) ca.next();
+
+                    String[] keySplitted = catalogKey.split( "-", 2 );
+
+                    List catalog = (List) archetypes.get( catalogKey );
+
+                    Archetype example = new Archetype();
+                    example.setGroupId( request.getArchetypeGroupId() );
+                    example.setArtifactId( request.getArchetypeArtifactId() );
+
+                    if ( catalog.contains( example ) )
                     {
                         found = true;
 
-                        Archetype foundArchetype =
-                            (Archetype) catalog.get ( catalog.indexOf ( example ) );
-                        definition.setName ( foundArchetype.getArtifactId () );
-                        if ( StringUtils.isNotEmpty( foundArchetype.getRepository () ) )
+                        Archetype foundArchetype = (Archetype) catalog.get( catalog.indexOf( example ) );
+                        definition.setName( foundArchetype.getArtifactId() );
+                        if ( StringUtils.isNotEmpty( foundArchetype.getRepository() ) )
                         {
-                            definition.setRepository ( foundArchetype.getRepository () );
+                            definition.setRepository( foundArchetype.getRepository() );
                         }
                         else if ( keySplitted.length > 1 )
                         {
-                            int lastIndex = catalogKey.lastIndexOf("/");
-                            String catalogBase = catalogKey.substring(0,
-                                    (lastIndex > 7 ? lastIndex : catalogKey.length()));
-                            definition.setRepository ( catalogBase );
+                            int lastIndex = catalogKey.lastIndexOf( "/" );
+                            String catalogBase =
+                                catalogKey.substring( 0, ( lastIndex > 7 ? lastIndex : catalogKey.length() ) );
+                            definition.setRepository( catalogBase );
                         }
 
-                        getLogger ().info (
-                            "Archetype repository missing. Using the one from " + foundArchetype
-                            + " found in catalog " + catalogKey
-                        );
+                        getLogger().info(
+                                          "Archetype repository missing. Using the one from " + foundArchetype
+                                              + " found in catalog " + catalogKey );
                     }
                 }
                 if ( !found )
                 {
-                    getLogger ().warn ( "No archetype repository found. Falling back to central repository (http://repo1.maven.org/maven2). " );
-                    getLogger ().warn ( "Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere." );
+                    getLogger().warn( "No archetype repository found. Falling back to central repository (http://repo1.maven.org/maven2). " );
+                    getLogger().warn( "Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere." );
 
-                    definition.setRepository("http://repo1.maven.org/maven2");
+                    definition.setRepository( "http://repo1.maven.org/maven2" );
                 }
             }
-            if ( !definition.isDefined () && definition.isPartiallyDefined () )
+            if ( !definition.isDefined() && definition.isPartiallyDefined() )
             {
-                Iterator ca = new ArrayIterator ( StringUtils.split ( catalogs, "," ) );
+                Iterator ca = new ArrayIterator( StringUtils.split( catalogs, "," ) );
                 boolean found = false;
-                while ( !found && ca.hasNext () )
+                while ( !found && ca.hasNext() )
                 {
-                    String catalogKey = (String) ca.next ();
-                    List catalog = (List) archetypes.get ( catalogKey );
-                    String[] keySplitted = catalogKey.split(":", 2);
-                    Archetype example = new Archetype ();
-                    example.setGroupId ( request.getArchetypeGroupId () );
-                    example.setArtifactId ( request.getArchetypeArtifactId () );
+                    String catalogKey = (String) ca.next();
+
+                    List catalog = (List) archetypes.get( catalogKey );
+
+                    String[] keySplitted = catalogKey.split( ":", 2 );
+
+                    Archetype example = new Archetype();
+                    example.setGroupId( request.getArchetypeGroupId() );
+                    example.setArtifactId( request.getArchetypeArtifactId() );
+
                     if ( catalog.contains ( example ) )
                     {
                         found = true;
 
-                        Archetype foundArchetype =
-                            (Archetype) catalog.get ( catalog.indexOf ( example ) );
-                        definition.setGroupId ( foundArchetype.getGroupId () );
-                        definition.setArtifactId ( foundArchetype.getArtifactId () );
-                        definition.setVersion ( foundArchetype.getVersion () );
-                        definition.setName ( foundArchetype.getArtifactId () );
-                        if ( StringUtils.isNotEmpty( foundArchetype.getRepository () ) )
+                        Archetype foundArchetype = (Archetype) catalog.get( catalog.indexOf( example ) );
+                        definition.setGroupId( foundArchetype.getGroupId() );
+                        definition.setArtifactId( foundArchetype.getArtifactId() );
+                        definition.setVersion( foundArchetype.getVersion() );
+                        definition.setName( foundArchetype.getArtifactId() );
+
+                        if ( StringUtils.isNotEmpty( foundArchetype.getRepository() ) )
                         {
-                            definition.setRepository ( foundArchetype.getRepository () );
+                            definition.setRepository( foundArchetype.getRepository() );
                         }
                         else if ( keySplitted.length > 1 )
                         {
-                            int lastIndex = catalogKey.lastIndexOf("/");
-                            String catalogBase = catalogKey.substring(0,
-                                    (lastIndex > 7 ? lastIndex : catalogKey.length()));
-                            definition.setRepository ( catalogBase );
+                            int lastIndex = catalogKey.lastIndexOf( "/" );
+                            String catalogBase =
+                                catalogKey.substring( 0, ( lastIndex > 7 ? lastIndex : catalogKey.length() ) );
+                            definition.setRepository( catalogBase );
                         }
 
-                        String goals =
-                            StringUtils.join ( foundArchetype.getGoals ().iterator (), "," );
-                        definition.setGoals ( goals );
+                        String goals = StringUtils.join( foundArchetype.getGoals().iterator(), "," );
+                        definition.setGoals( goals );
 
-                        getLogger ().info (
-                            "Archetype " + foundArchetype
-                            + " found in catalog " + catalogKey
-                        );
+                        getLogger().info( "Archetype " + foundArchetype + " found in catalog " + catalogKey );
                     }
                 }
                 if ( !found )
                 {
-                    getLogger ().warn ( "Specified archetype not found." );
-                    if ( interactiveMode.booleanValue () )
+                    getLogger().warn( "Specified archetype not found." );
+                    if ( interactiveMode.booleanValue() )
                     {
-                        definition.setVersion ( null );
-                        definition.setGroupId ( null );
-                        definition.setArtifactId ( null );
+                        definition.setVersion( null );
+                        definition.setGroupId( null );
+                        definition.setArtifactId( null );
                     }
                 }
             }
@@ -216,18 +209,18 @@
                     definition.setArtifactId( selectedArchetype.getArtifactId() );
                     definition.setVersion( selectedArchetype.getVersion() );
                     definition.setName( selectedArchetype.getArtifactId() );
-                    String catalogKey = getCatalogKey ( archetypes, selectedArchetype );
-                    String[] keySplitted = catalogKey.split(":", 2);
-                    if ( StringUtils.isNotEmpty( selectedArchetype.getRepository () ) )
+                    String catalogKey = getCatalogKey( archetypes, selectedArchetype );
+                    String[] keySplitted = catalogKey.split( ":", 2 );
+                    if ( StringUtils.isNotEmpty( selectedArchetype.getRepository() ) )
                     {
-                        definition.setRepository ( selectedArchetype.getRepository () );
+                        definition.setRepository( selectedArchetype.getRepository() );
                     }
                     else if ( keySplitted.length > 1 )
                     {
-                        int lastIndex = catalogKey.lastIndexOf("/");
-                        String catalogBase = catalogKey.substring(0,
-                                (lastIndex > 7 ? lastIndex : catalogKey.length()));
-                        definition.setRepository ( catalogBase );
+                        int lastIndex = catalogKey.lastIndexOf( "/" );
+                        String catalogBase =
+                            catalogKey.substring( 0, ( lastIndex > 7 ? lastIndex : catalogKey.length() ) );
+                        definition.setRepository( catalogBase );
                     }
                     String goals = StringUtils.join( selectedArchetype.getGoals().iterator(), "," );
                     definition.setGoals( goals );
@@ -253,12 +246,14 @@
 
         request.setArchetypeName( definition.getName() );
 
-        if (StringUtils.isNotEmpty(definition.getRepository())){
+        if ( StringUtils.isNotEmpty( definition.getRepository() ) )
+        {
             request.setArchetypeRepository( definition.getRepository() );
         }
     }
 
-    private Map getArchetypesByCatalog(String catalogs) {
+    private Map getArchetypesByCatalog( String catalogs )
+    {
         if ( catalogs == null )
         {
             throw new NullPointerException( "catalogs can not be null" );
@@ -266,40 +261,52 @@
 
         Map archetypes = new HashMap();
 
-        Iterator ca = new ArrayIterator(StringUtils.split(catalogs, ","));
-        while (ca.hasNext()) {
+        for ( Iterator ca = new ArrayIterator( StringUtils.split( catalogs, "," ) ); ca.hasNext(); )
+        {
             String catalog = (String) ca.next();
 
-            if ("internal".equalsIgnoreCase(catalog)) {
-                archetypes.put("internal", archetype.getInternalCatalog().getArchetypes());
-            } else if ("local".equalsIgnoreCase(catalog)) {
-                archetypes.put("local", archetype.getDefaultLocalCatalog().getArchetypes());
-            } else if ("remote".equalsIgnoreCase(catalog)) {
+            if ( "internal".equalsIgnoreCase( catalog ) )
+            {
+                archetypes.put( "internal", archetype.getInternalCatalog().getArchetypes() );
+            }
+            else if ( "local".equalsIgnoreCase( catalog ) )
+            {
+                archetypes.put( "local", archetype.getDefaultLocalCatalog().getArchetypes() );
+            }
+            else if ( "remote".equalsIgnoreCase( catalog ) )
+            {
                 List archetypesFromRemote = archetype.getRemoteCatalog().getArchetypes();
-                if(archetypesFromRemote.size() > 0) {
-                    archetypes.put("remote", archetypesFromRemote);
-                } else {
-                    getLogger().warn("No archetype found in Remote catalog. Defaulting to internal Catalog");
-                    archetypes.put("internal", archetype.getInternalCatalog().getArchetypes());
+                if ( archetypesFromRemote.size() > 0 )
+                {
+                    archetypes.put( "remote", archetypesFromRemote );
                 }
-            } else if (catalog.startsWith("file://")) {
-                String path = catalog.substring(7);
-                archetypes.put(catalog, archetype.getLocalCatalog(path).getArchetypes());
-            } else if (catalog.startsWith("http://")) {
-                archetypes.put(catalog, archetype.getRemoteCatalog(catalog).getArchetypes());
+                else
+                {
+                    getLogger().warn( "No archetype found in Remote catalog. Defaulting to internal Catalog" );
+                    archetypes.put( "internal", archetype.getInternalCatalog().getArchetypes() );
+                }
+            }
+            else if ( catalog.startsWith( "file://" ) )
+            {
+                String path = catalog.substring( 7 );
+                archetypes.put( catalog, archetype.getLocalCatalog( path ).getArchetypes() );
+            }
+            else if ( catalog.startsWith( "http://" ) )
+            {
+                archetypes.put( catalog, archetype.getRemoteCatalog( catalog ).getArchetypes() );
             }
         }
 
-        if (archetypes.size() == 0) {
-            getLogger().info("No catalog defined. Using internal catalog");
+        if ( archetypes.size() == 0 )
+        {
+            getLogger().info( "No catalog defined. Using internal catalog" );
 
-            archetypes.put("internal", archetype.getInternalCatalog().getArchetypes());
+            archetypes.put( "internal", archetype.getInternalCatalog().getArchetypes() );
         }
         return archetypes;
     }
 
-    private Properties getArchetypeDataSourceProperties( String sourceRoleHint,
-                                                         Properties archetypeCatalogProperties )
+    private Properties getArchetypeDataSourceProperties( String sourceRoleHint, Properties archetypeCatalogProperties )
     {
         Properties p = new Properties();
 
@@ -323,11 +330,12 @@
         this.archetypeSelectionQueryer = archetypeSelectionQueryer;
     }
 
-    private String getCatalogKey(Map archetypes, Archetype selectedArchetype) {
+    private String getCatalogKey( Map archetypes, Archetype selectedArchetype )
+    {
         String key = "";
         Iterator keys = archetypes.keySet().iterator();
         boolean found = false;
-        while ( keys.hasNext() && !found)
+        while ( keys.hasNext() && !found )
         {
             key = (String) keys.next();
             List catalog = (List) archetypes.get( key );
diff --git a/archetype-plugin/src/site/apt/advanced-usage.apt b/archetype-plugin/src/site/apt/advanced-usage.apt
index 6a82957..66ed165 100644
--- a/archetype-plugin/src/site/apt/advanced-usage.apt
+++ b/archetype-plugin/src/site/apt/advanced-usage.apt
@@ -29,7 +29,7 @@
 
 Archetype creation
 
-    Creating an archetype from an existing project involves three steps :
+    Creating an archetype from an existing project involves three steps:
 
     * the archetype resolution
 
@@ -42,10 +42,10 @@
 
 Usage
 
-    Calling <<<mvn archetype:create-from-project>>> the plugin first resolves 
-    the package by guessing the project directory. 
+    Calling <<<mvn archetype:create-from-project>>> the plugin first resolves
+    the package by guessing the project directory.
 
-    It then generates the directory tree of the archetype in the 
+    It then generates the directory tree of the archetype in the
     <<<target/generated-sources/archetype>>> directory.
 
 +---
@@ -80,7 +80,7 @@
 [INFO] ------------------------------------------------------------------------
 +---
 
-    Then move to that generated directory and call <<<mvn install>>> on the 
+    Then move to that generated directory and call <<<mvn install>>> on the
     created archetype.
 
 +---
@@ -135,16 +135,16 @@
 [INFO] [archetype:generate]
 Choose archetype:
 1: local -> project (project)
-Choose a number:  (1): 
+Choose a number:  (1):
 +---
 
 Configuration
-    
+
     The <<<create-from-project>>> goal enable the user to provide some sensible
     configuration using the system properties or a property file.
 
-    The system properties permits the user to define the groupId, artifactId, 
-    version of the created archetype. They also permits to override the resolved 
+    The system properties permits the user to define the groupId, artifactId,
+    version of the created archetype. They also permits to override the resolved
     package and to create a partial archetype.
 
     When used, the property file takes precedence over the system properties.
diff --git a/archetype-plugin/src/site/apt/examples/create-with-property-file.apt b/archetype-plugin/src/site/apt/examples/create-with-property-file.apt
index bcbe39e..889157b 100644
--- a/archetype-plugin/src/site/apt/examples/create-with-property-file.apt
+++ b/archetype-plugin/src/site/apt/examples/create-with-property-file.apt
@@ -271,6 +271,6 @@
        jsp, gsp, vm, html, xhtml, properties, .classpath, .project>>>. Notice
        the dotted filtered extensions that contains the complete file names.
 
-    * <<<archetype.fillteredExtensions>>> have: <<<java, groovy, csharp, aspectj>>>.
+    * <<<archetype.filteredExtensions>>> have: <<<java, groovy, csharp, aspectj>>>.
 
     []
\ No newline at end of file
diff --git a/archetype-plugin/src/site/apt/index.apt b/archetype-plugin/src/site/apt/index.apt
index b510781..0aeb9b4 100644
--- a/archetype-plugin/src/site/apt/index.apt
+++ b/archetype-plugin/src/site/apt/index.apt
@@ -32,37 +32,37 @@
  The Archetype Plugin allows the user to create a Maven 2 project
  from an existing template called an archetype.
 
- It also allows the user to create an archetype from an existing project. 
+ It also allows the user to create an archetype from an existing project.
 
 
 * Usage
 
-  {{{usage.html}Instructions on how to use the Archetype Plugin to create a project}}
+  {{{./usage.html}Instructions on how to use the Archetype Plugin to create a project}}
   can be found on the usage page.
 
 ~~ TODO: The links in the following paragraph doesn't work
-  The Archetype Plugin is embedded in IDEs {{{#}Eclipse}}, {{{#}NetBeans}}, 
+  The Archetype Plugin is embedded in IDEs {{{#}Eclipse}}, {{{#}NetBeans}},
   {{{#}IDEA}}.
 
-  {{{advanced-usage.html}Instructions on how to use the Archetype Plugin to create an archetype from an existing project}}
+  {{{./advanced-usage.html}Instructions on how to use the Archetype Plugin to create an archetype from an existing project}}
   can be found on the advanced usage page.
 
 
 * Goals Overview
 
   The archetype plugin has four goals:
-  
-  * {{{create-mojo.html}archetype:create}} creates a Maven 2 project from an 
-    archetype. It use the behaviour of the Archetype Plugin version 1.0-alpha-7.
-  
-  * {{{generate-mojo.html}archetype:generate}} ask the user to choose an archetype 
+
+  * {{{./create-mojo.html}archetype:create}} creates a Maven 2 project from an
+    archetype. It use the behaviour of the {{{/plugins/maven-archetype-plugin-1.0-alpha-7/}Archetype Plugin version 1.0-alpha-7}}.
+
+  * {{{./generate-mojo.html}archetype:generate}} ask the user to choose an archetype
     from the archetype catalog, and retrieves it from the remote repository.
     Once retrieved, it is processed to create a working Maven project.
 
-  * {{{create-from-project-mojo.html}archetype:create-from-project}} creates
+  * {{{./create-from-project-mojo.html}archetype:create-from-project}} creates
     an archetype from an existing project.
 
-  * {{{crawl-mojo.html}archetype:crawl}} search a repository 
+  * {{{./crawl-mojo.html}archetype:crawl}} search a repository
     for archetypes and updates a catalog.
 
   []
@@ -70,33 +70,29 @@
 
 * Examples
 
-   The following examples show how to use the Archetype Plugin in more advanced 
+   The following examples show how to use the Archetype Plugin in more advanced
    usecases:
 
-   * {{{examples/generate-batch.html}Generate projects in batch mode}}
+   * {{{./examples/generate-batch.html}Generate projects in batch mode}}
 
-   * {{{examples/generate-alternative-catalog.html}Generate project using an alternative catalog}}
+   * {{{./examples/generate-alternative-catalog.html}Generate project using an alternative catalog}}
 
-   * {{{examples/create-multi-module-project.html}Create an archetype from a multi module project}}
+   * {{{./examples/create-multi-module-project.html}Create an archetype from a multi module project}}
 
-   * {{{examples/create-with-property-file.html}Create an archetype with a property file}}
+   * {{{./examples/create-with-property-file.html}Create an archetype with a property file}}
 
-~~ TODO: The link on the following line doesn't work
    * {{{#}Handcrafting an archetype}} or features available to an archetype
      when not created by <<<create-from-project>>> - TBD
 
-~~ TODO: The link on the following line doesn't work
    * {{{#}Generate a sub module from an archetype}} - TBD
 
-~~ TODO: The link on the following line doesn't work
    * {{{#}Create an archetype in interactive mode}} - TBD
 
   []
 
 
 * Specification
- 
-    The specification page contains 
-    {{{specification/specification.html}the specification of the main parts of the Archetype Plugin}}.
- 
- 
\ No newline at end of file
+
+    The specification page contains
+    {{{./specification/specification.html}the specification of the main parts of the Archetype Plugin}}.
+
diff --git a/archetype-plugin/src/site/apt/specification/archetype-catalog.apt b/archetype-plugin/src/site/apt/specification/archetype-catalog.apt
index 50794e2..770f168 100644
--- a/archetype-plugin/src/site/apt/specification/archetype-catalog.apt
+++ b/archetype-plugin/src/site/apt/specification/archetype-catalog.apt
@@ -27,25 +27,26 @@
 ~~ http://maven.apache.org/doxia/references/apt-format.html
 
 
-How the Archetype Plugin knows about archetypes?
+How does the Archetype Plugin know about archetypes?
 
     Knowledge about archetypes are stored in catalogs.
 
-    The catalogs are xml files.
+    The catalogs are xml files: see the {{{/archetype/archetype-common/archetype-catalog.html}reference documentation}}.
 
-    The Archetype Plugin comes bundled with an internal catalog. 
+    The Archetype Plugin comes bundled with an internal catalog.
     This one is used by default.
 
-    The Archetype Plugin can use catalogs from local filesystem and from HTTP 
+    The Archetype Plugin can use catalogs from local filesystem and from HTTP
     connections.
 
 * Catalog file explained
 
-    A catalog is an xml file with such content:
+    A catalog is a xml file with such content:
 
 +---
 <?xml version="1.0" encoding="UTF-8"?>
-<archetype-catalog>
+<archetype-catalog  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd">
   <archetypes>
     <archetype>
 [1]    <groupId>org.appfuse.archetypes</groupId>
@@ -65,54 +66,53 @@
 
     [[3]] The version of the archetype. <<<RELEASE>>> is a valid version. <<REQUIRED>>
 
-    [[4]] The repository where to find the archetype. <<OPTIONAL>>. When 
-          ommitted, the archetype is searched for in the repository where the catalog 
+    [[4]] The repository where to find the archetype. <<OPTIONAL>>. When
+          ommitted, the archetype is searched for in the repository where the catalog
           comes from.
 
     [[5]] The description of the archetype. <<OPTIONAL>>
-    
+
 
 * Archetype selection explained
 
     During the creation of a project from an archetype, the Archetype Plugin
-    ask the user to choose an archetype from a list containing the archetypes
-    from each of the provided catalogs (Yes, there may be many).
+    asks the user to choose an archetype from a list containing the archetypes
+    from each of the provided catalogs (yes, there may be many).
 
-    For each archetype in the list the Archetype Plugin shows a line like:
+    For each archetype in the list, the Archetype Plugin shows a line like:
 
 +---
 1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
 +---
 
-    * <<<1:>>> The index of the archetype in the aggregated list (starting from 
+    * <<<1:>>> The index of the archetype in the aggregated list (starting from
       1).
 
     * <<<internal>>> The name of the catalog where the archetype is originating.
 
     * <<<appfuse-basic-jsf>>> The artifactId of the archetype
 
-    * <<<(AppFuse archetype...)>>> The description of the archetype as found in 
+    * <<<(AppFuse archetype...)>>> The description of the archetype as found in
       the catalog.
 
 
 * Creating a catalog file
 
     At the end of the <<<create-from-project>>> behaviour, the Archetype Plugin
-    install/deploy the archetype, and update the local/remote catalog.
-    
-    The <<<crawl-repository>>> goal is used to create a catalog file by crawling 
-    a Maven 2 repository located in the filesystem. 
-    
+    installs/deploys the archetype, and updates the local/remote catalog.
+
+    The <<<crawl-repository>>> goal is used to create a catalog file by crawling
+    a Maven 2 repository located in the filesystem.
+
 * Location of catalog files
 
-    The Archetype Plugin knows by default its internal catalog. It also knows 
-    about the <<<local>>> and <<<remote>>> catalogs. 
+    The Archetype Plugin knows by default its internal catalog. It also knows
+    about the <<<local>>> and <<<remote>>> catalogs.
 
-    <<<local>>> represents the catalog file <<<~/.m2/archetype-catalog.xml>>>.
+    <<<local>>> represents the <<<~/.m2/archetype-catalog.xml>>> catalog file.
 
-    <<<remote>>> represents the catalog file <<<http://repo1.maven.org/maven2/archetype-catalog.xml>>>.
+    <<<remote>>> represents the <<<http://repo1.maven.org/maven2/archetype-catalog.xml>>> catalog file.
 
-    The Archetype Plugin can also read catalogs from filesystem/HTTP by 
-    providing the path/URL of a catalog file or of a directory containing the
+    The Archetype Plugin can also read catalogs from filesystem/HTTP by
+    providing the path/URL of a catalog file or of a directory containing an
     <<<archetype-catalog.xml>>> file.
-    
\ No newline at end of file
diff --git a/archetype-plugin/src/site/apt/specification/archetype-metadata.apt b/archetype-plugin/src/site/apt/specification/archetype-metadata.apt
index bc4b7ca..0ef19b5 100644
--- a/archetype-plugin/src/site/apt/specification/archetype-metadata.apt
+++ b/archetype-plugin/src/site/apt/specification/archetype-metadata.apt
@@ -30,14 +30,15 @@
 How metadata on an archetype is stored?
 
     The metadata about an archetype is stored in the <<<archetype-metadata.xml>>> file
-    located in the directory <<<META-INF/maven>>> of its jar file.
+    located in the directory <<<META-INF/maven>>> of its jar file: see the
+    {{{/archetype/archetype-common/archetype-descriptor.html}reference documentation}}.
 
-    The metadata file stores the additional properties, with corresponding 
+    The metadata file stores the additional properties, with corresponding
     default values.
 
     It also stores the project's generated files in filesets.
 
-    Finally it also stores inner modules of the archetype, which enable the 
+    Finally it also stores inner modules of the archetype, which enable the
     creation of multi-module projects using a single archetype.
 
     A minimal <<<archetype-metadata.xml>>> file looks like:
@@ -57,21 +58,21 @@
 +---
 
     This example above shows:
-    
+
     * the archetype name is <<<basic>>>
 
-    * the archetype defines a single fileset: 
-    
+    * the archetype defines a single fileset:
+
       * the fileset will take all the files in <<<archetype-resources/src/main/java>>>
         that match the <<<**/*.java>>> pattern
 
-      * the selected files will be generated using the Velocity engine 
+      * the selected files will be generated using the Velocity engine
         (<<<filtered=true>>>)
 
-      * the files will be generated in the <<<src/main/java>>> directory of the 
-        generated project in the same directory as in the jar file, but with 
+      * the files will be generated in the <<<src/main/java>>> directory of the
+        generated project in the same directory as in the jar file, but with
         that directory prepended by the package property.
-      
+
       []
 
     []
@@ -81,7 +82,7 @@
 
     The main properties that are used by the Velocity engine during a project's file generation are groupId, artifactId, version and package.
 
-    It is possible to define additional properties that must be valued before the file generation. 
+    It is possible to define additional properties that must be valued before the file generation.
 
     These additional properties can be provided with default values, which enable not to ask the user for there values.
 
@@ -98,36 +99,36 @@
 ...
 </archetype-descriptor>
 +---
-    
+
     Here two additional properties are defined: <<<property-without-default>>>
     and <<<property-with-default>>>.
 
-    Be aware that the property keys can not contain any dots as they are 
+    Be aware that the property keys can not contain any dots as they are
     Velocity properties.
 
 
 * Defining specific filesets
 
     The filesets contained in the <<<archetype-metadata.xml>>> file defines the way
-    the project's files located in the jar file are used by the Archetype Plugin 
+    the project's files located in the jar file are used by the Archetype Plugin
     to generate a project.
 
-    Filesets must define the directory where the files will be searched for 
-    which is also the directory where the project's files will be generated. 
-    The first is the directory inside the archetype jar file, the second is the 
+    Filesets must define the directory where the files will be searched for
+    which is also the directory where the project's files will be generated.
+    The first is the directory inside the archetype jar file, the second is the
     directory in the generated project's tree.
 
-    Filesets also defines the inclusion/exclusion of files "à la " ant. 
-    This provide a powerful way to describe a large set of files to be selected 
+    Filesets also defines the inclusion/exclusion of files "<à la>" ant.
+    This provide a powerful way to describe a large set of files to be selected
     for the generation process.
 
-    Filesets can be filtered, which means the selected files will be used 
-    as Velocity templates. They can be non-filtered, which means the selected 
+    Filesets can be filtered, which means the selected files will be used
+    as Velocity templates. They can be non-filtered, which means the selected
     files will be copied without modification.
 
-    Filesets can be packaged, which means the selected files will be 
-    generated/copied in a directory structure that is prepended by the package 
-    property. They can be non-packaged, which means that the selected files 
+    Filesets can be packaged, which means the selected files will be
+    generated/copied in a directory structure that is prepended by the package
+    property. They can be non-packaged, which means that the selected files
     will be generated/copied without that prepend.
 
     A fileset is defined in the <<<archetype-metadata.xml>>> with this fragment:
@@ -148,16 +149,16 @@
 ...
 +---
 
-    This example shows a fileset that will select all the java files in the 
-    <<<src/test/java>>> directory of the archetype resources, except the 
+    This example shows a fileset that will select all the java files in the
+    <<<src/test/java>>> directory of the archetype resources, except the
     <<<AllTest.java>>> file that is located at the root of this directory.
 
-    This filset also is packaged and filtered.
+    This filset is also packaged and filtered.
 
 
 * Defining multi module in the archetype metadata
 
-    Inner modules of an archetype are used to create a multi module Maven 2 
+    Inner modules of an archetype are used to create a multi-module Maven 2
     project from a single archetype.
 
     Modules in the <<<archetype-metadata.xml>>> file are defined like:
@@ -177,28 +178,28 @@
 </archetype-descriptor>
 +---
 
-    In the example above, the archetype <<<multi-module>>> contains a module 
-    named <<<SubProject>>>. This module is located in the <<<sub-project>>> 
+    In the example above, the archetype <<<multi-module>>> contains a module
+    named <<<SubProject>>>. This module is located in the <<<sub-project>>>
     directory of the archetype. It also has the artifactId <<<subproject>>>.
 
-    The attributes name, id and dir of the module are used to determine the 
-    directory where to generate that module's files, they also are used to 
-    determine the artifactId of the Maven 2 project corresponding to this 
+    The attributes name, id and dir of the module are used to determine the
+    directory where to generate that module's files, they also are used to
+    determine the artifactId of the Maven 2 project corresponding to this
     module.
 
 
 * Putting it all together
 
-    The <<<\<requiredProperties\>>>> element is only allowed as a child of 
+    The <<<\<requiredProperties\>>>> element is only allowed as a child of
     <<<\<archetype-descriptor\>>>>.
 
-    Modules are allowed in <<<\<archetype-descriptor\>>>> and in <<<\<modules\>>>> (no limit is 
+    Modules are allowed in <<<\<archetype-descriptor\>>>> and in <<<\<modules\>>>> (no limit is
     given).
 
-    <<<\<archetype-descriptor\>>>> and <<<\<modules\>>>> must define at least one <<<\<fileSet\>>>> each to 
+    <<<\<archetype-descriptor\>>>> and <<<\<modules\>>>> must define at least one <<<\<fileSet\>>>> each to
     be valid.
 
-    It is possible to define default values for required properties by 
+    It is possible to define default values for required properties by
     defining say the groupId and giving it a default:
 
 +---
diff --git a/archetype-plugin/src/site/apt/specification/archetype.apt b/archetype-plugin/src/site/apt/specification/archetype.apt
index 5c046c2..e264934 100644
--- a/archetype-plugin/src/site/apt/specification/archetype.apt
+++ b/archetype-plugin/src/site/apt/specification/archetype.apt
@@ -29,25 +29,25 @@
 
 What is an archetype?
 
-* A Maven 2 project 'en devenir'  
+* A Maven 2 project 'en devenir'
 
-    I.e. an abstract representation of a kind of project 
-    that can be instantiated into a concrete customised 
-    Maven 2 project. 
+    I.e. an abstract representation of a kind of project
+    that can be instantiated into a concrete customised
+    Maven 2 project.
 
-    An archetype knows which files will be part of the 
-    instantiated project and which properties to fill 
-    to properly customise the project. 
- 
-    Each archetype defines a set of common properties: 
+    An archetype knows which files will be part of the
+    instantiated project and which properties to fill
+    to properly customise the project.
 
-    * groupId which will be the groupId of the project 
+    Each archetype defines a set of common properties:
 
-    * artifactId which will be the artifactId of the project 
+    * <<<groupId>>> which will be the groupId of the project
 
-    * version which will be the version of the project 
+    * <<<artifactId>>> which will be the artifactId of the project
 
-    * package which will be the base package of all source files of the project
+    * <<<version>>> which will be the version of the project
+
+    * <<<package>>> which will be the base package of all source files of the project
 
     []
 
@@ -55,7 +55,7 @@
 
 * A jar file
 
-    The minimal content of the jar file: 
+    The minimal content of the jar file is:
 
 +---
 .
@@ -67,14 +67,14 @@
     `-- pom.xml                     [3]
 +---
 
-    [[1]] The metadata file that defines:  
+    [[1]] The metadata file that defines:
 
-        * the default values of the common properties, 
+        * the default values of the common properties,
 
-        * a set of additional properties with their default values, 
+        * a set of additional properties with their default values,
 
         * a set of archetype resources;
-        
+
         []
 
     [[2]] The resource files defined by the archetype metadata,
diff --git a/archetype-plugin/src/site/apt/specification/create-from-project.apt b/archetype-plugin/src/site/apt/specification/create-from-project.apt
index 476e136..f7051e1 100644
--- a/archetype-plugin/src/site/apt/specification/create-from-project.apt
+++ b/archetype-plugin/src/site/apt/specification/create-from-project.apt
@@ -31,35 +31,34 @@
 
 * Property resolution
 
-    First the Archetype Plugin asks the user to provide the common properties' 
-    values (archetype.groupId, archetype.artifactId, archetype.version, groupId, 
-    artifactId, version, package).
+    First, the Archetype Plugin asks the user to provide the common properties'
+    values (<<<archetype.groupId>>>, <<<archetype.artifactId>>>, <<<archetype.version>>>,
+    <<<groupId>>>, <<<artifactId>>>, <<<version>>>, <<<package>>>).
 
     Then it asks for additional properties.
 
 * Archetype creation
 
-    Using the project's directory as sources, the properties filteredExtensions 
-    and languages, the module tree; the Archetype Plugin search for revelant 
+    Using the project's directory as sources, <<<filteredExtensions>>> and <<<languages>>>
+    properties, the module tree; the Archetype Plugin searches for revelant
     filesets indexed by module.
 
-    Using the revelant filesets, the module tree, the resolved properties; the 
+    Using the revelant filesets, the module tree, the resolved properties; the
     Archetype Plugin creates the archetype's resources.
 
-    Then it creates the archetype's descriptor using the the module tree, the 
-    revelant filesets, the resolved properties.
+    Then it creates the archetype's descriptor.
 
     Finishing by creating the pom for the archetype as a project.
 
 * Archetype installation
 
-    Optionally after creating the archetype, the Archetype Plugin installs the 
+    Optionally, after creating the archetype, the Archetype Plugin installs the
     archetype in the local repository. And it updates the local catalog.
 
 * Archetype deployment
 
-    Optionally after installing the archetype, the Archetype Plugin deploys the
-    archetype in the remote repository.
+    Optionally, after installing the archetype, the Archetype Plugin deploys the
+    archetype to the remote repository.
 
 * Interactive mode
 
@@ -68,16 +67,16 @@
 
 * Advanced batch mode
 
-    The additional properties in batch mode can only be defined using a property 
-    file. This file also can contain the other properties both the commons and 
-    the filteredExtensions and languages.
+    In batch mode, the additional properties can only be defined using a property
+    file. This file can also contain the other properties, both the commons and
+    <<<filteredExtensions>>> and <<<languages>>>.
 
 * Fileset resolution
 
-    In each module's directory and excluding submodules trees, the Archetype 
-    Plugin sorts the files by languages, fileteredExtensions and sensible 
-    default base pathes (src/main/<languages>, src/main/<siblings>, 
+    In each module's directory and excluding submodules trees, the Archetype
+    Plugin sorts the files by languages, fileteredExtensions and sensible
+    default base pathes (src/main/<languages>, src/main/<siblings>,
     src/test/<languages>, src/test/<siblings>, ...).
 
-    This defines a tri-dimensional matrix. Each sorted group (matrix' cases) 
+    This defines a tri-dimensional matrix. Each sorted group (matrix' cases)
     becomes a resolved fileset.
diff --git a/archetype-plugin/src/site/apt/specification/generate.apt b/archetype-plugin/src/site/apt/specification/generate.apt
index 2903e8b..bce53d3 100644
--- a/archetype-plugin/src/site/apt/specification/generate.apt
+++ b/archetype-plugin/src/site/apt/specification/generate.apt
@@ -29,80 +29,81 @@
 
 What is done during the creation of a project?
 
-* Archetype selection 
+* Archetype selection
 
-    First the Archetype Plugin asks the user to select an archetype from a list
+    First, the Archetype Plugin asks the user to select an archetype from a list
     of known archetypes. Archetypes are known using archetype catalogs.
 
 * Archetype configuration
 
-    Then the Archetype Plugin ask the user to provide values for each of the 
-    four main required properties. Which are the project's groupId, artifactId,
-    version and package. 
+    Then the Archetype Plugin asks the user to provide values for each of the
+    four main required properties, which are the project's groupId, artifactId,
+    version and package.
 
     It also ask for values of the additional required properties defined in the
     archetype's metadata file.
 
 * Project generation
 
-    Finally, the Archetype Plugin generates the Maven 2 project from the 
+    Finally, the Archetype Plugin generates the Maven 2 project from the
     selected/configured archetype.
 
-    The archetype used to generate the project can be single or multi module.
+    The archetype used to generate the project can be single or multi-module.
 
-    The archetype used to generate the project can be partial, which means it 
+    The archetype used to generate the project can be partial, which means it
     enhances an existing project instead of creating a new one.
 
-    If the Archetype Plugin is called from an existing project, using a 
-    complete (not partial) archetype, then it generates a sub module in the 
+    If the Archetype Plugin is called from an existing project, using a
+    complete (not partial) archetype, then it generates a sub module in the
     existing project.
 
-    If the Archetype Plugin is configured to create a project in an existing 
-    directory, it first check for the existence of a <<<pom.xml>>> file before 
+    If the Archetype Plugin is configured to create a project in an existing
+    directory, it first checks for the existence of a <<<pom.xml>>> file before
     failing the generation.
 
 * Batch mode
 
-    It is possible to call the Archetype Plugin to generate project in batch 
-    mode (to get rid of the prompting). This is achieved by providing the 
+    It is possible to call the Archetype Plugin to generate project in batch
+    mode (to get rid of the prompting). This is achieved by providing the
     Archetype Plugin with all the needed values as system properties.
 
     * <<<archetypeCatalog>>> which defaults to internal specifies the catalog(s)
-       The valid catalogs are: internal (the default), local, remote, file://path, http://url. 
+       The valid catalogs are: <<<internal>>> (the default), <<<local>>>, <<<remote>>>,
+       <<<file://path>>>, <<<http://url>>>.
 
-       * <<<internal>>> uses an internal catalog 
+       * <<<internal>>> uses an internal catalog
 
-       * <<<local>>> uses the ~/.m2/archetype-catalog.xml file 
+       * <<<local>>> uses the <<<~/.m2/archetype-catalog.xml>>> file
 
-       * <<<remote>>> uses the http://repo1.maven.org/maven2/archetype-catalog.xml 
-         file 
+       * <<<remote>>> uses the <<<http://repo1.maven.org/maven2/archetype-catalog.xml>>>
+         file
 
-       * <<<file://path>>> uses the catalog file defined by path (or the 
-         <<<archetype-catalog.xml>>> file located in path directory) 
+       * <<<file://path>>> uses the catalog file defined by path (or the
+         <<<archetype-catalog.xml>>> file located in path directory)
 
-       * <<<http://url>>> uses the catalog file defined by url (or the 
+       * <<<http://url>>> uses the catalog file defined by url (or the
          <<<archetype-catalog.xml>>> file located in url web directory)
 
        []
-  
+
     * <<<archetypeGroupId>>> specifies the groupId of the archetype to use
-  
+
     * <<<archetypeArtifactId>>> specifies the artifactId of the archetype to use
-  
+
     * <<<archetypeVersion>>> specifies the version of the archetype to use
-  
+
     * <<<archetypeRepository>>> specifies the repository in which the archetype
       resides
-  
+
     * <<<groupId>>> specifies the groupId of the generated project
-  
+
     * <<<artifactId>>> specifies the artifactId of the generated project
-  
+
     * <<<version>>> specifies the version of the generated project
-  
-    * <<<package>>> specifies the package for the sources of the generated 
+
+    * <<<package>>> specifies the package for the sources of the generated
       project
-  
+
     * <<<anotherVelocityProperty>>> specifies any other required property
 
     []
diff --git a/archetype-plugin/src/site/apt/specification/specification.apt b/archetype-plugin/src/site/apt/specification/specification.apt
index 8dff801..1320208 100644
--- a/archetype-plugin/src/site/apt/specification/specification.apt
+++ b/archetype-plugin/src/site/apt/specification/specification.apt
@@ -29,21 +29,21 @@
 
 Specification
 
-    The Specification of the Archetype Plugin aims to answer to the following 
+    The Specification of the Archetype Plugin aims to answer to the following
     questions:
 
-    * {{{archetype.html}What is an archetype?}}
+    * {{{./archetype.html}What is an archetype?}}
 
-    * {{{archetype-metadata.html}How metadata on an archetype is stored?}}
+    * {{{./archetype-metadata.html}How is metadata on an archetype stored?}}
 
-    * {{{generate.html}What is done during the creation of a project?}}
+    * {{{./generate.html}What is done during the creation of a project?}}
 
-    * {{{archetype-catalog.html}How the Archetype Plugin know about archetype?}}
+    * {{{./archetype-catalog.html}How does the Archetype Plugin know about archetype?}}
 
-~~    * {{{create-from-project.html}What is done during the creation of an archetype?}}
+    * {{{./create-from-project.html}What is done during the creation of an archetype?}}
 ~~
-~~    * {{{update-catalog.html}How the Archetype Plugin know about new archetypes?}}
+~~    * {{{./update-catalog.html}How does the Archetype Plugin know about new archetypes?}}
 ~~
-~~    * {{{crawl-repository.html}How archetype lists are created?}}
-    
+~~    * {{{./crawl-repository.html}How are archetype lists created?}}
+
     []
\ No newline at end of file
diff --git a/archetype-plugin/src/site/site.xml b/archetype-plugin/src/site/site.xml
index a00397e..fe95d96 100644
--- a/archetype-plugin/src/site/site.xml
+++ b/archetype-plugin/src/site/site.xml
@@ -20,42 +20,19 @@
  * under the License.
  */
   -->
-  <project name="Maven Archetype Plugin">
-  <bannerLeft>
-    <name>Maven Archetype Plugin</name>
-    <src>http://maven.apache.org/images/apache-maven-project-2.png</src>
-    <href>http://maven.apache.org/</href>
-  </bannerLeft>
-  <bannerRight>
-    <src>http://maven.apache.org/images/maven-logo-2.gif</src>
-  </bannerRight>
-  <skin>
-    <groupId>org.apache.maven.skins</groupId>
-    <artifactId>maven-stylus-skin</artifactId>
-  </skin>
-  <publishDate format="dd MMM yyyy" position="left" />
-  <version position="left" />
+<project name="Maven Archetype Plugin"
+  xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
   <body>
-    <links>
-      <item name="Apache" href="http://www.apache.org/"/>
-      <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
-      <item name="Maven 2.x" href="http://maven.apache.org/"/>
-      <item name="Maven 2.x Plugins" href="http://maven.apache.org/plugins/"/>
-      <item name="SCM" href="http://maven.apache.org/scm"/>
-      <item name="Wagon" href="http://maven.apache.org/wagon"/>
-      <item name="JXR" href="http://maven.apache.org/jxr"/>
-      <item name="Doxia" href="http://maven.apache.org/doxia"/>
-    </links>
-
     <menu name="Overview">
       <item name="Introduction" href="/index.html"/>
       <item name="Usage" href="/usage.html"/>
       <item name="Advanced Usage" href="/advanced-usage.html"/>
-      <item name="Goals" href="/plugin-info.html"/>      
+      <item name="Goals" href="/plugin-info.html"/>
       <!--item name="FAQ" href="faq.html"/-->
       <item name="Specification" href="/specification/specification.html"/>
     </menu>
-    
+
     <!--menu name="Examples">
       <item name="Specifying the Remote Repositories" href="/examples/remote-repositories.html"/>
       <item name="Creating a Simple Java Application" href="/examples/simple.html"/>
@@ -66,7 +43,7 @@
       <item name="Creating a Mojo" href="/examples/mojo.html"/>
 	  <item name="Creating your own Archetype" href="/examples/archetype.html"/>
     </menu-->
-    
+
     <!--menu name="Specification">
       <item name="Introduction to archetype plugin" href="./main.html"/>
       <item name="What are archetypes ?" href="./archetypes.html"/>
@@ -76,7 +53,5 @@
       <item name="Mojos of the plugin" href="./mojos.html"/>
       <item name="Desing of the archetype plugin" href="./design.html"/>
     </menu-->
-    
-    <menu ref="reports"/>
   </body>
 </project>
diff --git a/archetype-plugin/src/test/projects/deep-inheritence/a/b/pom.xml b/archetype-plugin/src/test/projects/deep-inheritence/a/b/pom.xml
index 6ff283c..eba4c81 100644
--- a/archetype-plugin/src/test/projects/deep-inheritence/a/b/pom.xml
+++ b/archetype-plugin/src/test/projects/deep-inheritence/a/b/pom.xml
@@ -1,32 +1,32 @@
-<?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>

-  <parent>

-    <groupId>org.apache.maven.archetype.test.a</groupId>

-    <artifactId>deep-inheritence-test-a</artifactId>

-    <version>1-SNAPSHOT</version>

-  </parent>

-  <artifactId>deep-inheritence-test-b</artifactId>

-  <packaging>pom</packaging>

-  <name>Inheritence B</name>

-

-</project>

+<?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>
+  <parent>
+    <groupId>org.apache.maven.archetype.test.a</groupId>
+    <artifactId>deep-inheritence-test-a</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+  <artifactId>deep-inheritence-test-b</artifactId>
+  <packaging>pom</packaging>
+  <name>Inheritence B</name>
+
+</project>
diff --git a/archetype-plugin/src/test/projects/deep-inheritence/a/pom.xml b/archetype-plugin/src/test/projects/deep-inheritence/a/pom.xml
index bcaf50e..3f00e9b 100644
--- a/archetype-plugin/src/test/projects/deep-inheritence/a/pom.xml
+++ b/archetype-plugin/src/test/projects/deep-inheritence/a/pom.xml
@@ -1,37 +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.

-  -->

-<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>deep-inheritence-test</artifactId>

-    <groupId>org.apache.maven.archetype.test</groupId>

-    <version>1-SNAPSHOT</version>

-  </parent>

-  <groupId>org.apache.maven.archetype.test.a</groupId>

-  <artifactId>deep-inheritence-test-a</artifactId>

-  <packaging>pom</packaging>

-  <name>Inheritence A</name>

-

-  <modules>

-    <module>b</module>

-  </modules>

-

-</project>

+<?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>
+  <parent>
+    <artifactId>deep-inheritence-test</artifactId>
+    <groupId>org.apache.maven.archetype.test</groupId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.maven.archetype.test.a</groupId>
+  <artifactId>deep-inheritence-test-a</artifactId>
+  <packaging>pom</packaging>
+  <name>Inheritence A</name>
+
+  <modules>
+    <module>b</module>
+  </modules>
+
+</project>
diff --git a/archetype-plugin/src/test/projects/deep-inheritence/pom.xml b/archetype-plugin/src/test/projects/deep-inheritence/pom.xml
index daff4e9..89263d1 100644
--- a/archetype-plugin/src/test/projects/deep-inheritence/pom.xml
+++ b/archetype-plugin/src/test/projects/deep-inheritence/pom.xml
@@ -1,40 +1,40 @@
-<?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>

-  <parent>

-    <artifactId>maven-parent</artifactId>

-    <groupId>org.apache.maven</groupId>

-    <version>6</version>

-    <relativePath>../pom/maven/pom.xml</relativePath>

-  </parent>

-  <groupId>org.apache.maven.archetype.test</groupId>

-  <artifactId>deep-inheritence-test</artifactId>

-  <packaging>pom</packaging>

-  <name>Maven Archetype - Test - Deep Inheritence</name>

-  <version>1-SNAPSHOT</version>

-

-

-  <modules>

-    <module>a</module>

-  </modules>

-

-</project>

+<?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>
+  <parent>
+    <artifactId>maven-parent</artifactId>
+    <groupId>org.apache.maven</groupId>
+    <version>6</version>
+    <relativePath>../pom/maven/pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.maven.archetype.test</groupId>
+  <artifactId>deep-inheritence-test</artifactId>
+  <packaging>pom</packaging>
+  <name>Maven Archetype - Test - Deep Inheritence</name>
+  <version>1-SNAPSHOT</version>
+
+
+  <modules>
+    <module>a</module>
+  </modules>
+
+</project>
diff --git a/archetype-plugin/src/test/projects/sibling-dependency/a/pom.xml b/archetype-plugin/src/test/projects/sibling-dependency/a/pom.xml
index fe00e15..37ee46e 100644
--- a/archetype-plugin/src/test/projects/sibling-dependency/a/pom.xml
+++ b/archetype-plugin/src/test/projects/sibling-dependency/a/pom.xml
@@ -1,33 +1,33 @@
-<?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>

-  <parent>

-    <artifactId>sibling-dependency-test</artifactId>

-    <groupId>org.apache.maven.archetype.test</groupId>

-    <version>1-SNAPSHOT</version>

-  </parent>

-

-  <artifactId>sibling-dependency-test-a</artifactId>

-  <packaging>jar</packaging>

-  <name>Sibling Dependency A</name>

-

-</project>

+<?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>
+  <parent>
+    <artifactId>sibling-dependency-test</artifactId>
+    <groupId>org.apache.maven.archetype.test</groupId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>sibling-dependency-test-a</artifactId>
+  <packaging>jar</packaging>
+  <name>Sibling Dependency A</name>
+
+</project>
diff --git a/archetype-plugin/src/test/projects/sibling-dependency/b/pom.xml b/archetype-plugin/src/test/projects/sibling-dependency/b/pom.xml
index 986889a..af620c1 100644
--- a/archetype-plugin/src/test/projects/sibling-dependency/b/pom.xml
+++ b/archetype-plugin/src/test/projects/sibling-dependency/b/pom.xml
@@ -1,41 +1,41 @@
-<?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>

-  <parent>

-    <artifactId>sibling-dependency-test</artifactId>

-    <groupId>org.apache.maven.archetype.test</groupId>

-    <version>1-SNAPSHOT</version>

-  </parent>

-

-  <artifactId>sibling-dependency-test-b</artifactId>

-  <packaging>jar</packaging>

-  <name>Sibling Dependency B</name>

-

-

-  <dependencies>

-    <dependency>

-      <groupId>org.apache.maven.archetype.test</groupId>

-      <artifactId>sibling-dependency-test-a</artifactId>

-      <version>1-SNAPSHOT</version>

-    </dependency>

-  </dependencies>

-</project>

+<?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>
+  <parent>
+    <artifactId>sibling-dependency-test</artifactId>
+    <groupId>org.apache.maven.archetype.test</groupId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>sibling-dependency-test-b</artifactId>
+  <packaging>jar</packaging>
+  <name>Sibling Dependency B</name>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.archetype.test</groupId>
+      <artifactId>sibling-dependency-test-a</artifactId>
+      <version>1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archetype-plugin/src/test/projects/sibling-dependency/pom.xml b/archetype-plugin/src/test/projects/sibling-dependency/pom.xml
index 521b93b..ff6baba 100644
--- a/archetype-plugin/src/test/projects/sibling-dependency/pom.xml
+++ b/archetype-plugin/src/test/projects/sibling-dependency/pom.xml
@@ -1,41 +1,41 @@
-<?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>

-  <parent>

-    <artifactId>maven-parent</artifactId>

-    <groupId>org.apache.maven</groupId>

-    <version>6</version>

-    <relativePath>../pom/maven/pom.xml</relativePath>

-  </parent>

-  <groupId>org.apache.maven.archetype.test</groupId>

-  <artifactId>sibling-dependency-test</artifactId>

-  <packaging>pom</packaging>

-  <name>Maven Archetype - Test - Sibling Dependencies</name>

-  <version>1-SNAPSHOT</version>

-

-

-  <modules>

-    <module>a</module>

-    <module>b</module>

-  </modules>

-

-</project>

+<?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>
+  <parent>
+    <artifactId>maven-parent</artifactId>
+    <groupId>org.apache.maven</groupId>
+    <version>6</version>
+    <relativePath>../pom/maven/pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.maven.archetype.test</groupId>
+  <artifactId>sibling-dependency-test</artifactId>
+  <packaging>pom</packaging>
+  <name>Maven Archetype - Test - Sibling Dependencies</name>
+  <version>1-SNAPSHOT</version>
+
+
+  <modules>
+    <module>a</module>
+    <module>b</module>
+  </modules>
+
+</project>
diff --git a/archetype-plugin/src/test/projects/simple-inheritence/enforcer-rules/pom.xml b/archetype-plugin/src/test/projects/simple-inheritence/enforcer-rules/pom.xml
index fabcf82..b81511f 100644
--- a/archetype-plugin/src/test/projects/simple-inheritence/enforcer-rules/pom.xml
+++ b/archetype-plugin/src/test/projects/simple-inheritence/enforcer-rules/pom.xml
@@ -1,120 +1,120 @@
-<?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>

-  <parent>

-    <groupId>org.codehaus.mojo</groupId>

-    <artifactId>mojo</artifactId>

-    <version>16</version>

-    <!--groupId>org.apache.maven.archetype.test</groupId>

-         <artifactId>inheritence-test</artifactId>

-     <version>1-SNAPSHOT</version-->

-  </parent>

-

-  <artifactId>enforcer-rules</artifactId>

-  <packaging>jar</packaging>

-  <version>1.0-SNAPSHOT</version>

-

-  <name>Enforcer Rules</name>

-  <description>This component contains the standard Enforcer Rules</description>

-  <build>

-    <plugins>

-      <plugin>

-        <artifactId>maven-compiler-plugin</artifactId>

-        <configuration>

-          <source>1.4</source>

-          <target>1.4</target>

-        </configuration>

-      </plugin>

-      <plugin>

-        <groupId>org.codehaus.plexus</groupId>

-        <artifactId>plexus-maven-plugin</artifactId>

-        <executions>

-          <execution>

-            <goals>

-              <goal>descriptor</goal>

-            </goals>

-          </execution>

-        </executions>

-      </plugin>

-      <plugin>

-        <groupId>org.apache.maven.plugins</groupId>

-        <artifactId>maven-jar-plugin</artifactId>

-        <executions>

-          <execution>

-            <goals>

-              <goal>test-jar</goal>

-            </goals>

-          </execution>

-        </executions>

-      </plugin>

-    </plugins>

-  </build>

-  <dependencies>

-    <dependency>

-      <groupId>org.apache.maven</groupId>

-      <artifactId>maven-artifact</artifactId>

-      <version>2.0.7</version>

-    </dependency>

-    <dependency>

-      <groupId>org.apache.maven</groupId>

-      <artifactId>maven-plugin-api</artifactId>

-      <version>2.0.7</version>

-    </dependency>

-    <dependency>

-      <groupId>org.apache.maven</groupId>

-      <artifactId>maven-project</artifactId>

-      <version>2.0.7</version>

-    </dependency>

-    <dependency>

-      <groupId>org.apache.maven</groupId>

-      <artifactId>maven-core</artifactId>

-      <version>2.0.7</version>

-    </dependency>

-    <dependency>

-      <groupId>org.codehaus.plexus</groupId>

-      <artifactId>plexus-utils</artifactId>

-      <version>1.4.2</version>

-    </dependency>

-    <dependency>

-      <groupId>org.apache.maven.shared</groupId>

-      <artifactId>maven-plugin-testing-harness</artifactId>

-      <scope>test</scope>

-      <version>1.1</version>

-    </dependency>

-    <dependency>

-      <groupId>commons-lang</groupId>

-      <artifactId>commons-lang</artifactId>

-      <version>2.3</version>

-    </dependency>

-    <dependency>

-      <groupId>org.beanshell</groupId>

-      <artifactId>bsh</artifactId>

-      <version>2.0b4</version>

-    </dependency>

-    <dependency>

-      <groupId>junit</groupId>

-      <artifactId>junit</artifactId>

-      <version>3.8.1</version>

-      <scope>test</scope>

-    </dependency>

-  </dependencies>

-</project>

+<?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>
+  <parent>
+    <groupId>org.codehaus.mojo</groupId>
+    <artifactId>mojo</artifactId>
+    <version>16</version>
+    <!--groupId>org.apache.maven.archetype.test</groupId>
+         <artifactId>inheritence-test</artifactId>
+     <version>1-SNAPSHOT</version-->
+  </parent>
+
+  <artifactId>enforcer-rules</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Enforcer Rules</name>
+  <description>This component contains the standard Enforcer Rules</description>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <scope>test</scope>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.beanshell</groupId>
+      <artifactId>bsh</artifactId>
+      <version>2.0b4</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archetype-plugin/src/test/projects/simple-inheritence/pom.xml b/archetype-plugin/src/test/projects/simple-inheritence/pom.xml
index a35dea3..aa73c7c 100644
--- a/archetype-plugin/src/test/projects/simple-inheritence/pom.xml
+++ b/archetype-plugin/src/test/projects/simple-inheritence/pom.xml
@@ -1,122 +1,122 @@
-<?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>

-  <parent>

-    <artifactId>maven-parent</artifactId>

-    <groupId>org.apache.maven</groupId>

-    <version>6</version>

-    <relativePath>../pom/maven/pom.xml</relativePath>

-  </parent>

-  <groupId>org.apache.maven.archetype.test</groupId>

-  <artifactId>inheritence-test</artifactId>

-  <packaging>pom</packaging>

-  <name>Maven archetype - Test - Simple Inheritence</name>

-  <version>1-SNAPSHOT</version>

-  <description>Enforcer is a build rule execution framework.</description>

-  <url>http://maven.apache.org/enforcer</url>

-  <issueManagement>

-    <system>jira</system>

-    <url>http://jira.codehaus.org/browse/MENFORCER</url>

-  </issueManagement>

-  <inceptionYear>2006</inceptionYear>

-  <licenses>

-    <license>

-      <name>Apache License 2.0</name>

-      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>

-      <distribution>repo</distribution>

-    </license>

-  </licenses>

-  <developers>

-    <developer>

-      <id>brianf</id>

-      <name>Brian Fox</name>

-      <email>brianf@apache.org</email>

-      <roles>

-        <role>Lead Developer</role>

-      </roles>

-      <timezone>5</timezone>

-    </developer>

-  </developers>

-  <mailingLists>

-    <mailingList>

-      <name>Maven User List</name>

-      <subscribe>users-subscribe@maven.apache.org</subscribe>

-      <unsubscribe>users-unsubscribe@maven.apache.org</unsubscribe>

-      <post>users@maven.apache.org</post>

-      <archive>http://mail-archives.apache.org/mod_mbox/maven-users</archive>

-      <otherArchives>

-        <otherArchive>http://www.mail-archive.com/users@maven.apache.org/</otherArchive>

-        <otherArchive>http://www.nabble.com/Maven---Users-f178.html</otherArchive>

-      </otherArchives>

-    </mailingList>

-  </mailingLists>

-  <scm>

-    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/enforcer/trunk/</connection>

-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/enforcer/trunk/</developerConnection>

-    <url>http://svn.apache.org/viewcvs.cgi/maven/enforcer/trunk</url>

-  </scm>

-

-  <build>

-    <resources>

-      <!-- Include super-pom defined main/resources

-       Removing this section will break the build.

-       Since we have defined a new build/resources

-       section for the Apache process LICENSE and NOTICE

-       files, this original default section is now

-       required. -->

-      <resource>

-        <directory>${basedir}/src/main/resources</directory>

-      </resource>

-    </resources>

-    <pluginManagement>

-      <plugins>

-        <plugin>

-          <artifactId>maven-release-plugin</artifactId>

-          <configuration>

-            <tagBase>https://svn.apache.org/repos/asf/maven/enforcer/tags</tagBase>

-          </configuration>

-        </plugin>

-      </plugins>

-    </pluginManagement>

-  </build>

-  <distributionManagement>

-    <site>

-      <id>apache.website</id>

-      <url>scp://people.apache.org/www/maven.apache.org/enforcer/</url>

-    </site>

-  </distributionManagement>

-  <repositories>

-    <repository>

-      <releases>

-        <enabled>false</enabled>

-      </releases>

-      <id>codehaus.snapshots</id>

-      <name>Codehaus Snapshot Development Repository</name>

-      <url>http://snapshots.repository.codehaus.org</url>

-    </repository>

-  </repositories>

-

-  <modules>

-    <module>enforcer-rules</module>

-  </modules>

-

-</project>

+<?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>
+  <parent>
+    <artifactId>maven-parent</artifactId>
+    <groupId>org.apache.maven</groupId>
+    <version>6</version>
+    <relativePath>../pom/maven/pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.maven.archetype.test</groupId>
+  <artifactId>inheritence-test</artifactId>
+  <packaging>pom</packaging>
+  <name>Maven archetype - Test - Simple Inheritence</name>
+  <version>1-SNAPSHOT</version>
+  <description>Enforcer is a build rule execution framework.</description>
+  <url>http://maven.apache.org/enforcer</url>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.codehaus.org/browse/MENFORCER</url>
+  </issueManagement>
+  <inceptionYear>2006</inceptionYear>
+  <licenses>
+    <license>
+      <name>Apache License 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+  <developers>
+    <developer>
+      <id>brianf</id>
+      <name>Brian Fox</name>
+      <email>brianf@apache.org</email>
+      <roles>
+        <role>Lead Developer</role>
+      </roles>
+      <timezone>5</timezone>
+    </developer>
+  </developers>
+  <mailingLists>
+    <mailingList>
+      <name>Maven User List</name>
+      <subscribe>users-subscribe@maven.apache.org</subscribe>
+      <unsubscribe>users-unsubscribe@maven.apache.org</unsubscribe>
+      <post>users@maven.apache.org</post>
+      <archive>http://mail-archives.apache.org/mod_mbox/maven-users</archive>
+      <otherArchives>
+        <otherArchive>http://www.mail-archive.com/users@maven.apache.org/</otherArchive>
+        <otherArchive>http://www.nabble.com/Maven---Users-f178.html</otherArchive>
+      </otherArchives>
+    </mailingList>
+  </mailingLists>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/enforcer/trunk/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/enforcer/trunk/</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/enforcer/trunk</url>
+  </scm>
+
+  <build>
+    <resources>
+      <!-- Include super-pom defined main/resources
+       Removing this section will break the build.
+       Since we have defined a new build/resources
+       section for the Apache process LICENSE and NOTICE
+       files, this original default section is now
+       required. -->
+      <resource>
+        <directory>${basedir}/src/main/resources</directory>
+      </resource>
+    </resources>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-release-plugin</artifactId>
+          <configuration>
+            <tagBase>https://svn.apache.org/repos/asf/maven/enforcer/tags</tagBase>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <distributionManagement>
+    <site>
+      <id>apache.website</id>
+      <url>scp://people.apache.org/www/maven.apache.org/enforcer/</url>
+    </site>
+  </distributionManagement>
+  <repositories>
+    <repository>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <id>codehaus.snapshots</id>
+      <name>Codehaus Snapshot Development Repository</name>
+      <url>http://snapshots.repository.codehaus.org</url>
+    </repository>
+  </repositories>
+
+  <modules>
+    <module>enforcer-rules</module>
+  </modules>
+
+</project>
diff --git a/archetype-testing/archetype-proxy/pom.xml b/archetype-testing/archetype-proxy/pom.xml
index 58816ec..0a9987b 100644
--- a/archetype-testing/archetype-proxy/pom.xml
+++ b/archetype-testing/archetype-proxy/pom.xml
@@ -1,3 +1,24 @@
+<?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/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
@@ -9,9 +30,9 @@
   </parent>
 
   <artifactId>archetype-proxy</artifactId>
+  <packaging>war</packaging>
 
   <name>Maven Archetype Webapp Proxy</name>
-  <packaging>war</packaging>
 
   <dependencies>
     <dependency>
diff --git a/archetype-testing/archetype-repository/pom.xml b/archetype-testing/archetype-repository/pom.xml
index c5fb6d0..ec74ddf 100644
--- a/archetype-testing/archetype-repository/pom.xml
+++ b/archetype-testing/archetype-repository/pom.xml
@@ -1,3 +1,24 @@
+<?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/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
@@ -9,9 +30,9 @@
   </parent>
 
   <artifactId>archetype-repository</artifactId>
+  <packaging>war</packaging>
 
   <name>Maven Archetype Webapp Repository</name>
-  <packaging>war</packaging>
 
   <dependencies>
     <dependency>
diff --git a/archetype-testing/pom.xml b/archetype-testing/pom.xml
index 72efd7e..3f9e9a7 100644
--- a/archetype-testing/pom.xml
+++ b/archetype-testing/pom.xml
@@ -1,3 +1,24 @@
+<?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/xsd/maven-4.0.0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
@@ -9,10 +30,10 @@
   </parent>
 
   <artifactId>archetype-testing</artifactId>
-
+  <packaging>pom</packaging>
 
   <name>Maven Archetype Testing</name>
-  <packaging>pom</packaging>
+  <description>Tools used to test Maven Archetype.</description>
 
   <modules>
     <module>archetype-proxy</module>
diff --git a/archetype-testing/src/site/site.xml b/archetype-testing/src/site/site.xml
new file mode 100644
index 0000000..d8fdce1
--- /dev/null
+++ b/archetype-testing/src/site/site.xml
@@ -0,0 +1,28 @@
+<?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/DECORATION/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" inherit="top" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-archetype/pom.xml b/maven-archetype-bundles/maven-archetype-archetype/pom.xml
new file mode 100644
index 0000000..ad04ed8
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-archetype</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Archetype Archetype</name>
+  <description>
+    An archetype which contains a sample archetype.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-archetype</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-archetype</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-archetype</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..08a72ba
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,13 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>archetype</id>
+
+  <resources>
+    <resource>src/main/resources/archetype-resources/pom.xml</resource>
+    <resource>src/main/resources/archetype-resources/src/main/java/App.java</resource>
+    <resource>src/main/resources/archetype-resources/src/test/java/AppTest.java</resource>
+    <resource>src/main/resources/archetype-resources/src/test/resources/projects/basic/archetype.properties</resource>
+    <resource>src/main/resources/archetype-resources/src/test/resources/projects/basic/goal.txt</resource>
+    <resource>src/main/resources/META-INF/maven/archetype.xml</resource>
+  </resources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..8870424
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,35 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Archetype - ${artifactId}</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>2.0-alpha-5-SNAPSHOT</version>
+      </extension>
+    </extensions>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>2.0-alpha-5-SNAPSHOT</version>
+          <extensions>true</extensions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..db3c4c9
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,11 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>${artifactId}</id>
+
+  <sources>
+    <source>src/main/java/App.java</source>
+  </sources>
+  <testSources>
+    <source>src/test/java/AppTest.java</source>
+  </testSources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..8e0c686
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,17 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>$${groupId}</groupId>
+  <artifactId>$${artifactId}</artifactId>
+  <version>$${version}</version>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..56524de
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/main/java/App.java
@@ -0,0 +1,13 @@
+package $$package;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/java/AppTest.java b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/java/AppTest.java
new file mode 100644
index 0000000..7aa4558
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/java/AppTest.java
@@ -0,0 +1,38 @@
+package $$package;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/main/resources/archetype-resources/src/main/resources/archetype-resources/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/site/site.xml b/maven-archetype-bundles/maven-archetype-archetype/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-archetype/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/pom.xml
new file mode 100644
index 0000000..2ff02c3
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-j2ee-simple</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Simple J2EE Archetype</name>
+  <description>
+    An archetype which contains a simplified sample J2EE application.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-j2ee-simple</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-j2ee-simple</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-j2ee-simple</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..41f81e6
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,18 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>j2ee</id>
+
+  <resources>
+    <resource>pom.xml</resource>
+    <resource>ear/pom.xml</resource>
+    <resource>ejbs/src/main/resources/META-INF/ejb-jar.xml</resource>
+    <resource>ejbs/pom.xml</resource>
+    <resource>primary-source/pom.xml</resource>
+    <resource>projects/logging/pom.xml</resource>
+    <resource>projects/pom.xml</resource>
+    <resource>servlets/pom.xml</resource>
+    <resource>servlets/servlet/pom.xml</resource>
+    <resource>servlets/servlet/src/main/webapp/index.jsp</resource>
+    <resource>servlets/servlet/src/main/webapp/WEB-INF/web.xml</resource>
+  </resources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ear/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ear/pom.xml
new file mode 100644
index 0000000..3fac933
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ear/pom.xml
@@ -0,0 +1,53 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root</groupId>
+    <artifactId>project</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project</groupId>
+  <artifactId>ear</artifactId>
+  <version>1.0</version>
+  <packaging>ear</packaging>
+
+  <name>ear assembly</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>root.project</groupId>
+      <artifactId>ejbs</artifactId>
+      <type>ejb</type>
+    </dependency>
+    <dependency>
+      <groupId>root.project.servlets</groupId>
+      <artifactId>servlet</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>root.project</groupId>
+      <artifactId>primary-source</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>root.project.projects</groupId>
+      <artifactId>logging</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-ear-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/pom.xml
new file mode 100644
index 0000000..df5e4e8
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/pom.xml
@@ -0,0 +1,43 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root</groupId>
+    <artifactId>project</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project</groupId>
+  <artifactId>ejbs</artifactId>
+  <version>1.0</version>
+  <packaging>ejb</packaging>
+
+  <name>enterprise java beans</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>root.project</groupId>
+      <artifactId>primary-source</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>root.project.projects</groupId>
+      <artifactId>logging</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-ejb-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/src/main/resources/META-INF/ejb-jar.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/src/main/resources/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/ejbs/src/main/resources/META-INF/ejb-jar.xml
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..6abdd91
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/pom.xml
@@ -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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>root</groupId>
+  <artifactId>project</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <name>project</name>
+
+  <modules>
+    <module>projects</module>
+    <module>primary-source</module>
+    <module>servlets</module>
+    <module>ejbs</module>
+    <module>ear</module>
+  </modules>
+
+  <distributionManagement>
+    <site>
+      <id>site</id>
+      <name>project website</name>
+      <url>scp://local.company.com/websites/project.company.com/</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>root.project.projects</groupId>
+        <artifactId>logging</artifactId>
+        <version>1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>root.project</groupId>
+        <artifactId>primary-source</artifactId>
+        <version>1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>root.project.servlets</groupId>
+        <artifactId>servlet</artifactId>
+        <version>1.0</version>
+        <type>war</type>
+      </dependency>
+      <dependency>
+        <groupId>root.project</groupId>
+        <artifactId>ejbs</artifactId>
+        <version>1.0</version>
+        <type>ejb</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-plugin</artifactId>
+          <configuration>
+            <unzipCommand>/usr/bin/unzip -o > err.txt</unzipCommand>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/primary-source/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/primary-source/pom.xml
new file mode 100644
index 0000000..ccbf480
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/primary-source/pom.xml
@@ -0,0 +1,36 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root</groupId>
+    <artifactId>project</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project</groupId>
+  <artifactId>primary-source</artifactId>
+  <packaging>jar</packaging>
+
+  <name>core project classes</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>root.project.projects</groupId>
+      <artifactId>logging</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <minmemory>128m</minmemory>
+          <maxmemory>512m</maxmemory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/logging/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/logging/pom.xml
new file mode 100644
index 0000000..993e86a
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/logging/pom.xml
@@ -0,0 +1,16 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root.project</groupId>
+    <artifactId>projects</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project.projects</groupId>
+  <artifactId>logging</artifactId>
+  <packaging>jar</packaging>
+
+  <name>logging</name>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/pom.xml
new file mode 100644
index 0000000..590a327
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/projects/pom.xml
@@ -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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root</groupId>
+    <artifactId>project</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project</groupId>
+  <artifactId>projects</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <name>sub projects</name>
+
+  <modules>
+    <module>logging</module>
+  </modules>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/pom.xml
new file mode 100644
index 0000000..6cd5b4a
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/pom.xml
@@ -0,0 +1,22 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root</groupId>
+    <artifactId>project</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project</groupId>
+  <artifactId>servlets</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <name>servlets</name>
+
+  <modules>
+    <module>servlet</module>
+  </modules>
+</project>
+
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/pom.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/pom.xml
new file mode 100644
index 0000000..4b76873
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/pom.xml
@@ -0,0 +1,24 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>root.project</groupId>
+    <artifactId>servlets</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>root.project.servlets</groupId>
+  <artifactId>servlet</artifactId>
+  <packaging>war</packaging>
+
+  <name>servlet</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>root.project</groupId>
+      <artifactId>primary-source</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/WEB-INF/web.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/WEB-INF/web.xml
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/index.jsp b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c38169b
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/main/resources/archetype-resources/servlets/servlet/src/main/webapp/index.jsp
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/site/site.xml b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-j2ee-simple/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-mojo/README.txt b/maven-archetype-bundles/maven-archetype-mojo/README.txt
new file mode 100644
index 0000000..d5f7c58
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/README.txt
@@ -0,0 +1,2 @@
+This is deprecated in favour of an archetype with a better artifactId. That
+being maven-archetype-plugin.
diff --git a/maven-archetype-bundles/maven-archetype-mojo/pom.xml b/maven-archetype-bundles/maven-archetype-mojo/pom.xml
new file mode 100644
index 0000000..ff96aeb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-mojo</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Mojo Archetype</name>
+  <description>
+    An archetype which contains a sample Maven plugin.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-mojo</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-mojo</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-mojo</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..d3c6138
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,8 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>plugin</id>
+
+  <sources>
+    <source>src/main/java/MyMojo.java</source>
+  </sources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..abed731
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,30 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>maven-plugin</packaging>
+
+  <name>${artifactId} Maven Mojo</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java/MyMojo.java b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java/MyMojo.java
new file mode 100644
index 0000000..9476efc
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java/MyMojo.java
@@ -0,0 +1,81 @@
+package $package;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Goal which touches a timestamp file.
+ *
+ * @goal touch
+ * 
+ * @phase process-sources
+ */
+public class MyMojo
+    extends AbstractMojo
+{
+    /**
+     * Location of the file.
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        File f = outputDirectory;
+
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+
+        File touch = new File( f, "touch.txt" );
+
+        FileWriter w = null;
+        try
+        {
+            w = new FileWriter( touch );
+
+            w.write( "touch.txt" );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating file " + touch, e );
+        }
+        finally
+        {
+            if ( w != null )
+            {
+                try
+                {
+                    w.close();
+                }
+                catch ( IOException e )
+                {
+                    // ignore
+                }
+            }
+        }
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/site/site.xml b/maven-archetype-bundles/maven-archetype-mojo/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-mojo/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/pom.xml b/maven-archetype-bundles/maven-archetype-plugin-site/pom.xml
new file mode 100644
index 0000000..09cc917
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/pom.xml
@@ -0,0 +1,47 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-plugin-site</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Plugin Site Archetype</name>
+  <description>
+    An archetype which contains a sample Maven plugin site. This archetype can be layered upon an
+    existing Maven plugin project.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin-site</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin-site</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin-site</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..442aa7d
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,12 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>plugin</id>
+  <allowPartial>true</allowPartial>
+
+  <siteResources>
+    <resource>src/site/site.xml</resource>
+    <resource>src/site/apt/index.apt</resource>
+    <resource>src/site/apt/usage.apt</resource>
+    <resource>src/site/apt/examples/example.apt</resource>
+  </siteResources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..1d99ecc
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,23 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven</name>
+  <url>http://maven.apache.org/</url>
+  <inceptionYear>2001</inceptionYear>
+
+  <distributionManagement>
+    <site>
+      <id>website</id>
+      <url>file://${basedir}/target/deployed-site</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/examples/example.apt b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/examples/example.apt
new file mode 100644
index 0000000..de78b9b
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/examples/example.apt
@@ -0,0 +1,34 @@
+ ------
+ SMTP Authentication
+ ------
+ Allan Ramirez
+ ------
+ 21 October 2005
+ ------
+
+SMTP Authentication
+
+  If the SMTP host needs authentication, you can provide your username and password
+  in the <<<\<configuration\>>>> section:
+
+-------------------
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-changes-plugin</artifactId>
+        <configuration>
+          <smtpHost>mail.yourhost.com</smtpHost>
+          <smtpPort implementation="java.lang.Integer">25</smtpPort>
+          <username>some@email.com</username>
+          <password>somepassword</password>
+          ...
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
+-------------------
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/index.apt b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/index.apt
new file mode 100644
index 0000000..d71b247
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/index.apt
@@ -0,0 +1,30 @@
+ ------
+ Introduction
+ ------
+ Jason van Zyl
+ ------
+ 27 November 2006
+ ------
+
+Maven 2 SuperDuper Plugin
+
+  This plugin is used to transform your development life. Don't bother with self-help
+  books on how to get over your build-time blues. Just use this plugin and
+  everything will miraculously change.
+
+* Goals Overview
+
+  * {{{superduper-transform.html}superduper:transform}} performs the miraculous build transformation.
+
+  []
+
+* Usage
+
+  Instructions on how to use the SuperDuper Plugin can be found {{{./usage.html}here}}.
+
+* Examples
+
+  To provide you with better understanding of some usages of the SuperDuper Plugin,
+  you can take a look at the following examples:
+
+  * {{{./examples/sample-example.html}Sample Example}}
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/usage.apt b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/usage.apt
new file mode 100644
index 0000000..9ebd6e8
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/apt/usage.apt
@@ -0,0 +1,21 @@
+ ------
+ Usage
+ ------
+ Jason van Zyl
+ ------
+ 27 November 2006
+ ------
+
+Usage
+
+ This plugin is used to create miraculously transform your build!
+ 
+*How to miraculously transform your build
+ 
+ Describe here how you miraculously transform peoples' builds! 
+
+-------------------
+
+Put your awesome example here.
+
+-------------------
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/site.xml b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..a8e1897
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/main/resources/archetype-resources/src/site/site.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.
+ */
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="FAQ" href="faq.html"/>
+    </menu>
+    <menu name="Samples">
+      <item name="Sample Changes Report" href="changes-report.html"/>
+      <item name="Live JIRA Report" href="jira-report.html"/>
+    </menu>
+
+    <menu name="Examples">
+      <item name="Alternate Location for the changes.xml File" href="examples/alternate-changes-xml-location.html"/>
+      <item name="SMTP Authentication" href="examples/smtp-authentication.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/site/site.xml b/maven-archetype-bundles/maven-archetype-plugin-site/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin-site/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-plugin/pom.xml b/maven-archetype-bundles/maven-archetype-plugin/pom.xml
new file mode 100644
index 0000000..c69d5b3
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-plugin</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Plugin Archetype</name>
+  <description>
+    An archetype which contains a sample Maven plugin.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-plugin</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..85536c4
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,7 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>plugin</id>
+  <sources>
+    <source>src/main/java/MyMojo.java</source>
+  </sources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..abed731
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,30 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>maven-plugin</packaging>
+
+  <name>${artifactId} Maven Mojo</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java
new file mode 100644
index 0000000..9476efc
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java
@@ -0,0 +1,81 @@
+package $package;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Goal which touches a timestamp file.
+ *
+ * @goal touch
+ * 
+ * @phase process-sources
+ */
+public class MyMojo
+    extends AbstractMojo
+{
+    /**
+     * Location of the file.
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        File f = outputDirectory;
+
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+
+        File touch = new File( f, "touch.txt" );
+
+        FileWriter w = null;
+        try
+        {
+            w = new FileWriter( touch );
+
+            w.write( "touch.txt" );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating file " + touch, e );
+        }
+        finally
+        {
+            if ( w != null )
+            {
+                try
+                {
+                    w.close();
+                }
+                catch ( IOException e )
+                {
+                    // ignore
+                }
+            }
+        }
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-plugin/src/site/site.xml b/maven-archetype-bundles/maven-archetype-plugin/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-plugin/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-portlet/pom.xml b/maven-archetype-bundles/maven-archetype-portlet/pom.xml
new file mode 100644
index 0000000..a7531d4
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-portlet</artifactId>
+  <version>1.0.2-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Portlet Archetype</name>
+  <description>
+    An archetype which contains a sample JSR-268 Portlet.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-portlet</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-portlet</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-portlet</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..efa7457
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,17 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>webapp</id>
+
+  <sources>
+    <source>src/main/java/MyPortlet.java</source>
+  </sources>
+  <resources>
+    <resource>src/main/jetspeed/web.xml</resource>
+    <resource>src/main/webapp/normal.jsp</resource>
+    <resource>src/main/webapp/maximized.jsp</resource>
+    <resource>src/main/webapp/help.jsp</resource>
+    <resource>src/main/webapp/WEB-INF/web.xml</resource>
+    <resource>src/main/webapp/WEB-INF/portlet.xml</resource>
+    <resource filtered="false">src/main/webapp/WEB-INF/tld/portlet.tld</resource>
+  </resources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..f753c50
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,53 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>war</packaging>
+
+  <name>Maven Portlet Archetype</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>portlet-api</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>jstl</groupId>
+      <artifactId>jstl</artifactId>
+      <version>1.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>taglibs</groupId>
+      <artifactId>standard</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>jetspeed</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-war-plugin</artifactId>
+            <version>2.0-beta-2</version>
+            <configuration>
+              <webXml>src/main/jetspeed/web.xml</webXml>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/java/MyPortlet.java b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/java/MyPortlet.java
new file mode 100644
index 0000000..18b43ee
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/java/MyPortlet.java
@@ -0,0 +1,73 @@
+package $package;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+import java.io.IOException;
+import javax.portlet.PortletConfig;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+public class MyPortlet extends GenericPortlet {
+
+    private static final String NORMAL_VIEW = "/normal.jsp";
+    private static final String MAXIMIZED_VIEW = "/maximized.jsp";
+    private static final String HELP_VIEW = "/help.jsp";
+
+    private PortletRequestDispatcher normalView;
+    private PortletRequestDispatcher maximizedView;
+    private PortletRequestDispatcher helpView;
+
+    public void doView( RenderRequest request, RenderResponse response )
+        throws PortletException, IOException {
+
+        if( WindowState.MINIMIZED.equals( request.getWindowState() ) ) {
+            return;
+        }
+
+        if ( WindowState.NORMAL.equals( request.getWindowState() ) ) {
+            normalView.include( request, response );
+        } else {
+            maximizedView.include( request, response );
+        }
+    }
+
+    protected void doHelp( RenderRequest request, RenderResponse response )
+        throws PortletException, IOException {
+
+        helpView.include( request, response );
+
+    }
+
+    public void init( PortletConfig config ) throws PortletException {
+        super.init( config );
+        normalView = config.getPortletContext().getRequestDispatcher( NORMAL_VIEW );
+        maximizedView = config.getPortletContext().getRequestDispatcher( MAXIMIZED_VIEW );
+        helpView = config.getPortletContext().getRequestDispatcher( HELP_VIEW );
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        helpView = null;
+        super.destroy();
+    }
+
+}
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/jetspeed/web.xml b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/jetspeed/web.xml
new file mode 100644
index 0000000..e7ae6a7
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/jetspeed/web.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+                         "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+  <display-name>${artifactId} Wrapper</display-name>
+
+  <description>Generated Portlet Wrapper</description>
+
+  <servlet>
+    <servlet-name>${artifactId}</servlet-name>
+    <display-name>${artifactId} Portlet</display-name>
+    <description>Portlet for Jetspeed Fusion</description>
+    <servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
+
+    <init-param>
+      <param-name>registerAtInit</param-name>
+      <param-value>1</param-value>
+    </init-param>
+
+    <init-param>
+      <param-name>portletApplication</param-name>
+      <param-value>${artifactId}</param-value>
+    </init-param>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>JetspeedContainer</servlet-name>
+    <url-pattern>/container/*</url-pattern>
+  </servlet-mapping>
+
+  <taglib>
+    <taglib-uri>http://java.sun.com/portlet</taglib-uri>
+    <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
+  </taglib>
+</web-app>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
new file mode 100644
index 0000000..b558a15
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<portlet-app
+    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+    version="1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
+                        http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+
+  <portlet>
+    <description>Write here a short description about your portlet.</description>
+    <portlet-name>${artifactId}</portlet-name>
+    <display-name>${artifactId} Portlet</display-name>
+
+    <portlet-class>${groupId}.${artifactId}</portlet-class>
+
+    <supports>
+      <mime-type>text/html</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+
+    <supported-locale>en</supported-locale>
+
+    <portlet-info>
+      <title>Put the portlet title here</title>
+      <short-title>Portlet Short Title</short-title>
+      <keywords>put keywords here</keywords>
+    </portlet-info>
+  </portlet>
+</portlet-app>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/tld/portlet.tld b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/tld/portlet.tld
new file mode 100644
index 0000000..b4af8ea
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/tld/portlet.tld
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+  "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<!-- 
+Copyright 2004 The Apache Software Foundation
+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.
+-->
+<taglib>
+    <tlibversion>1.0</tlibversion>
+    <jspversion>1.1</jspversion>
+    <shortname>portlet</shortname>
+    <uri>http://java.sun.com/portlet</uri>
+    <tag>
+        <name>defineObjects</name>
+        <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
+        <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+    <tag>
+        <name>param</name>
+        <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>value</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>actionURL</name>
+        <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>renderURL</name>
+        <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>namespace</name>
+        <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+</taglib>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..4e15d34
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+                         "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+  <display-name>FortunePortlet</display-name>
+
+  <description>Automated generated Application Wrapper</description>
+
+  <servlet>
+    <servlet-name>${artifactId}</servlet-name>
+    <display-name>${artifactId} Portlet</display-name>
+    <description>Generated Portlet Wrapper</description>
+    <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+
+    <init-param>
+      <param-name>portlet-class</param-name>
+      <param-value>${groupId}.${artifactId}</param-value>
+    </init-param>
+
+    <init-param>
+      <param-name>portlet-guid</param-name>
+      <param-value>yourportlet.${artifactId}</param-value>
+    </init-param>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>${artifactId}</servlet-name>
+    <url-pattern>/${artifactId}/*</url-pattern>
+  </servlet-mapping>
+
+  <taglib>
+    <taglib-uri>http://java.sun.com/portlet</taglib-uri>
+    <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
+  </taglib>
+</web-app>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/help.jsp b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/help.jsp
new file mode 100644
index 0000000..fa2eced
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/help.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+
+<h4>Need help?</h4>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/maximized.jsp b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/maximized.jsp
new file mode 100644
index 0000000..9c216eb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/maximized.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+
+<h4>This is a much bigger world isn't it?</h4>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/normal.jsp b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/normal.jsp
new file mode 100644
index 0000000..a074fcb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/normal.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+
+<h4>Welcome to the Maven 2 World!</h4>
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/site/site.xml b/maven-archetype-bundles/maven-archetype-portlet/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-portlet/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-profiles/pom.xml b/maven-archetype-bundles/maven-archetype-profiles/pom.xml
new file mode 100644
index 0000000..a04c285
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-profiles</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Profiles Archetype</name>
+  <description>
+    An archetype which contains a sample Maven project which demonstrates the use of profiles.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-profiles</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-profiles</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-profiles</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..68828cc
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,11 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>profiles</id>
+
+  <sources>
+    <source>src/main/java/App.java</source>
+  </sources>
+  <testSources>
+    <source>src/test/java/AppTest.java</source>
+  </testSources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..27fc2e1
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,25 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Quick Start Archetype</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/development.properties b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/development.properties
new file mode 100644
index 0000000..0dac23f
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/development.properties
@@ -0,0 +1 @@
+environment=development
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/production.properties b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/production.properties
new file mode 100644
index 0000000..4387f9c
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/production.properties
@@ -0,0 +1 @@
+environment=production
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/qa.properties b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/qa.properties
new file mode 100644
index 0000000..8b54f33
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/filters/qa.properties
@@ -0,0 +1 @@
+environment=qa
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..c09c3ce
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/main/java/App.java
@@ -0,0 +1,13 @@
+package $package;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/test/java/AppTest.java b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/test/java/AppTest.java
new file mode 100644
index 0000000..bd9bf4e
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/main/resources/archetype-resources/src/test/java/AppTest.java
@@ -0,0 +1,38 @@
+package $package;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/site/site.xml b/maven-archetype-bundles/maven-archetype-profiles/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-profiles/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/pom.xml b/maven-archetype-bundles/maven-archetype-quickstart/pom.xml
new file mode 100644
index 0000000..b46f908
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/pom.xml
@@ -0,0 +1,54 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-quickstart</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Quickstart Archetype</name>
+  <description>
+    An archetype which contains a sample Maven project.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-quickstart</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-quickstart</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-quickstart</url>
+  </scm>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..84f0d1c
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,11 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>quickstart</id>
+
+  <sources>
+    <source>src/main/java/App.java</source>
+  </sources>
+  <testSources>
+    <source>src/test/java/AppTest.java</source>
+  </testSources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..60a4991
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,25 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>jar</packaging>
+
+  <name>${artifactId}</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..c09c3ce
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java
@@ -0,0 +1,13 @@
+package $package;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java
new file mode 100644
index 0000000..bd9bf4e
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java
@@ -0,0 +1,38 @@
+package $package;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/site/site.xml b/maven-archetype-bundles/maven-archetype-quickstart/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-quickstart/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-simple/pom.xml b/maven-archetype-bundles/maven-archetype-simple/pom.xml
new file mode 100644
index 0000000..7f4f4eb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/pom.xml
@@ -0,0 +1,55 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-simple</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Simple Project Archetype</name>
+  <description>
+    An archetype which contains a simple Maven project.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-simple</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-simple</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-simple</url>
+  </scm>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/main/archetype/archetype.properties b/maven-archetype-bundles/maven-archetype-simple/src/main/archetype/archetype.properties
new file mode 100644
index 0000000..82f9521
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/main/archetype/archetype.properties
@@ -0,0 +1 @@
+package=archetype
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/main/java/archetype/App.java b/maven-archetype-bundles/maven-archetype-simple/src/main/java/archetype/App.java
new file mode 100644
index 0000000..8f6ce0d
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/main/java/archetype/App.java
@@ -0,0 +1,13 @@
+package archetype;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/main/resources/app.properties b/maven-archetype-bundles/maven-archetype-simple/src/main/resources/app.properties
new file mode 100644
index 0000000..0cc05aa
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/main/resources/app.properties
@@ -0,0 +1 @@
+app=Coolio
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/site/site.xml b/maven-archetype-bundles/maven-archetype-simple/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/test/java/archetype/AppTest.java b/maven-archetype-bundles/maven-archetype-simple/src/test/java/archetype/AppTest.java
new file mode 100644
index 0000000..17dabaf
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/test/java/archetype/AppTest.java
@@ -0,0 +1,38 @@
+package archetype;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
diff --git a/maven-archetype-bundles/maven-archetype-simple/src/test/resources/test.properties b/maven-archetype-bundles/maven-archetype-simple/src/test/resources/test.properties
new file mode 100644
index 0000000..74d0a43
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-simple/src/test/resources/test.properties
@@ -0,0 +1 @@
+foo=bar
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/pom.xml b/maven-archetype-bundles/maven-archetype-site-simple/pom.xml
new file mode 100644
index 0000000..9062d59
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-site-simple</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Archetype for Simple Site</name>
+  <description>
+    An archetype which contains a sample Maven site.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site-simple</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site-simple</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site-simple</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..d42a1a0
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,10 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>plugin</id>
+  <allowPartial>true</allowPartial>
+
+  <siteResources>
+    <resource>src/site/site.xml</resource>
+    <resource>src/site/apt/index.apt</resource>
+  </siteResources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..eabf6b4
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,20 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>pom</packaging>
+
+  <distributionManagement>
+    <site>
+      <id>website</id>
+      <url>scp://webhost.company.com/www/website</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/apt/index.apt b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/apt/index.apt
new file mode 100644
index 0000000..31b6246
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/apt/index.apt
@@ -0,0 +1,18 @@
+ -----
+ Title Here
+ -----
+ Author Here
+ -----
+ Date Here
+ -----
+
+Maven Site for your project
+
+ Congratulations! If you are looking at this page then you have successfully generated a
+ template site employing the site archetype and you have run:
+  
++-----+
+
+mvn site
+
++-----+
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/site.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..b8d2ed8
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/main/resources/archetype-resources/src/site/site.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <links>
+      <item name="Maven" href="http://maven.apache.org/"/>
+    </links>
+
+    <menu name="Documentation">
+      <!--<item name="Xdoc Example" href="xdoc.html"/>-->
+    </menu>
+  </body>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/site/site.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/pom.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/pom.xml
new file mode 100644
index 0000000..914e3bb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/pom.xml
@@ -0,0 +1,20 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>archetype.it</groupId>
+  <artifactId>basic</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <distributionManagement>
+    <site>
+      <id>website</id>
+      <url>scp://webhost.company.com/www/website</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/apt/index.apt b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/apt/index.apt
new file mode 100644
index 0000000..31b6246
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/apt/index.apt
@@ -0,0 +1,18 @@
+ -----
+ Title Here
+ -----
+ Author Here
+ -----
+ Date Here
+ -----
+
+Maven Site for your project
+
+ Congratulations! If you are looking at this page then you have successfully generated a
+ template site employing the site archetype and you have run:
+  
++-----+
+
+mvn site
+
++-----+
diff --git a/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/site.xml b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/site.xml
new file mode 100644
index 0000000..b8d2ed8
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site-simple/src/test/resources/projects/basic/reference/src/site/site.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <links>
+      <item name="Maven" href="http://maven.apache.org/"/>
+    </links>
+
+    <menu name="Documentation">
+      <!--<item name="Xdoc Example" href="xdoc.html"/>-->
+    </menu>
+  </body>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site/pom.xml b/maven-archetype-bundles/maven-archetype-site/pom.xml
new file mode 100644
index 0000000..a0bc6e6
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/pom.xml
@@ -0,0 +1,48 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-site</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Site Archetype</name>
+  <description>
+    An archetype which contains a sample Maven site which demonstrates some of the supported document types like
+    APT, XDoc, and FML and demonstrates how to i18n your site. This archetype can be layered
+    upon an existing Maven project.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-site</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..6120f50
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,18 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>plugin</id>
+  <allowPartial>true</allowPartial>
+
+  <siteResources>
+    <resource>src/site/site.xml</resource>
+    <resource>src/site/site_fr.xml</resource>
+    <resource>src/site/apt/index.apt</resource>
+    <resource>src/site/apt/format.apt</resource>
+    <resource>src/site/fml/faq.fml</resource>
+    <resource>src/site/xdoc/xdoc.xml</resource>
+    <resource>src/site/fr/apt/index.apt</resource>
+    <resource>src/site/fr/apt/format.apt</resource>
+    <resource>src/site/fr/fml/faq.fml</resource>
+    <resource>src/site/fr/xdoc/xdoc.xml</resource>
+  </siteResources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..38f0be0
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,34 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven</name>
+  <url>http://maven.apache.org/</url>
+  <inceptionYear>2001</inceptionYear>
+
+  <distributionManagement>
+    <site>
+      <id>website</id>
+      <url>scp://webhost.company.com/www/website</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-site-plugin</artifactId>
+        <configuration>
+          <locales>en,fr</locales>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/format.apt b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/format.apt
new file mode 100644
index 0000000..864419f
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/format.apt
@@ -0,0 +1,602 @@
+ -----
+ The APT format
+ -----
+ The Maven Team
+ -----
+ -----
+
+The APT format
+~~~~~~~~~~~~~~
+
+  In the following section, boxes containing text in typewriter-like font are
+  examples of APT source.
+
+* Document structure
+~~~~~~~~~~~~~~~~~~~~
+
+  A short APT document is contained in a single text file. A longer document
+  may be contained in a ordered list of text files. For instance, first text
+  file contains section 1, second text file contains section 2, and so on.
+
+      [Note:] Splitting the APT document in several text files on a section
+              boundary is not mandatory. The split may occur anywhere.
+              However doing so is recommended because a text file containing a
+              section is by itself a valid APT document.
+
+  A file contains a sequence of paragraphs and ``displays'' (non paragraphs
+  such as tables) separated by open lines.
+
+  A paragraph is simply a sequence of consecutive text lines.
+
++------------------------------------------------------------------------+
+  First line of first paragraph.
+  Second line of first paragraph.
+  Third line of first paragraph.
+
+  Line 1 of paragraph 2 (separated from first paragraph by an open line).
+  Line 2 of paragraph 2.
++------------------------------------------------------------------------+
+
+  The indentation of the first line of a paragraph is the main method used by
+  an APT processor to recognize the type of the paragraph. For example, a
+  section title must not be indented at all.
+
+  A ``plain'' paragraph must be indented by a certain amount of space. For
+  example, a plain paragraph which is not contained in a list may be indented
+  by two spaces.
+
++-------------------------------------------------+
+My section title (not indented).
+
+  My paragraph first line (indented by 2 spaces).
++-------------------------------------------------+
+
+  Indentation is not rigid. Any amount of space will do. You don't even need
+  to use a consistent indentation all over your document. What really matters
+  for an APT processor is whether the paragraph is not indented at all or,
+  when inside a list, whether a paragraph is more or less indented than the
+  first item of the list (more about this later).
+
++-------------------------------------------------------+
+    First paragraph has its first line indented by four
+spaces. Then the author did even bother to indent the
+other lines of the paragraph.
+
+  Second paragraph contains several lines which are all
+  indented by two spaces. This style is much nicer than
+  the one used for the previous paragraph.
++-------------------------------------------------------+
+
+  Note that tabs are expanded with a tab width set to 8.
+
+* Document elements
+~~~~~~~~~~~~~~~~~~~
+
+** Block level elements
+~~~~~~~~~~~~~~~~~~~~~~~
+
+*** Title
+~~~~~~~~~~
+
+  A title is optional. If used, it must appear as the first block of the
+  document.
+
++----------------------------------------------------------------------------+
+				    ------
+				    Title
+				    ------
+				    Author
+				    ------
+				     Date
++----------------------------------------------------------------------------+
+
+  A title block is indented (centering it is nicer). It begins with a line
+  containing at least 3 dashes (<<<--->>>).
+
+  After the first <<<--->>> line, one or several consecutive lines of text
+  (implicit line break after each line) specify the title of the document.
+
+  This text may immediately be followed by another <<<--->>> line and one or
+  several consecutive lines of text which specifies the author of the
+  document.
+
+  The author sub-block may optionaly be followed by a date sub-block using the
+  same syntax.
+
+  The following example is used for a document with an title and a date but
+  with no declared author.
+
++----------------------------------------------------------------------------+
+				    ------
+				    Title
+				    ------
+				    ------
+				     Date
+				    ------
++----------------------------------------------------------------------------+
+
+  The last line is ignored. It is just there to make the block nicer.
+
+*** Paragraph
+~~~~~~~~~~~~~
+
+  Paragraphs other than the title block may appear before the first section.
+
++----------------------+
+  Paragraph 1, line 1.
+  Paragraph 1, line 2.
+
+  Paragraph 2, line 1.
+  Paragraph 2, line 2.
++----------------------+
+
+  Paragraphs are indented. They have already been described in the {{document
+  structure}} section.
+
+*** Section
+~~~~~~~~~~~
+
+  Sections are created by inserting section titles into the document. Simple
+  documents need not contain sections.
+
++-----------------------------------+
+Section title
+
+* Sub-section title
+
+** Sub-sub-section title
+
+*** Sub-sub-sub-section title
+
+**** Sub-sub-sub-sub-section title
++-----------------------------------+
+
+  Section titles are not indented. A sub-section title begins with one
+  asterisk (<<<*>>>), a sub-sub-section title begins with two asterisks
+  (<<<**>>>), and so forth up to four sub-section levels.
+
+*** List
+~~~~~~~~
+
++---------------------------------------+
+      * List item 1.
+
+      * List item 2.
+
+	Paragraph contained in list item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+      * List item 3.
++---------------------------------------+
+
+  List items are indented and begin with a asterisk (<<<*>>>).
+
+  Plain paragraphs more indented than the first list item are nested in that
+  list. Displays such as tables (not indented) are always nested in the
+  current list.
+
+  To nest a list inside a list, indent its first item more than its parent
+  list. To end a list, add a paragraph or list item less indented than the
+  current list.
+
+  Section titles always end a list. Displays cannot end a list but the
+  <<<[]>>> pseudo-element may be used to force the end of a list.
+
++------------------------------------+
+      * List item 3.
+        Force end of list:
+
+      []
+
+--------------------------------------------
+Verbatim text not contained in list item 3
+--------------------------------------------
++------------------------------------+
+
+  In the previous example, without the <<<[]>>>, the verbatim text (not
+  indented as all displays) would have been contained in list item 3.
+
+  A single <<<[]>>> may be used to end several nested lists at the same
+  time. The indentation of <<<[]>>> may be used to specify exactly which
+  lists should be ended. Example:
+
++------------------------------------+
+      * List item 1.
+
+      * List item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+	    []
+
+-------------------------------------------------------------------
+Verbatim text contained in list item 2, but not in sub-list item 2
+-------------------------------------------------------------------
++------------------------------------+
+
+  There are three kind of lists, the bulleted lists we have already described,
+  the numbered lists and the definition lists.
+
++-----------------------------------------+
+      [[1]] Numbered item 1.
+
+                [[A]] Numbered item A.
+
+                [[B]] Numbered item B.
+
+      [[2]] Numbered item 2.
++-----------------------------------------+
+
+  A numbered list item begins with a label beetween two square brackets. The
+  label of the first item establishes the numbering scheme for the whole list:
+
+      [<<<[[1\]\]>>>] Decimal numbering: 1, 2, 3, 4, etc.
+
+      [<<<[[a\]\]>>>] Lower-alpha numbering: a, b, c, d, etc.
+
+      [<<<[[A\]\]>>>] Upper-alpha numbering: A, B, C, D, etc.
+
+      [<<<[[i\]\]>>>] Lower-roman numbering: i, ii, iii, iv, etc.
+
+      [<<<[[I\]\]>>>] Upper-roman numbering: I, II, III, IV, etc.
+
+  The labels of the items other than the first one are ignored. It is
+  recommended to take the time to type the correct label for each item in
+  order to keep the APT source document readable.
+
++-------------------------------------------+
+      [Defined term 1] of definition list 2.
+
+      [Defined term 2] of definition list 2.
++-------------------------------------------+
+
+  A definition list item begins with a defined term: text between square
+  brackets.
+
+*** Verbatim text
+~~~~~~~~~~~~~~~~~
+
++----------------------------------------+
+----------------------------------------
+Verbatim
+	 text,
+		preformatted,
+				escaped.
+----------------------------------------
++----------------------------------------+
+
+  A verbatim block is not indented. It begins with a non indented line
+  containing at least 3 dashes (<<<--->>>). It ends with a similar line.
+
+  <<<+-->>> instead of <<<--->>> draws a box around verbatim text.
+
+  Like in HTML, verbatim text is preformatted. Unlike HTML, verbatim text is
+  escaped: inside a verbatim display, markup is not interpreted by the APT
+  processor.
+
+*** Figure
+~~~~~~~~~~
+
++---------------------------+
+[Figure name] Figure caption
++---------------------------+
+
+  A figure block is not indented. It begins with the figure name between
+  square brackets. The figure name is optionally followed by some text: the
+  figure caption.
+
+  The figure name is the pathname of the file containing the figure but
+  without an extension. Example: if your figure is contained in
+  <<</home/joe/docs/mylogo.jpeg>>>, the figure name is
+  <<</home/joe/docs/mylogo>>>.
+
+  If the figure name comes from a relative pathname (recommended practice)
+  rather than from an absolute pathname, this relative pathname is taken to be
+  relative to the directory of the current APT document (a la HTML)
+  rather than relative to the current working directory.
+
+  Why not leave the file extension in the figure name? This is better
+  explained by an example. You need to convert an APT document to PostScript
+  and your figure name is <<</home/joe/docs/mylogo>>>. A APT processor will
+  first try to load <<</home/joe/docs/mylogo.eps>>>. When the desired format
+  is not found, a APT processor tries to convert one of the existing
+  formats. In our example, the APT processor tries to convert
+  <<</home/joe/docs/mylogo.jpeg>>> to encapsulated PostScript.
+
+*** Table
+~~~~~~~~~
+
+  A table block is not indented. It begins with a non indented line containing
+  an asterisk and at least 2 dashes (<<<*-->>>). It ends with a
+  similar line.
+
+  The first line is not only used to recognize a table but also to specify
+  column justification. In the following example,
+
+      * the second asterisk (<<<*>>>) is used to specify that column 1 is
+        centered,
+
+      * the plus sign (<<<+>>>) specifies that column 2 is left aligned,
+
+      * the colon (<<<:>>>) specifies that column 3 is right aligned.
+
+      []
+
++---------------------------------------------+
+*----------*--------------+----------------:
+| Centered | Left-aligned | Right-aligned  |
+| cell 1,1 | cell 1,2     | cell 1,3       |
+*----------*--------------+----------------:
+| cell 2,1 | cell 2,2     | cell 2,3       |
+*----------*--------------+----------------:
+Table caption
++---------------------------------------------+
+
+  Rows are separated by a non indented line beginning with <<<*-->>>.
+
+  An optional table caption (non indented text) may immediately follow the
+  table.
+
+  Rows may contain single line or multiple line cells. Each line of cell text
+  is separated from the adjacent cell by the pipe character (<<<|>>>).
+  (<<<|>>> may be used in the cell text if quoted: <<<\\|>>>.)
+
+  The last <<<|>>> is only used to make the table nicer.  The first <<<|>>> is
+  not only used to make the table nicer, but also to specify that a grid is to
+  be drawn around table cells.
+
+  The following example shows a simple table with no grid and no caption.
+
++---------------+
+*-----*------*
+ cell | cell
+*-----*------*
+ cell | cell
+*-----*------*
++---------------+
+
+*** Horizontal rule
+~~~~~~~~~~~~~~~~~~~
+
++---------------------+
+=====================
++---------------------+
+
+  A non indented line containing at least 3 equal signs (<<<===>>>).
+
+*** Page break
+~~~~~~~~~~~~~~
+
++---+
+^L
++---+
+
+  A non indented line containing a single form feed character (Control-L).
+
+** Text level elements
+~~~~~~~~~~~~~~~~~~~~~~
+
+*** Font
+~~~~~~~~
+
++-----------------------------------------------------+
+  <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
++-----------------------------------------------------+
+
+  Text between \< and > must be rendered in italic. Text between \<\< and >>
+  must be rendered in bold. Text between \<\<\< and >>> must be rendered using
+  a monospaced, typewriter-like font.
+
+  Font elements may appear anywhere except inside other font elements.
+
+  It is not recommended to use font elements inside titles, section titles,
+  links and defined terms because a APT processor automatically applies
+  appropriate font styles to these elements.
+
+*** Anchor and link
+~~~~~~~~~~~~~~~~~~~
+
++-----------------------------------------------------------------+
+  {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
+  Link to {{{anchor}showing alternate text}}.
+  Link to {{{http://www.pixware.fr}Pixware home page}}.
++-----------------------------------------------------------------+
+
+  Text between curly braces (<<<\{}>>>) specifies an anchor. Text between
+  double curly braces (<<<\{\{}}>>>) specifies a link.
+
+  It is an error to create a link element that does not refer to an anchor of
+  the same name. The name of an anchor/link is its text with all non
+  alphanumeric characters stripped.
+
+  This rule does not apply to links to <external> anchors. Text beginning
+  with <<<http:/>>>, <<<https:/>>>, <<<ftp:/>>>, <<<file:/>>>, <<<mailto:>>>,
+  <<<../>>>, <<<./>>> (<<<..\\>>> and <<<.\\>>> on Windows) is recognized as
+  an external anchor name.
+
+  When the construct <<\{\{\{>><name><<}>><text><<}}>> is used, the link text
+  <text> may differ from the link name <name>.
+
+  Anchor/link elements may appear anywhere except inside other anchor/link
+  elements.
+
+  Section titles are implicitly defined anchors.
+
+*** Line break
+~~~~~~~~~~~~~~
+
++-------------+
+  Force line\
+  break.
++-------------+
+
+  A backslash character (<<<\\>>>) followed by a newline character.
+
+  Line breaks must not be used inside titles and tables (which are line
+  oriented blocks with implicit line breaks).
+
+*** Non breaking space
+~~~~~~~~~~~~~~~~~~~~~~
+
++----------------------+
+  Non\ breaking\ space.
++----------------------+
+
+  A backslash character (<<<\\>>>) followed by a space character.
+
+*** Special character
+~~~~~~~~~~~~~~~~~~~~~
+
++---------------------------------------------------------------------------+
+  Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
++---------------------------------------------------------------------------+
+
+  In certain contexts, these characters have a special meaning and therefore
+  must be escaped if needed as is. They are escaped by adding a backslash in
+  front of them. The backslash may itself be escaped by adding another
+  backslash in front of it.
+
+  Note that an asterisk, for example, needs to be escaped only if its begins a
+  paragraph. (<<<*>>> has no special meaning in the middle of a paragraph.)
+
++--------------------------------------+
+  Copyright symbol: \251, \xA9, \u00a9.
++--------------------------------------+
+
+  Latin-1 characters (whatever is the encoding of the APT document) may be
+  specified by their codes using a backslash followed by one to three octal
+  digits or by using the <<<\x>>><NN> notation, where <NN> are two hexadecimal
+  digits.
+
+  Unicode characters may be specified by their codes using the <<<\u>>><NNNN>
+  notation, where <NNNN> are four hexadecimal digits.
+
+*** Comment
+~~~~~~~~~~~
+
++---------------+
+~~Commented out.
++---------------+
+
+  Text found after two tildes (<<<\~~>>>) is ignored up to the end of line.
+
+  A line of <<<~>>> is often used to ``underline'' section titles in order to
+  make them stand out of other paragraphs.
+
+
+* The APT format at a glance
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+------------------------------------------------------------------------------
+				    ------
+				    Title
+				    ------
+				    Author
+				    ------
+				     Date
+
+  Paragraph 1, line 1.
+  Paragraph 1, line 2.
+
+  Paragraph 2, line 1.
+  Paragraph 2, line 2.
+
+Section title
+
+* Sub-section title
+
+** Sub-sub-section title
+
+*** Sub-sub-sub-section title
+
+**** Sub-sub-sub-sub-section title
+
+      * List item 1.
+
+      * List item 2.
+
+	Paragraph contained in list item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+      * List item 3.
+        Force end of list:
+
+      []
+
++------------------------------------------+
+Verbatim text not contained in list item 3
++------------------------------------------+
+
+      [[1]] Numbered item 1.
+
+                [[A]] Numbered item A.
+
+                [[B]] Numbered item B.
+
+      [[2]] Numbered item 2.
+
+  List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].
+
+      [Defined term 1] of definition list.
+
+      [Defined term 2] of definition list.
+
++-------------------------------+
+Verbatim text
+			in a box
++-------------------------------+
+
+  --- instead of +-- suppresses the box around verbatim text.
+
+[Figure name] Figure caption
+
+*----------*--------------+----------------:
+| Centered | Left-aligned | Right-aligned  |
+| cell 1,1 | cell 1,2     | cell 1,3       |
+*----------*--------------+----------------:
+| cell 2,1 | cell 2,2     | cell 2,3       |
+*----------*--------------+----------------:
+Table caption
+
+  No grid, no caption:
+
+*-----*------*
+ cell | cell
+*-----*------*
+ cell | cell
+*-----*------*
+
+  Horizontal line:
+
+=======================================================================
+
+^L
+  New page.
+
+  <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
+
+  {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
+  Link to {{{anchor}showing alternate text}}.
+  Link to {{{http://www.pixware.fr}Pixware home page}}.
+
+  Force line\
+  break.
+
+  Non\ breaking\ space.
+
+  Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
+
+  Copyright symbol: \251, \xA9, \u00a9.
+
+~~Commented out.
+
+------------------------------------------------------------------------------
+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/index.apt b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/index.apt
new file mode 100644
index 0000000..985ddeb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/apt/index.apt
@@ -0,0 +1,16 @@
+ -----
+ The Site
+ -----
+ The Maven Team
+ -----
+
+Maven Site for your project
+
+ Congratulations! If you are looking at this page then you have successfully generated a
+ template site employing the site archetype and you have run:
+
++-----+
+
+mvn site
+
++-----+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fml/faq.fml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fml/faq.fml
new file mode 100644
index 0000000..b8c4d47
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fml/faq.fml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<faqs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/FML/1.0"
+  xsi:schemaLocation="http://maven.apache.org/FML/1.0 http://maven.apache.org/xsd/fml-1.0.xsd"
+  id="General FAQ">
+  <part id="General">
+    <faq id="where">
+      <question>Where did Maven come from?</question>
+      <answer>
+        <p>
+          Maven was created by a group of software developers who were tired
+          of wasting their time fiddling around with builds and wanted to get
+          down to brass tacks and actually develop software!
+        </p>
+      </answer>
+    </faq>
+    <faq id="why">
+      <question>Why is Maven so wildly popular?</question>
+      <answer>
+        <p>
+          Maven saves you so much time in your software development efforts that
+          you will have time to learn a second language, relax ten hours a
+          day, and train for that marathon you've always wanted to run!
+        </p>
+      </answer>
+    </faq>
+  </part>
+</faqs>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/format.apt b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/format.apt
new file mode 100644
index 0000000..f8e67c2
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/format.apt
@@ -0,0 +1,602 @@
+ -----
+ Le format APT
+ -----
+ L'équipe Maven
+ -----
+ -----
+
+Le format APT
+~~~~~~~~~~~~~
+
+   Dans la section suivante, les boîtes contenant du texte dans la police
+   de type machine à écrire sont des exemples de source APT.
+
+* Structure du document
+~~~~~~~~~~~~~~~~~~~~~~~
+
+  A short APT document is contained in a single text file. A longer document
+  may be contained in a ordered list of text files. For instance, first text
+  file contains section 1, second text file contains section 2, and so on.
+
+      [Note:] Splitting the APT document in several text files on a section
+              boundary is not mandatory. The split may occur anywhere.
+              However doing so is recommended because a text file containing a
+              section is by itself a valid APT document.
+
+  A file contains a sequence of paragraphs and ``displays'' (non paragraphs
+  such as tables) separated by open lines.
+
+  A paragraph is simply a sequence of consecutive text lines.
+
++------------------------------------------------------------------------+
+  First line of first paragraph.
+  Second line of first paragraph.
+  Third line of first paragraph.
+
+  Line 1 of paragraph 2 (separated from first paragraph by an open line).
+  Line 2 of paragraph 2.
++------------------------------------------------------------------------+
+
+  The indentation of the first line of a paragraph is the main method used by
+  an APT processor to recognize the type of the paragraph. For example, a
+  section title must not be indented at all.
+
+  A ``plain'' paragraph must be indented by a certain amount of space. For
+  example, a plain paragraph which is not contained in a list may be indented
+  by two spaces.
+
++-------------------------------------------------+
+My section title (not indented).
+
+  My paragraph first line (indented by 2 spaces).
++-------------------------------------------------+
+
+  Indentation is not rigid. Any amount of space will do. You don't even need
+  to use a consistent indentation all over your document. What really matters
+  for an APT processor is whether the paragraph is not indented at all or,
+  when inside a list, whether a paragraph is more or less indented than the
+  first item of the list (more about this later).
+
++-------------------------------------------------------+
+    First paragraph has its first line indented by four
+spaces. Then the author did even bother to indent the
+other lines of the paragraph.
+
+  Second paragraph contains several lines which are all
+  indented by two spaces. This style is much nicer than
+  the one used for the previous paragraph.
++-------------------------------------------------------+
+
+  Note that tabs are expanded with a tab width set to 8.
+
+* Document elements
+~~~~~~~~~~~~~~~~~~~
+
+** Block level elements
+~~~~~~~~~~~~~~~~~~~~~~~
+
+*** Title
+~~~~~~~~~~
+
+  A title is optional. If used, it must appear as the first block of the
+  document.
+
++----------------------------------------------------------------------------+
+				    ------
+				    Title
+				    ------
+				    Author
+				    ------
+				     Date
++----------------------------------------------------------------------------+
+
+  A title block is indented (centering it is nicer). It begins with a line
+  containing at least 3 dashes (<<<--->>>).
+
+  After the first <<<--->>> line, one or several consecutive lines of text
+  (implicit line break after each line) specify the title of the document.
+
+  This text may immediately be followed by another <<<--->>> line and one or
+  several consecutive lines of text which specifies the author of the
+  document.
+
+  The author sub-block may optionaly be followed by a date sub-block using the
+  same syntax.
+
+  The following example is used for a document with an title and a date but
+  with no declared author.
+
++----------------------------------------------------------------------------+
+				    ------
+				    Title
+				    ------
+				    ------
+				     Date
+				    ------
++----------------------------------------------------------------------------+
+
+  The last line is ignored. It is just there to make the block nicer.
+
+*** Paragraph
+~~~~~~~~~~~~~
+
+  Paragraphs other than the title block may appear before the first section.
+
++----------------------+
+  Paragraph 1, line 1.
+  Paragraph 1, line 2.
+
+  Paragraph 2, line 1.
+  Paragraph 2, line 2.
++----------------------+
+
+  Paragraphs are indented. They have already been described in the {{document
+  structure}} section.
+
+*** Section
+~~~~~~~~~~~
+
+  Sections are created by inserting section titles into the document. Simple
+  documents need not contain sections.
+
++-----------------------------------+
+Section title
+
+* Sub-section title
+
+** Sub-sub-section title
+
+*** Sub-sub-sub-section title
+
+**** Sub-sub-sub-sub-section title
++-----------------------------------+
+
+  Section titles are not indented. A sub-section title begins with one
+  asterisk (<<<*>>>), a sub-sub-section title begins with two asterisks
+  (<<<**>>>), and so forth up to four sub-section levels.
+
+*** List
+~~~~~~~~
+
++---------------------------------------+
+      * List item 1.
+
+      * List item 2.
+
+	Paragraph contained in list item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+      * List item 3.
++---------------------------------------+
+
+  List items are indented and begin with a asterisk (<<<*>>>).
+
+  Plain paragraphs more indented than the first list item are nested in that
+  list. Displays such as tables (not indented) are always nested in the
+  current list.
+
+  To nest a list inside a list, indent its first item more than its parent
+  list. To end a list, add a paragraph or list item less indented than the
+  current list.
+
+  Section titles always end a list. Displays cannot end a list but the
+  <<<[]>>> pseudo-element may be used to force the end of a list.
+
++------------------------------------+
+      * List item 3.
+        Force end of list:
+
+      []
+
+--------------------------------------------
+Verbatim text not contained in list item 3
+--------------------------------------------
++------------------------------------+
+
+  In the previous example, without the <<<[]>>>, the verbatim text (not
+  indented as all displays) would have been contained in list item 3.
+
+  A single <<<[]>>> may be used to end several nested lists at the same
+  time. The indentation of <<<[]>>> may be used to specify exactly which
+  lists should be ended. Example:
+
++------------------------------------+
+      * List item 1.
+
+      * List item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+	    []
+
+-------------------------------------------------------------------
+Verbatim text contained in list item 2, but not in sub-list item 2
+-------------------------------------------------------------------
++------------------------------------+
+
+  There are three kind of lists, the bulleted lists we have already described,
+  the numbered lists and the definition lists.
+
++-----------------------------------------+
+      [[1]] Numbered item 1.
+
+                [[A]] Numbered item A.
+
+                [[B]] Numbered item B.
+
+      [[2]] Numbered item 2.
++-----------------------------------------+
+
+  A numbered list item begins with a label beetween two square brackets. The
+  label of the first item establishes the numbering scheme for the whole list:
+
+      [<<<[[1\]\]>>>] Decimal numbering: 1, 2, 3, 4, etc.
+
+      [<<<[[a\]\]>>>] Lower-alpha numbering: a, b, c, d, etc.
+
+      [<<<[[A\]\]>>>] Upper-alpha numbering: A, B, C, D, etc.
+
+      [<<<[[i\]\]>>>] Lower-roman numbering: i, ii, iii, iv, etc.
+
+      [<<<[[I\]\]>>>] Upper-roman numbering: I, II, III, IV, etc.
+
+  The labels of the items other than the first one are ignored. It is
+  recommended to take the time to type the correct label for each item in
+  order to keep the APT source document readable.
+
++-------------------------------------------+
+      [Defined term 1] of definition list 2.
+
+      [Defined term 2] of definition list 2.
++-------------------------------------------+
+
+  A definition list item begins with a defined term: text between square
+  brackets.
+
+*** Verbatim text
+~~~~~~~~~~~~~~~~~
+
++----------------------------------------+
+----------------------------------------
+Verbatim
+	 text,
+		preformatted,
+				escaped.
+----------------------------------------
++----------------------------------------+
+
+  A verbatim block is not indented. It begins with a non indented line
+  containing at least 3 dashes (<<<--->>>). It ends with a similar line.
+
+  <<<+-->>> instead of <<<--->>> draws a box around verbatim text.
+
+  Like in HTML, verbatim text is preformatted. Unlike HTML, verbatim text is
+  escaped: inside a verbatim display, markup is not interpreted by the APT
+  processor.
+
+*** Figure
+~~~~~~~~~~
+
++---------------------------+
+[Figure name] Figure caption
++---------------------------+
+
+  A figure block is not indented. It begins with the figure name between
+  square brackets. The figure name is optionally followed by some text: the
+  figure caption.
+
+  The figure name is the pathname of the file containing the figure but
+  without an extension. Example: if your figure is contained in
+  <<</home/joe/docs/mylogo.jpeg>>>, the figure name is
+  <<</home/joe/docs/mylogo>>>.
+
+  If the figure name comes from a relative pathname (recommended practice)
+  rather than from an absolute pathname, this relative pathname is taken to be
+  relative to the directory of the current APT document (a la HTML)
+  rather than relative to the current working directory.
+
+  Why not leave the file extension in the figure name? This is better
+  explained by an example. You need to convert an APT document to PostScript
+  and your figure name is <<</home/joe/docs/mylogo>>>. A APT processor will
+  first try to load <<</home/joe/docs/mylogo.eps>>>. When the desired format
+  is not found, a APT processor tries to convert one of the existing
+  formats. In our example, the APT processor tries to convert
+  <<</home/joe/docs/mylogo.jpeg>>> to encapsulated PostScript.
+
+*** Table
+~~~~~~~~~
+
+  A table block is not indented. It begins with a non indented line containing
+  an asterisk and at least 2 dashes (<<<*-->>>). It ends with a
+  similar line.
+
+  The first line is not only used to recognize a table but also to specify
+  column justification. In the following example,
+
+      * the second asterisk (<<<*>>>) is used to specify that column 1 is
+        centered,
+
+      * the plus sign (<<<+>>>) specifies that column 2 is left aligned,
+
+      * the colon (<<<:>>>) specifies that column 3 is right aligned.
+
+      []
+
++---------------------------------------------+
+*----------*--------------+----------------:
+| Centered | Left-aligned | Right-aligned  |
+| cell 1,1 | cell 1,2     | cell 1,3       |
+*----------*--------------+----------------:
+| cell 2,1 | cell 2,2     | cell 2,3       |
+*----------*--------------+----------------:
+Table caption
++---------------------------------------------+
+
+  Rows are separated by a non indented line beginning with <<<*-->>>.
+
+  An optional table caption (non indented text) may immediately follow the
+  table.
+
+  Rows may contain single line or multiple line cells. Each line of cell text
+  is separated from the adjacent cell by the pipe character (<<<|>>>).
+  (<<<|>>> may be used in the cell text if quoted: <<<\\|>>>.)
+
+  The last <<<|>>> is only used to make the table nicer.  The first <<<|>>> is
+  not only used to make the table nicer, but also to specify that a grid is to
+  be drawn around table cells.
+
+  The following example shows a simple table with no grid and no caption.
+
++---------------+
+*-----*------*
+ cell | cell
+*-----*------*
+ cell | cell
+*-----*------*
++---------------+
+
+*** Horizontal rule
+~~~~~~~~~~~~~~~~~~~
+
++---------------------+
+=====================
++---------------------+
+
+  A non indented line containing at least 3 equal signs (<<<===>>>).
+
+*** Page break
+~~~~~~~~~~~~~~
+
++---+
+^L
++---+
+
+  A non indented line containing a single form feed character (Control-L).
+
+** Text level elements
+~~~~~~~~~~~~~~~~~~~~~~
+
+*** Font
+~~~~~~~~
+
++-----------------------------------------------------+
+  <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
++-----------------------------------------------------+
+
+  Text between \< and > must be rendered in italic. Text between \<\< and >>
+  must be rendered in bold. Text between \<\<\< and >>> must be rendered using
+  a monospaced, typewriter-like font.
+
+  Font elements may appear anywhere except inside other font elements.
+
+  It is not recommended to use font elements inside titles, section titles,
+  links and defined terms because a APT processor automatically applies
+  appropriate font styles to these elements.
+
+*** Anchor and link
+~~~~~~~~~~~~~~~~~~~
+
++-----------------------------------------------------------------+
+  {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
+  Link to {{{anchor}showing alternate text}}.
+  Link to {{{http://www.pixware.fr}Pixware home page}}.
++-----------------------------------------------------------------+
+
+  Text between curly braces (<<<\{}>>>) specifies an anchor. Text between
+  double curly braces (<<<\{\{}}>>>) specifies a link.
+
+  It is an error to create a link element that does not refer to an anchor of
+  the same name. The name of an anchor/link is its text with all non
+  alphanumeric characters stripped.
+
+  This rule does not apply to links to <external> anchors. Text beginning
+  with <<<http:/>>>, <<<https:/>>>, <<<ftp:/>>>, <<<file:/>>>, <<<mailto:>>>,
+  <<<../>>>, <<<./>>> (<<<..\\>>> and <<<.\\>>> on Windows) is recognized as
+  an external anchor name.
+
+  When the construct <<\{\{\{>><name><<}>><text><<}}>> is used, the link text
+  <text> may differ from the link name <name>.
+
+  Anchor/link elements may appear anywhere except inside other anchor/link
+  elements.
+
+  Section titles are implicitly defined anchors.
+
+*** Line break
+~~~~~~~~~~~~~~
+
++-------------+
+  Force line\
+  break.
++-------------+
+
+  A backslash character (<<<\\>>>) followed by a newline character.
+
+  Line breaks must not be used inside titles and tables (which are line
+  oriented blocks with implicit line breaks).
+
+*** Non breaking space
+~~~~~~~~~~~~~~~~~~~~~~
+
++----------------------+
+  Non\ breaking\ space.
++----------------------+
+
+  A backslash character (<<<\\>>>) followed by a space character.
+
+*** Special character
+~~~~~~~~~~~~~~~~~~~~~
+
++---------------------------------------------------------------------------+
+  Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
++---------------------------------------------------------------------------+
+
+  In certain contexts, these characters have a special meaning and therefore
+  must be escaped if needed as is. They are escaped by adding a backslash in
+  front of them. The backslash may itself be escaped by adding another
+  backslash in front of it.
+
+  Note that an asterisk, for example, needs to be escaped only if its begins a
+  paragraph. (<<<*>>> has no special meaning in the middle of a paragraph.)
+
++--------------------------------------+
+  Copyright symbol: \251, \xA9, \u00a9.
++--------------------------------------+
+
+  Latin-1 characters (whatever is the encoding of the APT document) may be
+  specified by their codes using a backslash followed by one to three octal
+  digits or by using the <<<\x>>><NN> notation, where <NN> are two hexadecimal
+  digits.
+
+  Unicode characters may be specified by their codes using the <<<\u>>><NNNN>
+  notation, where <NNNN> are four hexadecimal digits.
+
+*** Comment
+~~~~~~~~~~~
+
++---------------+
+~~Commented out.
++---------------+
+
+  Text found after two tildes (<<<\~~>>>) is ignored up to the end of line.
+
+  A line of <<<~>>> is often used to ``underline'' section titles in order to
+  make them stand out of other paragraphs.
+
+
+* The APT format at a glance
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+------------------------------------------------------------------------------
+				    ------
+				    Title
+				    ------
+				    Author
+				    ------
+				     Date
+
+  Paragraph 1, line 1.
+  Paragraph 1, line 2.
+
+  Paragraph 2, line 1.
+  Paragraph 2, line 2.
+
+Section title
+
+* Sub-section title
+
+** Sub-sub-section title
+
+*** Sub-sub-sub-section title
+
+**** Sub-sub-sub-sub-section title
+
+      * List item 1.
+
+      * List item 2.
+
+	Paragraph contained in list item 2.
+
+	    * Sub-list item 1.
+
+	    * Sub-list item 2.
+
+      * List item 3.
+        Force end of list:
+
+      []
+
++------------------------------------------+
+Verbatim text not contained in list item 3
++------------------------------------------+
+
+      [[1]] Numbered item 1.
+
+                [[A]] Numbered item A.
+
+                [[B]] Numbered item B.
+
+      [[2]] Numbered item 2.
+
+  List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].
+
+      [Defined term 1] of definition list.
+
+      [Defined term 2] of definition list.
+
++-------------------------------+
+Verbatim text
+			in a box
++-------------------------------+
+
+  --- instead of +-- suppresses the box around verbatim text.
+
+[Figure name] Figure caption
+
+*----------*--------------+----------------:
+| Centered | Left-aligned | Right-aligned  |
+| cell 1,1 | cell 1,2     | cell 1,3       |
+*----------*--------------+----------------:
+| cell 2,1 | cell 2,2     | cell 2,3       |
+*----------*--------------+----------------:
+Table caption
+
+  No grid, no caption:
+
+*-----*------*
+ cell | cell
+*-----*------*
+ cell | cell
+*-----*------*
+
+  Horizontal line:
+
+=======================================================================
+
+^L
+  New page.
+
+  <Italic> font. <<Bold>> font. <<<Monospaced>>> font.
+
+  {Anchor}. Link to {{anchor}}. Link to {{http://www.pixware.fr}}.
+  Link to {{{anchor}showing alternate text}}.
+  Link to {{{http://www.pixware.fr}Pixware home page}}.
+
+  Force line\
+  break.
+
+  Non\ breaking\ space.
+
+  Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\.
+
+  Copyright symbol: \251, \xA9, \u00a9.
+
+~~Commented out.
+
+------------------------------------------------------------------------------
+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/index.apt b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/index.apt
new file mode 100644
index 0000000..dde1c9f
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/apt/index.apt
@@ -0,0 +1,17 @@
+ -----
+ Le Site
+ -----
+ L'équipe Maven
+ -----
+
+Site Maven pour votre projet
+
+ Félicitations!  Si vous regardez cette page alors vous avez
+ généré avec succès un modèle de site en utilisant l'archétype
+ de site et vous avez lancé :
+
++-----+
+
+mvn site
+
++-----+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/fml/faq.fml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/fml/faq.fml
new file mode 100644
index 0000000..22ab255
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/fml/faq.fml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<faqs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/FML/1.0"
+  xsi:schemaLocation="http://maven.apache.org/FML/1.0 http://maven.apache.org/xsd/fml-1.0.xsd"
+  id="FAQ Général">
+  <part id="General">
+    <faq id="where">
+      <question>D'où vient Maven ?</question>
+      <answer>
+        <p>
+          Maven was created by a group of software developers who were tired
+          of wasting their time fiddling around with builds and wanted to get
+          down to brass tacks and actually develop software!
+        </p>
+      </answer>
+    </faq>
+    <faq id="why">
+      <question>Pourquoi Maven est-il si populaire ?</question>
+      <answer>
+        <p>
+          Maven saves you so much time in your software development efforts that
+          you will have time to learn a second language, relax ten hours a
+          day, and train for that marathon you've always wanted to run!
+        </p>
+      </answer>
+    </faq>
+  </part>
+</faqs>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/xdoc/xdoc.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/xdoc/xdoc.xml
new file mode 100644
index 0000000..49e79bb
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/fr/xdoc/xdoc.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Bienvenue</title>
+    <author email="dev@maven.apache.org">The Maven Team</author>
+  </properties>
+
+  <body>
+    <section name="Bienvenue dans un fichier XDOC!">
+      <p>
+        Ceci est du texte pour le fichier xdoc.
+      </p>
+    </section>
+  </body>
+</document>
+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..843a968
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <bannerLeft>
+    <name>Maven</name>
+    <src>http://maven.apache.org/images/apache-maven-project.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-small.gif</src>
+  </bannerRight>
+
+  <body>
+    <links>
+      <item name="Apache" href="http://www.apache.org/" />
+      <item name="Maven 1.0" href="http://maven.apache.org/"/>
+      <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+    </links>
+
+    <menu name="Maven 2.0">
+      <item name="APT Format" href="format.html"/>
+      <item name="FAQ" href="faq.html"/>
+      <item name="Xdoc Example" href="xdoc.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site_fr.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site_fr.xml
new file mode 100644
index 0000000..d1fd757
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/site_fr.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <bannerLeft>
+    <name>Maven</name>
+    <src>http://maven.apache.org/images/apache-maven-project.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-small.gif</src>
+  </bannerRight>
+
+  <body>
+    <links>
+      <item name="Apache" href="http://www.apache.org/" />
+      <item name="Maven 1.0" href="http://maven.apache.org/"/>
+      <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+    </links>
+
+    <menu name="Maven 2.0">
+      <item name="Format APT" href="format.html"/>
+      <item name="FAQ" href="faq.html"/>
+      <item name="Exemple Xdoc" href="xdoc.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/xdoc/xdoc.xml b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/xdoc/xdoc.xml
new file mode 100644
index 0000000..557034e
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/main/resources/archetype-resources/src/site/xdoc/xdoc.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Welcome</title>
+    <author email="dev@maven.apache.org">The Maven Team</author>
+  </properties>
+
+  <body>
+    <section name="Welcome to an XDOC file!">
+      <p>
+        This is some text for the xdoc file.
+      </p>
+    </section>
+  </body>
+</document>
+
diff --git a/maven-archetype-bundles/maven-archetype-site/src/site/site.xml b/maven-archetype-bundles/maven-archetype-site/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-site/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/maven-archetype-webapp/pom.xml b/maven-archetype-bundles/maven-archetype-webapp/pom.xml
new file mode 100644
index 0000000..7aefd93
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/pom.xml
@@ -0,0 +1,46 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-archetype-bundles</artifactId>
+    <groupId>org.apache.maven.archetypes</groupId>
+    <version>4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-webapp</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>Maven Webapp Archetype</name>
+  <description>
+    An archetype which contains a sample Maven Webapp project.
+  </description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-webapp</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-webapp</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-webapp</url>
+  </scm>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/META-INF/maven/archetype.xml b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/META-INF/maven/archetype.xml
new file mode 100644
index 0000000..6d92ced
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/META-INF/maven/archetype.xml
@@ -0,0 +1,9 @@
+<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
+  <id>webapp</id>
+
+  <resources>
+    <resource>src/main/webapp/index.jsp</resource>
+    <resource>src/main/webapp/WEB-INF/web.xml</resource>
+  </resources>
+</archetype>
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/pom.xml b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..7e8afbd
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,29 @@
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <packaging>war</packaging>
+
+  <name>${artifactId} Maven Webapp</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>${artifactId}</finalName>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..9f88c1f
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,7 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+  <display-name>Archetype Created Web Application</display-name>
+</web-app>
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c38169b
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/main/resources/archetype-resources/src/main/webapp/index.jsp
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/site/site.xml b/maven-archetype-bundles/maven-archetype-webapp/src/site/site.xml
new file mode 100644
index 0000000..97d75fe
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/site/site.xml
@@ -0,0 +1,27 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu ref="parent" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/archetype.properties b/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..eb36b30
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,3 @@
+groupId=archetype.it
+artifactId=basic
+version=0.1-SNAPSHOT
\ No newline at end of file
diff --git a/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/goal.txt b/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/maven-archetype-bundles/maven-archetype-webapp/src/test/resources/projects/basic/goal.txt
diff --git a/maven-archetype-bundles/pom.xml b/maven-archetype-bundles/pom.xml
new file mode 100644
index 0000000..062acb4
--- /dev/null
+++ b/maven-archetype-bundles/pom.xml
@@ -0,0 +1,73 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.archetype</groupId>
+    <artifactId>maven-archetype</artifactId>
+    <version>2.0-alpha-5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-archetype-bundles</artifactId>
+  <version>4-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Archetypes</name>
+  <description>Archetypes provided by Maven.</description>
+  <url>http://maven.apache.org/archetype/maven-archetype-bundles</url>
+
+  <modules>
+    <module>maven-archetype-archetype</module>
+    <module>maven-archetype-j2ee-simple</module>
+    <module>maven-archetype-mojo</module>
+    <module>maven-archetype-plugin</module>
+    <module>maven-archetype-plugin-site</module>
+    <module>maven-archetype-portlet</module>
+    <module>maven-archetype-profiles</module>
+    <module>maven-archetype-quickstart</module>
+    <module>maven-archetype-simple</module>
+    <module>maven-archetype-site</module>
+    <module>maven-archetype-site-simple</module>
+    <module>maven-archetype-webapp</module>
+  </modules>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>2.0-alpha-5-SNAPSHOT</version>
+      </extension>
+    </extensions>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>2.0-alpha-5-SNAPSHOT</version>
+          <extensions>true</extensions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-bundles/src/site/apt/index.apt b/maven-archetype-bundles/src/site/apt/index.apt
new file mode 100644
index 0000000..6489f6a
--- /dev/null
+++ b/maven-archetype-bundles/src/site/apt/index.apt
@@ -0,0 +1,37 @@
+ ------
+ Maven Archetypes
+ ------
+ Jason van Zyl
+ ------
+ 2009-08-26
+ ------
+
+Maven Archetypes
+
+  Maven provides several achetype artifacts:
+
+*-----------------------------------------------------------------+----------------+
+|| Archetype ArtifactIds                                          || Description   ||
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-archetype/}maven-archetype-archetype}}     | An archetype which contains a sample archetype. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-j2ee-simple/}maven-archetype-j2ee-simple}} | An archetype which contains a simplifed sample J2EE application. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-mojo/}maven-archetype-mojo}}               | An archetype which contains a sample a sample Maven plugin. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-plugin/}maven-archetype-plugin}}           | An archetype which contains a sample Maven plugin. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-plugin-site/}maven-archetype-plugin-site}} | An archetype which contains a sample Maven plugin site. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-portlet/}maven-archetype-portlet}}         | An archetype which contains a sample JSR-268 Portlet. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-quickstart/}maven-archetype-quickstart}}   | An archetype which contains a sample Maven project. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-simple/}maven-archetype-simple}}           | An archetype which contains a simple Maven project. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-site/}maven-archetype-site}}               | An archetype which contains a sample Maven site which demonstrates some of the supported document types like APT, XDoc, and FML and demonstrates how to i18n your site. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-site-simple/}maven-archetype-site-simple}} | An archetype which contains a sample Maven site. |
+*-----------------------------------------------------------------+----------------+
+| {{{./maven-archetype-webapp/}maven-archetype-webapp}}           | An archetype which contains a sample Maven Webapp project. |
+*-----------------------------------------------------------------+----------------+
diff --git a/maven-archetype-bundles/src/site/site.xml b/maven-archetype-bundles/src/site/site.xml
new file mode 100644
index 0000000..d7c8d1a
--- /dev/null
+++ b/maven-archetype-bundles/src/site/site.xml
@@ -0,0 +1,33 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <breadcrumbs>
+      <item name="Maven" href="http://maven.apache.org/index.html" />
+      <item name="Maven Archetype" href="http://maven.apache.org/maven-archetype/index.html" />
+      <item name="Archetypes" href="http://maven.apache.org/archetype/maven-archetype-bundles/index.html" />
+    </breadcrumbs>
+
+    <menu ref="reports" inherit="bottom" />
+  </body>
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index c38dc4b..c358ce4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,349 +20,239 @@
 -->
 
 <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/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>16</version>
+    <relativePath>../pom/maven/pom.xml</relativePath>
+  </parent>
+
+  <groupId>org.apache.maven.archetype</groupId>
+  <artifactId>maven-archetype</artifactId>
+  <version>2.0-alpha-5</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Archetype</name>
+  <description>Maven Archetype is a set of tools to deal with archetypes, i.e. an abstract representation of a kind of project
+   that can be instantiated into a concrete customized Maven 2 project.
+   An archetype knows which files will be part of the instantiated project and which properties to fill to properly customize
+   the project.
+  </description>
+  <url>http://maven.apache.org/archetype</url>
+  <inceptionYear>2007</inceptionYear>
+
+  <modules>
+    <module>archetype-testing</module>
+    <module>archetype-common</module>
+    <module>archetype-plugin</module>
+    <module>archetype-packaging</module>
+  </modules>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/archetype/tags/maven-archetype-2.0-alpha-5</url>
+  </scm>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.codehaus.org/browse/ARCHETYPE</url>
+  </issueManagement>
+
+  <distributionManagement>
+    <site>
+      <id>apache.website</id>
+      <url>scp://people.apache.org/www/maven.apache.org/archetype/</url>
+    </site>
+  </distributionManagement>
+
+  <properties>
+    <mavenVersion>2.0.8</mavenVersion><!-- with 2.0.9 proxy test fails-->
+    <netbeans.hint.useExternalMaven>true</netbeans.hint.useExternalMaven>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-common</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.maven</groupId>
-        <artifactId>maven-parent</artifactId>
-        <version>11</version>
-        <relativePath>../pom/maven/pom.xml</relativePath>
-    </parent>
+        <artifactId>maven-plugin-api</artifactId>
+        <version>${mavenVersion}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-model</artifactId>
+        <version>${mavenVersion}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-project</artifactId>
+        <version>${mavenVersion}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-core</artifactId>
+        <version>${mavenVersion}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.shared</groupId>
+        <artifactId>maven-invoker</artifactId>
+        <version>2.0.10</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-container-default</artifactId>
+        <version>1.0-alpha-9-stable-1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-utils</artifactId>
+        <version>1.5.8</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-interactivity-api</artifactId>
+        <version>1.0-alpha-5</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-velocity</artifactId>
+        <version>1.1.8</version>
+        <exclusions>
+          <exclusion>
+            <groupId>velocity</groupId>
+            <artifactId>velocity</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>velocity</groupId>
+            <artifactId>velocity-api</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      <dependency>
+        <groupId>commons-io</groupId>
+        <artifactId>commons-io</artifactId>
+        <version>1.4</version>
+      </dependency>
+      <dependency>
+        <groupId>dom4j</groupId>
+        <artifactId>dom4j</artifactId>
+        <version>1.6.1</version>
+      </dependency>
+      <dependency>
+        <groupId>jdom</groupId>
+        <artifactId>jdom</artifactId>
+        <version>1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.velocity</groupId>
+        <artifactId>velocity</artifactId>
+        <version>1.5</version>
+      </dependency>
+      <dependency>
+        <groupId>net.sourceforge.jchardet</groupId>
+        <artifactId>jchardet</artifactId>
+        <version>1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>commons-collections</groupId>
+        <artifactId>commons-collections</artifactId>
+        <version>3.2.1</version>
+      </dependency>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.2</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.shared</groupId>
+        <artifactId>maven-plugin-testing-harness</artifactId>
+        <version>1.1</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.wagon</groupId>
+        <artifactId>wagon-file</artifactId>
+        <version>1.0-beta-2</version><!-- with 1.0-beta-3 1.0-beta-4 all tests fail -->
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
 
-    <groupId>org.apache.maven.archetype</groupId>
-    <artifactId>maven-archetype</artifactId>
-    <version>2.0-alpha-5</version>
-    <packaging>pom</packaging>
-
-    <name>Maven Archetype</name>
-    <inceptionYear>2007</inceptionYear>
-
-    <modules>
-        <module>archetype-testing</module>
-        <module>archetype-common</module>
-        <module>archetype-plugin</module>
-        <module>archetype-packaging</module>
-    </modules>
-
-    <properties>
-        <netbeans.hint.useExternalMaven>true</netbeans.hint.useExternalMaven>
-    </properties>
-
-    <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-5</developerConnection>
-        <url>http://svn.apache.org/viewcvs.cgi/maven/archetype/tags/maven-archetype-2.0-alpha-5</url>
-    </scm>
-    <issueManagement>
-        <system>jira</system>
-        <url>http://jira.codehaus.org/browse/ARCHETYPE</url>
-    </issueManagement>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.maven.archetype</groupId>
-                <artifactId>archetype-common</artifactId>
-                <version>2.0-alpha-5</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven</groupId>
-                <artifactId>maven-plugin-api</artifactId>
-                <version>${mavenVersion}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven</groupId>
-                <artifactId>maven-model</artifactId>
-                <version>${mavenVersion}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven.shared</groupId>
-                <artifactId>maven-invoker</artifactId>
-                <version>2.0.10</version>
-            </dependency>
-            <dependency>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-utils</artifactId>
-                <version>1.5.8</version>
-            </dependency>
-            <dependency>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-interactivity-api</artifactId>
-                <version>1.0-alpha-5</version>
-            </dependency>
-            <dependency>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-velocity</artifactId>
-                <version>1.1.3</version><!-- with 1.1.4 1.1.5 1.1.6 1.1.7 tests fail -->
-                <exclusions>
-                    <exclusion>
-                        <groupId>velocity</groupId>
-                        <artifactId>velocity</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>velocity</groupId>
-                        <artifactId>velocity-api</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>commons-io</groupId>
-                <artifactId>commons-io</artifactId>
-                <version>1.4</version>
-            </dependency>
-            <dependency>
-                <groupId>dom4j</groupId>
-                <artifactId>dom4j</artifactId>
-                <version>1.6.1</version>
-            </dependency>
-            <dependency>
-                <groupId>jdom</groupId>
-                <artifactId>jdom</artifactId>
-                <version>1.0</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.velocity</groupId>
-                <artifactId>velocity</artifactId>
-                <version>1.5</version>
-            </dependency>
-            <dependency>
-                <groupId>net.sourceforge.jchardet</groupId>
-                <artifactId>jchardet</artifactId>
-                <version>1.0</version>
-            </dependency>
-            <dependency>
-                <groupId>commons-collections</groupId>
-                <artifactId>commons-collections</artifactId>
-                <version>3.2.1</version>
-            </dependency>
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-                <version>3.8.2</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven.shared</groupId>
-                <artifactId>maven-plugin-testing-harness</artifactId>
-                <version>1.1</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven.wagon</groupId>
-                <artifactId>wagon-file</artifactId>
-                <version>1.0-beta-2</version><!-- with 1.0-beta-3 1.0-beta-4 all tests fail -->
-                <scope>test</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <artifactId>maven-release-plugin</artifactId>
-                    <version>2.0-beta-9</version>
-                    <configuration>
-                        <tagBase>https://svn.apache.org/repos/asf/maven/archetype/tags</tagBase>
-                        <preparationGoals>clean install</preparationGoals>
-                    </configuration>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.3</version><!--With 2.4 2.4.1 2.4.2 2.4.3 test with proxy fails-->
-                </plugin>
-                <plugin>
-                    <artifactId>maven-clean-plugin</artifactId>
-                    <version>2.2</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-gpg-plugin</artifactId>
-                    <version>1.0-alpha-4</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-javadoc-plugin</artifactId>
-                    <version>2.5</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-deploy-plugin</artifactId>
-                    <version>2.4</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-compiler-plugin</artifactId>
-                    <version>2.0.2</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-install-plugin</artifactId>
-                    <version>2.2</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-site-plugin</artifactId>
-                    <version>2.0-beta-7</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-source-plugin</artifactId>
-                    <version>2.0.4</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-resources-plugin</artifactId>
-                    <version>2.2</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.1-alpha-1</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-antrun-plugin</artifactId>
-                    <version>1.2</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-dependency-plugin</artifactId>
-                    <version>2.0</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-plugin-plugin</artifactId>
-                    <version>2.4.3</version>
-                </plugin>
-                <plugin>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.1-alpha-2</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.mortbay.jetty</groupId>
-                    <artifactId>maven-jetty-plugin</artifactId>
-                    <version>6.1.6</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-        <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.4</source>
-                    <target>1.4</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-maven-plugin</artifactId>
-                <version>1.3.8</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>descriptor</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <!--<plugin>
-            <artifactId>maven-enforcer-plugin</artifactId>
-            <version>1.0-SNAPSHOT</version>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>enforce</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <rules>
-                <requirePluginVersions>
-                  <banSnapshots>false</banSnapshots>
-                </requirePluginVersions>
-              </rules>
-            </configuration>
-          </plugin>-->
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>maven2.0</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <properties>
-                <mavenVersion>2.0.8</mavenVersion><!-- with 2.0.9 proxy test fails-->
-            </properties>
-            <dependencyManagement>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-project</artifactId>
-                        <version>${mavenVersion}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-core</artifactId>
-                        <version>${mavenVersion}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.codehaus.plexus</groupId>
-                        <artifactId>plexus-container-default</artifactId>
-                        <version>1.0-alpha-9-stable-1</version>
-                    </dependency>
-                </dependencies>
-            </dependencyManagement>
-        </profile>
-        <profile>
-            <id>maven2.1</id>
-            <properties>
-                <mavenVersion>2.1-SNAPSHOT</mavenVersion>
-            </properties>
-            <dependencyManagement>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-plugin-api</artifactId>
-                        <version>${mavenVersion}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-model</artifactId>
-                        <version>${mavenVersion}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-project</artifactId>
-                        <version>${mavenVersion}</version>
-                        <exclusions>
-                            <exclusion>
-                                <groupId>org.apache.maven</groupId>
-                                <artifactId>maven-artifact</artifactId>
-                            </exclusion>
-                            <exclusion>
-                                <groupId>org.apache.maven</groupId>
-                                <artifactId>maven-artifact-manager</artifactId>
-                            </exclusion>
-                        </exclusions>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.maven</groupId>
-                        <artifactId>maven-core</artifactId>
-                        <version>${mavenVersion}</version>
-                        <exclusions>
-                            <exclusion>
-                                <groupId>org.apache.maven</groupId>
-                                <artifactId>maven-artifact</artifactId>
-                            </exclusion>
-                            <exclusion>
-                                <groupId>org.apache.maven</groupId>
-                                <artifactId>maven-artifact-manager</artifactId>
-                            </exclusion>
-                        </exclusions>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.apache.maven.artifact</groupId>
-                        <artifactId>maven-artifact</artifactId>
-                        <version>3.0-SNAPSHOT</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.codehaus.plexus</groupId>
-                        <artifactId>plexus-container-default</artifactId>
-                        <version>1.0-alpha-40</version>
-                    </dependency>
-                </dependencies>
-            </dependencyManagement>
-        </profile>
-    </profiles>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-release-plugin</artifactId>
+          <configuration>
+            <tagBase>https://svn.apache.org/repos/asf/maven/archetype/tags</tagBase>
+            <preparationGoals>clean install</preparationGoals>
+            <autoVersionSubmodules>true</autoVersionSubmodules>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.3</version><!--With 2.4 2.4.1 2.4.2 2.4.3 test with proxy fails-->
+        </plugin>
+        <plugin>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>2.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-antrun-plugin</artifactId>
+          <version>1.2</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>2.4.3</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-war-plugin</artifactId>
+          <version>2.1-alpha-2</version>
+        </plugin>
+        <plugin>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>maven-jetty-plugin</artifactId>
+          <version>6.1.6</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <!--<plugin>
+      <artifactId>maven-enforcer-plugin</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <executions>
+        <execution>
+        <goals>
+          <goal>enforce</goal>
+        </goals>
+        </execution>
+      </executions>
+      <configuration>
+        <rules>
+        <requirePluginVersions>
+          <banSnapshots>false</banSnapshots>
+        </requirePluginVersions>
+        </rules>
+      </configuration>
+      </plugin>-->
+    </plugins>
+  </build>
 </project>
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
new file mode 100644
index 0000000..6c53108
--- /dev/null
+++ b/src/site/apt/index.apt
@@ -0,0 +1,50 @@
+ ------
+ Maven Archetype
+ ------
+ Jason van Zyl
+ ------
+ 2009-08-26
+ ------
+
+Maven Archetype
+
+* What is Archetype?
+
+ In short, Archetype is a Maven project templating toolkit. An archetype is defined as <an original pattern or model
+ from which all other things of the same  kind are made>. The names fits as we are trying to provide a system that
+ provides a consistent means of generating Maven projects. Archetype will help authors create
+ Maven project templates for users, and provides users with the means to generate parameterized versions
+ of those project templates.
+
+ Using archetypes provides a great way to enable developers quickly in a way consistent with best practices employed
+ by your project or organization. Within the Maven project we use archetypes to try and get our users up and running
+ as quickly as possible by providing a sample project that demonstrates many of the features of Maven while introducing
+ new users to the best practices employed by Maven. In a matter of seconds a new user can have a working Maven project
+ to use as a jumping board for investigating more of the features in Maven. We have also tried to make the Archetype
+ mechanism additive and by that we mean allowing portions of a project to be captured in an archetype so that pieces
+ or aspects of a project can be added to existing projects. A good example of this is the Maven site archetype.
+ If, for example, you have used the quick start archetype to generate a working project you can then quickly
+ create a site for that project by using the site archetype within that existing project. You can do anything like
+ this with archetypes.
+
+ You may want to standardize J2EE development within your organization so you may want to provide archetypes
+ for EJBs, or WARs, or for your web services. Once these archetypes are created and deployed in your organization's
+ repository they are available for use by all developers within your organization.
+
+* Content
+
+ Maven Archetype is composed of several modules:
+
+*----------------------------------------------------------+----------------+
+|| Module                                                  || Description   ||
+*----------------------------------------------------------+----------------+
+| {{{./archetype-common/}archetype-common}}                | core classes and descriptors reference documentation,
+*----------------------------------------------------------+----------------+
+| {{{../plugins/maven-archetype-plugin/}archetype-plugin}} | Archetype Plugin to use archetypes with Maven,
+*----------------------------------------------------------+----------------+
+| {{{./archetype-packaging/}archetype-packaging}}          | Archetype lifecycle and packaging definition,
+*----------------------------------------------------------+----------------+
+| {{{./archetype-testing/}archetype-testing}}              | components used internally to test Maven Archetype,
+*----------------------------------------------------------+----------------+
+| {{{./maven-archetype-bundles/}maven-archetype-bundles}}  | some Archetypes provided by Maven.
+*----------------------------------------------------------+----------------+
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100644
index 0000000..a63705e
--- /dev/null
+++ b/src/site/site.xml
@@ -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/DECORATION/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <breadcrumbs>
+      <item name="Maven" href="http://maven.apache.org/index.html" />
+      <item name="Maven Archetype" href="http://maven.apache.org/maven-archetype/index.html" />
+    </breadcrumbs>
+
+    <menu ref="modules" inherit="bottom" />
+    <menu ref="reports" inherit="bottom" />
+  </body>
+</project>
\ No newline at end of file