http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java
new file mode 100644
index 0000000..3c74a80
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java
@@ -0,0 +1 @@
+This file must be deleted by the post-create script.

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
new file mode 100644
index 0000000..f74a253
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
@@ -0,0 +1,44 @@
+<?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>${groupId}</groupId>
+    <artifactId>${parentArtifactId}</artifactId>
+    <version>${version}</version>
+  </parent>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven archetype Test Subfolder</name>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>subsubproject</module>
+  </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
new file mode 100644
index 0000000..dfbf01b
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
@@ -0,0 +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/xsd/maven-4.0.0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>${groupId}</groupId>
+    <artifactId>${parentArtifactId}</artifactId>
+    <version>${version}</version>
+  </parent>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven archetype Test Subsubfolder</name>
+  <packaging>jar</packaging>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
new file mode 100644
index 0000000..d34de6e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
@@ -0,0 +1,13 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/ArbitraryProperty-__property-with-default-1__.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/ArbitraryProperty-__property-with-default-1__.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/ArbitraryProperty-__property-with-default-1__.java
new file mode 100644
index 0000000..c6837ac
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/ArbitraryProperty-__property-with-default-1__.java
@@ -0,0 +1,14 @@
+groupId=${groupId}
+rootArtifactId=${rootArtifactId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/SkipsUndefinedProperty-__undefined-property__-__property-with-default-2__.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/SkipsUndefinedProperty-__undefined-property__-__property-with-default-2__.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/SkipsUndefinedProperty-__undefined-property__-__property-with-default-2__.java
new file mode 100644
index 0000000..c6837ac
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/SkipsUndefinedProperty-__undefined-property__-__property-with-default-2__.java
@@ -0,0 +1,14 @@
+groupId=${groupId}
+rootArtifactId=${rootArtifactId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/__rootArtifactId__/inner/__artifactId__/innest/Some__rootArtifactId__Class__artifactId__.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/__rootArtifactId__/inner/__artifactId__/innest/Some__rootArtifactId__Class__artifactId__.java
 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/__rootArtifactId__/inner/__artifactId__/innest/Some__rootArtifactId__Class__artifactId__.java
new file mode 100644
index 0000000..c6837ac
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/__rootArtifactId__/inner/__artifactId__/innest/Some__rootArtifactId__Class__artifactId__.java
@@ -0,0 +1,14 @@
+groupId=${groupId}
+rootArtifactId=${rootArtifactId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+packageInPathFormat=${packageInPathFormat}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/archetype.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/archetype.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/archetype.xml
new file mode 100644
index 0000000..d620e84
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/archetype.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<archetype>
+  <id>old</id>
+  <sources>
+    <source>src/main/java/App.java</source>
+  </sources>
+  <resources>
+    <resource>src/main/resources/App.properties</resource>
+  </resources>
+  <siteResources>
+    <resource>src/site/site.xml</resource>
+  </siteResources>
+</archetype>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/maven/archetypes/old/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/maven/archetypes/old/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/maven/archetypes/old/pom.xml
new file mode 100644
index 0000000..e5b97e5
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/META-INF/maven/archetypes/old/pom.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/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>archetypes</groupId>
+  <artifactId>old</artifactId>
+  <version>1.0</version>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/pom.xml
new file mode 100644
index 0000000..e13e2cd
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<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 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

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/java/App.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/java/App.java
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..882084f
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/java/App.java
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/resources/App.properties
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/resources/App.properties
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/resources/App.properties
new file mode 100644
index 0000000..882084f
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/main/resources/App.properties
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/site/site.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/site/site.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..54fc7b9
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/old-1.0/archetype-resources/src/site/site.xml
@@ -0,0 +1,4 @@
+groupId=${groupId}
+  artifactId=${artifactId}
+  version=${version}
+  package=${package}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetype-metadata.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..57da3fc
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetype-metadata.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.
+  -->
+<archetype-descriptor name="partial" partial="true">
+
+  <fileSets>
+    <fileSet filtered="true" packaged="true">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="true">
+      <directory>src/test/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+
+</archetype-descriptor>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetypes/partial/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetypes/partial/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetypes/partial/pom.xml
new file mode 100644
index 0000000..8df2ff4
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/META-INF/maven/archetypes/partial/pom.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/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>archetypes</groupId>
+  <artifactId>partial</artifactId>
+  <version>1.0</version>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
new file mode 100644
index 0000000..ce15f3e
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/pom.xml
@@ -0,0 +1,61 @@
+<?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>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>Maven archetype Test partial</name>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-info-reports-plugin</artifactId>
+        <version>2.0</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/main/java/App.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/main/java/App.java
 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..882084f
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/main/java/App.java
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/test/java/AppTest.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/test/java/AppTest.java
 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/test/java/AppTest.java
new file mode 100644
index 0000000..882084f
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/partial-1.0/archetype-resources/src/test/java/AppTest.java
@@ -0,0 +1,4 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetype-metadata.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..ad3db4f
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetype-metadata.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.
+-->
+<archetype-descriptor name="site">
+
+  <requiredProperties>
+    <requiredProperty key="property-with-default-1">
+      <defaultValue>default-value</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="property-with-default-2">
+      <defaultValue>default-value</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="property-with-default-3">
+      <defaultValue>default-value</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="property-with-default-4">
+      <defaultValue>default-value</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="property-without-default-1">
+    </requiredProperty>
+    <requiredProperty key="property-without-default-2">
+    </requiredProperty>
+    <requiredProperty key="property-without-default-3">
+    </requiredProperty>
+    <requiredProperty key="property-without-default-4">
+    </requiredProperty>
+  </requiredProperties>
+
+  <fileSets>
+    <fileSet filtered="true" packaged="false">
+      <directory>src/site</directory>
+      <includes>
+        <include>**/*.xml</include>
+        <include>**/*.apt</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+
+</archetype-descriptor>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetypes/site/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetypes/site/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetypes/site/pom.xml
new file mode 100644
index 0000000..1cfabd4
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/META-INF/maven/archetypes/site/pom.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/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>archetypes</groupId>
+  <artifactId>site</artifactId>
+  <version>1.0</version>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/pom.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/pom.xml
new file mode 100644
index 0000000..b3d58bc
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/pom.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/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 archetype Test site</name>
+  <packaging>pom</packaging>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/apt/test.apt
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/apt/test.apt
 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/apt/test.apt
new file mode 100644
index 0000000..2176fc9
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/apt/test.apt
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/site.xml
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/site.xml
 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..ceecd7a
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/archetypes/site-1.0/archetype-resources/src/site/site.xml
@@ -0,0 +1,12 @@
+groupId=${groupId}
+  artifactId=${artifactId}
+  version=${version}
+  package=${package}
+  property-without-default-1=${property-without-default-1}
+  property-without-default-2=${property-without-default-2}
+  property-without-default-3=${property-without-default-3}
+  property-without-default-4=${property-without-default-4}
+  property-with-default-1=${property-with-default-1}
+  property-with-default-2=${property-with-default-2}
+  property-with-default-3=${property-with-default-3}
+  property-with-default-4=${property-with-default-4}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
 
b/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
new file mode 100644
index 0000000..8e18b68
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
@@ -0,0 +1,498 @@
+package org.apache.maven.archetype.creator;
+
+/*
+ * 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.ArchetypeCreationRequest;
+import org.apache.maven.archetype.ArchetypeCreationResult;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+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.PropertyUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class DefaultArchetypeCreatorTest
+    extends AbstractMojoTestCase
+{
+    private List<String> filtereds;
+
+    private List<String> languages;
+
+    private DefaultArtifactRepository localRepository;
+
+    protected void createFilesetArchetype( String project )
+        throws Exception
+    {
+        System.out.println( ">>>>>> testCreateFilesetArchetype( \"" + project 
+ "\" )" );
+        
+        MavenProjectBuilder builder = (MavenProjectBuilder) lookup( 
MavenProjectBuilder.ROLE );
+
+        File projectFile = getProjectFile( project );
+
+        File projectFileSample = getProjectSampleFile( project );
+
+        copy( projectFileSample, projectFile );
+
+        FileUtils.deleteDirectory( new File( projectFile.getParentFile(), 
"target" ) );
+
+        File propertyFile = getPropertiesFile( project );
+
+        File propertyFileSample = getPropertiesSampleFile( project );
+
+        copy( propertyFileSample, propertyFile );
+
+        Properties p = PropertyUtils.loadProperties( propertyFile );
+
+        MavenProject mavenProject = null;
+
+        {
+            Object result = builder.buildWithDependencies( projectFile, 
localRepository, null );
+            if ( result instanceof MavenProject )
+            { // Using Maven 2.0.x / x >= 7
+                mavenProject = (MavenProject) result;
+            }
+            else if ( result instanceof MavenProjectBuildingResult )
+            { // Using Maven 3
+                mavenProject = ( (MavenProjectBuildingResult) result 
).getProject();
+            }
+            else
+            {
+                fail( "Wrong result class" );
+            }
+        }
+
+        FilesetArchetypeCreator instance =
+            (FilesetArchetypeCreator) lookup( 
ArchetypeCreator.class.getName(), "fileset" );
+
+        languages = new ArrayList<String>();
+        languages.add( "java" );
+        languages.add( "aspectj" );
+        languages.add( "csharp" );
+        languages.add( "groovy" );
+        languages.add( "resources" );
+
+        filtereds = new ArrayList<String>();
+        filtereds.add( "java" );
+        filtereds.add( "xml" );
+        filtereds.add( "txt" );
+        filtereds.add( "groovy" );
+        filtereds.add( "cs" );
+        filtereds.add( "mdo" );
+        filtereds.add( "aj" );
+        filtereds.add( "jsp" );
+        filtereds.add( "js" );
+        filtereds.add( "gsp" );
+        filtereds.add( "vm" );
+        filtereds.add( "html" );
+        filtereds.add( "xhtml" );
+        filtereds.add( "properties" );
+        filtereds.add( ".classpath" );
+        filtereds.add( ".project" );
+        filtereds.add( "MF" );
+
+        ArchetypeCreationRequest request = new ArchetypeCreationRequest()
+            .setProject( mavenProject )
+            .setPackageName( p.getProperty( Constants.PACKAGE ) )
+            .setProperties( p )
+            .setLanguages( languages )
+            .setFiltereds( filtereds )
+            .setDefaultEncoding( "UTF-8" )
+            .setPartialArchetype( false )
+            .setPreserveCData( false )
+            .setKeepParent( false )
+            .setPostPhase( "verify" );
+
+        ArchetypeCreationResult result = new ArchetypeCreationResult();
+
+        instance.createArchetype( request, result );
+
+        if ( result.getCause() != null )
+        {
+            throw result.getCause();
+        }
+
+        System.out.println( "<<<<<< testCreateFilesetArchetype( \"" + project 
+ "\" )" );
+    }
+
+    public void testChangeJavaFilenameWhenCustomPropertyEqualsClassName()
+        throws Exception
+    {
+        String project = "change-file-with-property";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, 
"src/main/java/__someProperty__.java" );
+        assertExists( template );
+               assertContent( template, "class ${someProperty}" );
+    }
+
+    public void testExcludePatternsMustExcludeDirectory()
+        throws Exception
+    {
+        String project = "exclude-patterns";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, ".toexclude/dummy.file");
+        assertNotExists(template);
+
+        File template1 = getTemplateFile( project, "nottoexclude/dummy.file" );
+        assertExists(template1);
+    }
+
+    public void testIncludeFileWithNoExtension()
+                    throws Exception
+    {
+        String project = "include-file-with-no-extension";
+
+        createFilesetArchetype( project );
+
+        File template1 = getTemplateFile( project, 
"src/main/csharp/filewithnoextension" );
+        assertExists(template1);
+    }
+
+    public void testCreateFilesetArchetype1()
+        throws Exception
+    {
+        String project = "create-1";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, 
"src/main/java/subfolder1/App.java" );
+        assertExists( template );
+        assertContent( template, "// ${someProperty}" );
+        assertContent( template, "package ${package}.subfolder1;" );
+        assertNotContent( template, "${packageInPathFormat}" );
+    }
+
+    public void testCreateFilesetArchetype2()
+        throws Exception
+    {
+        String project = "create-2";
+
+        createFilesetArchetype( project );
+    }
+
+    public void testCreateFilesetArchetype3()
+        throws Exception
+    {
+        String project = "create-3";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, "pom.xml" );
+        assertExists( template );
+        assertContent( template, "${groupId}" );
+        assertContent( template, "${artifactId}" );
+        assertContent( template, "${version}" );
+        assertContent( template, "Maven archetype Test create-3" );
+        assertContent( template, "<packaging>pom</packaging>" );
+        assertNotContent( template, "<parent>" );
+
+        template = getTemplateFile( project, "src/site/site.xml" );
+        assertExists( template );
+        assertContent( template, "<!-- ${packageInPathFormat}/test" );
+        assertContent( template, "${someProperty} -->" );
+
+        template = getTemplateFile( project, "src/site/resources/site.png" );
+        assertExists( template );
+        assertNotContent( template, "${someProperty}" );
+
+        template = getTemplateFile( project, ".classpath" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+
+        template = getTemplateFile( project, "profiles.xml" );
+        assertExists( template );
+        assertContent( template, "<!-- ${packageInPathFormat}/test" );
+        assertContent( template, "${someProperty} -->" );
+
+        template = getTemplateFile( project, "libs/pom.xml" );
+        assertExists( template );
+        assertContent( template, "${groupId}" );
+        assertContent( template, "${artifactId}" );
+        assertContent( template, "${version}" );
+        assertContent( template, "Maven archetype Test create-3-libraries" );
+        assertContent( template, "<packaging>pom</packaging>" );
+        assertContent( template, "<parent>" );
+
+        template = getTemplateFile( project, "libs/prj-a/pom.xml" );
+        assertExists( template );
+        assertContent( template, "${groupId}" );
+        assertContent( template, "${artifactId}" );
+        assertContent( template, "${version}" );
+        assertContent( template, "Maven archetype Test 
create-3-libraries-project-a" );
+        assertNotContent( template, "<packaging>pom</packaging>" );
+        assertContent( template, "<parent>" );
+
+        template = getTemplateFile( project, 
"libs/prj-a/src/main/mdo/descriptor.xml" );
+        assertExists( template );
+        assertContent( template, "<!-- ${packageInPathFormat}/test" );
+        assertContent( template, "${someProperty} -->" );
+
+        template = getTemplateFile( project, "libs/prj-b/pom.xml" );
+        assertExists( template );
+        assertContent( template, "${groupId}" );
+        assertContent( template, "${artifactId}" );
+        assertContent( template, "${version}" );
+        assertContent( template, "Maven archetype Test 
create-3-libraries-project-b" );
+        assertNotContent( template, "<packaging>pom</packaging>" );
+        assertContent( template, "<parent>" );
+
+        template = getTemplateFile( project, 
"libs/prj-b/src/main/java/test/com/Component.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}" );
+
+        template = getTemplateFile( project, 
"libs/prj-b/src/main/java/test/com/package.html" );
+        assertExists( template );
+        assertContent( template, "<!-- ${packageInPathFormat}/test" );
+        assertContent( template, "${someProperty} -->" );
+
+        template = getTemplateFile( project, 
"libs/prj-b/src/test/java/test/common/ComponentTest.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}" );
+
+        template = getTemplateFile( project, "application/pom.xml" );
+        assertExists( template );
+        assertContent( template, "${groupId}" );
+        assertContent( template, "${artifactId}" );
+        assertContent( template, "${version}" );
+        assertContent( template, "Maven archetype Test create-3-application" );
+        assertNotContent( template, "<packaging>pom</packaging>" );
+        assertContent( template, "<parent>" );
+
+        template = getTemplateFile( project, 
"application/src/main/java/Main.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/main/java/test/application/Application.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}" );
+
+        template = getTemplateFile( project, 
"application/src/main/java/test/application/audios/Application.ogg" );
+        assertExists( template );
+        assertNotContent( template, "${someProperty}" );
+
+        template = getTemplateFile( project, 
"application/src/main/java/test/application/images/Application.png" );
+        assertExists( template );
+        assertNotContent( template, "${someProperty}" );
+
+        template = getTemplateFile( project, 
"application/src/main/resources/log4j.properties" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/main/resources/META-INF/MANIFEST.MF" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/main/resources/test/application/some/Gro.groovy" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/main/resources/splash.png" );
+        assertExists( template );
+        assertNotContent( template, "${someProperty}" );
+
+        template = getTemplateFile( project, 
"application/src/test/java/TestAll.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/test/java/test/application/ApplicationTest.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertContent( template, "package ${package}.test.application;" );
+        assertContent( template, "${packageInPathFormat}/test/application" );
+
+        template = getTemplateFile( project, 
"application/src/it-test/java/test/ItTest1.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertContent( template, "package ${package}.test;" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/it-test/java/ItTestAll.java" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+
+        template = getTemplateFile( project, 
"application/src/it-test/resources/ItTest1Result.txt" );
+        assertExists( template );
+        assertContent( template, "${someProperty}" );
+        assertNotContent( template, "${package}" );
+        assertContent( template, "${packageInPathFormat}/test" );
+    }
+
+    public void testCreateFilesetArchetype4()
+            throws Exception
+    {
+        String project = "create-4";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, "pom.xml" );
+        assertExists( template );
+        assertContent( template, "Maven archetype Test create-4 
${someProperty}" );
+        assertContent( template, "<packaging>pom</packaging>" );
+
+        File earTemplate = getTemplateFile( project, "subModuleEAR/pom.xml" );
+        assertExists( earTemplate );
+        assertContent( earTemplate, "${groupId}" );
+        assertContent( earTemplate, "${artifactId}" );
+        assertContent( earTemplate, "${version}" );
+        assertContent( earTemplate, "Maven archetype Test 
create-4-subModuleEAR" );
+        assertContent( earTemplate, "<packaging>ear</packaging>" );
+        assertContent( earTemplate, "<parent>" );
+
+        File warTemplate = getTemplateFile( project, "subModuleWar/pom.xml" );
+        assertExists( warTemplate );
+        assertContent( warTemplate, "${groupId}" );
+        assertContent( warTemplate, "${artifactId}" );
+        assertContent( warTemplate, "${version}" );
+        assertContent( warTemplate, "Maven archetype Test 
create-4-subModuleWar ${someProperty}" );
+        assertContent( warTemplate, "<packaging>war</packaging>" );
+        assertContent( warTemplate, "<parent>" );
+    }
+
+    public void testCreateFilesetArchetype5()
+        throws Exception
+    {
+        String project = "create-5";
+
+        createFilesetArchetype( project );
+
+        File template = getTemplateFile( project, "dummy.file" );
+        assertExists( template );
+    }
+    
+    protected void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+    }
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        localRepository = new DefaultArtifactRepository( "local",
+           new File( getBasedir(), "target/test-classes/repositories/local" 
).toURI().toString(),
+           new DefaultRepositoryLayout() );
+    }
+
+    private void assertContent( File template, String content )
+        throws FileNotFoundException, IOException
+    {
+        String templateContent = FileUtils.fileRead( template, "UTF-8" );
+        assertTrue( "File " + template + " does not contain " + content,
+                    StringUtils.countMatches( templateContent, content ) > 0 );
+    }
+
+    private void assertExists( File file )
+    {
+        assertTrue( "File doesn't exist: " + file.getAbsolutePath(), 
file.exists() );
+    }
+
+    private void assertNotContent( File template, String content )
+        throws FileNotFoundException, IOException
+    {
+        String templateContent = FileUtils.fileRead( template, "UTF-8" );
+        assertFalse( "File " + template + " contains " + content,
+                     StringUtils.countMatches( templateContent, content ) > 0 
);
+    }
+
+    private void copy( File in, File out )
+        throws IOException, FileNotFoundException
+    {
+        assertTrue( !out.exists() || out.delete() );
+        assertFalse( out.exists() );
+        FileUtils.copyFile( in, out );
+        assertTrue( out.exists() );
+        assertTrue( in.exists() );
+    }
+
+    private File getDescriptorFile( String project )
+    {
+        return getFile( project, 
"target/generated-sources/archetype/src/main/resources/META-INF/maven/archetype.xml"
 );
+    }
+
+    private void assertNotExists( File file )
+    {
+        assertFalse( "File exists: " + file.getAbsolutePath(), file.exists() );
+    }
+
+    private File getFile( String project, String file )
+    {
+        return new File( getBasedir(), "target/test-classes/projects/" + 
project + "/" + file );
+    }
+
+    private File getProjectFile( String project )
+    {
+        return getFile( project, "pom.xml" );
+    }
+
+    private File getProjectSampleFile( String project )
+    {
+        return getFile( project, "pom.xml.sample" );
+    }
+
+    private File getPropertiesFile( String project )
+    {
+        return getFile( project, "archetype.properties" );
+    }
+
+    private File getPropertiesSampleFile( final String project )
+    {
+        return getFile( project, "archetype.properties.sample" );
+    }
+
+    private File getTemplateFile( String project, String template )
+    {
+        return getFile( project, 
"target/generated-sources/archetype/src/main/resources/archetype-resources/"
+            + template );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/8e0fe06a/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
----------------------------------------------------------------------
diff --git 
a/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
 
b/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
new file mode 100644
index 0000000..f6f9c55
--- /dev/null
+++ 
b/archetype-testing/archetype-final/src/test/java/org/apache/maven/archetype/test/ArchetyperRoundtripTest.java
@@ -0,0 +1,245 @@
+package org.apache.maven.archetype.test;
+
+/*
+ * 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.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.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.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.DefaultProjectBuilderConfiguration;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.interpolation.ModelInterpolator;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.util.Properties;
+
+/**
+ * @author Jason van Zyl
+ */
+public class ArchetyperRoundtripTest
+    extends PlexusTestCase
+{
+
+    public void testArchetyper()
+        throws Exception
+    {
+
+        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" );
+
+        // (1) create a project from scratch
+        // (2) create an archetype from the project
+        // (3) create our own archetype catalog properties in memory
+        // (4) create our own archetype catalog describing the archetype we 
just created
+        // (5) deploy the archetype we just created
+        // (6) create a project form the archetype we just created
+        // 
------------------------------------------------------------------------
+        //
+        // 
------------------------------------------------------------------------
+        // (1) create a project from scratch
+//        File sourceProject = new File( getBasedir(  ), 
"target/test-classes/projects/roundtrip-1-project" );
+
+        File workingProject = new File( getBasedir(),
+                                        "target" + File.separator + 
"test-classes" + File.separator + "projects"
+                                            + File.separator + 
"roundtrip-1-project" );
+        FileUtils.forceDelete( new File( workingProject, "target" ) );
+
+        // (2) create an archetype from the project
+        File pom = new File( workingProject, "pom.xml" );
+
+        MavenProject project = projectBuilder.build( pom, localRepository, 
null );
+
+        Properties properties = new Properties();
+        properties.setProperty( "someProperty", "someValue" );
+        ArchetypeCreationRequest acr = new 
ArchetypeCreationRequest().setProject( project ).
+            setLocalRepository( localRepository ).setProperties( properties 
).setPostPhase( "package" );
+
+        ArchetypeCreationResult creationResult = 
archetype.createArchetypeFromProject( acr );
+
+        if ( creationResult.getCause() != null )
+        {
+            throw creationResult.getCause();
+        }
+
+        // (3) create our own archetype catalog properties in memory
+        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 generatedArchetypePom = new File( generatedArchetypeDirectory, 
"pom.xml" );
+        MavenProject generatedArchetypeProject = projectBuilder.build( 
generatedArchetypePom, localRepository, null );
+        ModelInterpolator modelInterpolator = (ModelInterpolator)lookup( 
ModelInterpolator.ROLE );
+        Model generatedArchetypeModel = modelInterpolator.interpolate( 
generatedArchetypeProject.getModel(), generatedArchetypePom.getParentFile(), 
new DefaultProjectBuilderConfiguration(), true );
+
+        File archetypeDirectory =
+            new File( generatedArchetypeDirectory, "src" + File.separator + 
"main" + File.separator + "resources" );
+
+        File archetypeArchive = archetype.archiveArchetype( 
archetypeDirectory, new File(
+            generatedArchetypeModel.getBuild().getDirectory() ),
+                                                            
generatedArchetypeModel.getBuild().getFinalName() );
+
+        String baseName =
+            StringUtils.replace( generatedArchetypeProject.getGroupId(), ".", 
File.separator ) + File.separator
+                + generatedArchetypeProject.getArtifactId() + File.separator + 
generatedArchetypeProject.getVersion()
+                + File.separator + 
generatedArchetypeProject.getBuild().getFinalName();
+        File archetypeInRepository = new File( centralRepository.getBasedir(), 
baseName + ".jar" );
+        File archetypePomInRepository = new File( 
centralRepository.getBasedir(), baseName + ".pom" );
+        archetypeInRepository.getParentFile().mkdirs();
+        FileUtils.copyFile( archetypeArchive, archetypeInRepository );
+        FileUtils.copyFile( generatedArchetypePom, archetypePomInRepository );
+
+        // (4) create our own archetype catalog describing the archetype we 
just created
+        ArchetypeCatalog catalog = new ArchetypeCatalog();
+        Archetype generatedArchetype = new Archetype();
+        generatedArchetype.setGroupId( generatedArchetypeProject.getGroupId() 
);
+        generatedArchetype.setArtifactId( 
generatedArchetypeProject.getArtifactId() );
+        generatedArchetype.setVersion( generatedArchetypeProject.getVersion() 
);
+        generatedArchetype.setRepository( "http://localhost:"; + port + "/repo" 
);
+        catalog.addArchetype( generatedArchetype );
+
+        ArchetypeCatalogXpp3Writer catalogWriter = new 
ArchetypeCatalogXpp3Writer();
+        Writer writer = new FileWriter( catalogFile );
+        catalogWriter.write( writer, catalog );
+        IOUtils.closeQuietly( writer );
+
+        // (6) create a project form the archetype we just created
+        String outputDirectory = new File( getBasedir(),
+                                           "target" + File.separator + 
"test-classes" + File.separator + "projects"
+                                               + File.separator + 
"roundtrip-1-recreatedproject" ).getAbsolutePath();
+        FileUtils.forceDelete( outputDirectory );
+
+        ArchetypeGenerationRequest agr =
+            new ArchetypeGenerationRequest().setArchetypeGroupId( 
generatedArchetypeProject.getGroupId() ).
+                setArchetypeArtifactId( 
generatedArchetypeProject.getArtifactId() ).
+                setArchetypeVersion( generatedArchetypeProject.getVersion() ).
+                setGroupId( "com.mycompany" ).setArtifactId( "myapp" 
).setVersion( "1.0-SNAPSHOT" ).
+                setPackage( "com.mycompany.myapp" ).setProperties( properties 
).
+                setOutputDirectory( outputDirectory ).setLocalRepository( 
localRepository ).
+                setArchetypeRepository( "http://localhost:"; + port + "/repo/" 
);
+        ArchetypeGenerationResult generationResult = 
archetype.generateProjectFromArchetype( agr );
+
+        if ( generationResult.getCause() != null )
+        {
+            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" + 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 );
+        //Assert symbol_dollar archetype-138
+    }
+
+    private Server server;
+
+    int port;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        // Start Jetty
+
+        System.setProperty( "org.apache.maven.archetype.repository.directory",
+                            getTestPath( 
"target/test-classes/repositories/central" ) );
+
+        server = new Server( 0 );
+
+        WebAppContext webapp = new WebAppContext();
+        webapp.setContextPath( "/repo" );
+        webapp.setWar( "target/wars/archetype-repository.war" );
+        server.setHandler( webapp );
+
+        server.start();
+
+        port = server.getConnectors()[0].getLocalPort();
+
+    }
+
+    public void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+        // Stop Jetty
+
+        server.stop();
+    }
+}

Reply via email to