You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pt...@apache.org on 2015/12/17 22:31:54 UTC
maven-archetype git commit: ARCHETYPE-494 run post_create.groovy
after archetype generation to modify the resulting project
Repository: maven-archetype
Updated Branches:
refs/heads/ARCHETYPE-494 [created] d60b87650
ARCHETYPE-494 run post_create.groovy after archetype generation to modify the resulting project
Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/d60b8765
Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/d60b8765
Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/d60b8765
Branch: refs/heads/ARCHETYPE-494
Commit: d60b876506e9b60ffa115c63425f837793fcaacf
Parents: dafa0d8
Author: Petar Tahchiev <pa...@gmail.com>
Authored: Thu Dec 17 23:31:35 2015 +0200
Committer: Petar Tahchiev <pa...@gmail.com>
Committed: Thu Dec 17 23:31:35 2015 +0200
----------------------------------------------------------------------
archetype-common/pom.xml | 30 +++++
.../archetype/ArchetypeCreationRequest.java | 14 +++
.../common/ArchetypeArtifactManager.java | 2 +
.../maven/archetype/common/Constants.java | 2 +
.../common/DefaultArchetypeArtifactManager.java | 21 ++++
.../creator/FilesetArchetypeCreator.java | 13 ++
.../DefaultFilesetArchetypeGenerator.java | 28 ++++-
.../META-INF/maven/archetype-metadata.xml | 121 +++++++++++++++++++
.../archetypes/fileset_with_postscript/pom.xml | 27 +++++
.../META-INF/post_create.groovy | 6 +
.../archetype-resources/pom.xml | 38 ++++++
.../archetype-resources/profiles.xml | 13 ++
.../archetype-resources/src/main/java/App.java | 13 ++
.../archetype-resources/src/main/java/App.ogg | 13 ++
.../src/main/java/ToDelete.java | 1 +
.../src/main/java/inner/package/App2.java | 13 ++
.../src/main/resources/App.properties | 13 ++
.../src/main/resources/__artifactId__/touch.txt | 13 ++
.../resources/__rootArtifactId__/touch_root.txt | 13 ++
.../src/main/resources/some-dir/App.png | 13 ++
.../archetype-resources/src/site/apt/usage.apt | 13 ++
.../archetype-resources/src/site/site.xml | 13 ++
.../archetype-resources/subproject/pom.xml | 44 +++++++
.../subproject/src/main/java/App.java | 13 ++
.../subproject/subsubproject/pom.xml | 40 ++++++
.../subsubproject/src/main/java/App.java | 13 ++
...aryProperty-__property-with-default-1__.java | 14 +++
...-property__-__property-with-default-2__.java | 14 +++
...me__rootArtifactId__Class__artifactId__.java | 14 +++
.../DefaultArchetypeGeneratorTest.java | 109 +++++++++++++++--
.../generate-13/archetype.properties.sample | 0
.../projects/generate-8/pom.xml.sample | 2 +-
.../mojos/CreateArchetypeFromProjectMojo.java | 9 +-
33 files changed, 692 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/pom.xml
----------------------------------------------------------------------
diff --git a/archetype-common/pom.xml b/archetype-common/pom.xml
index a0b4efc..50acd48 100644
--- a/archetype-common/pom.xml
+++ b/archetype-common/pom.xml
@@ -164,6 +164,11 @@
<type>war</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>1.8.3</version>
+ </dependency>
</dependencies>
<build>
@@ -363,6 +368,31 @@
</execution>
<execution>
+ <id>archetype-test-fileset-with-postscript</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <target>
+ <property name="test.archetype.name" value="fileset_with_postscript" />
+ <property name="test.archetype.version" value="1.0" />
+
+ <property name="test.projects.repository" value="repositories/central" />
+ <property name="test.archetype.name-version" value="${test.archetype.name}-${test.archetype.version}" />
+ <property name="test.source.directory" value="${project.basedir}/src/test/archetypes/${test.archetype.name-version}" />
+ <property name="test.target.directory" value="${project.build.directory}/test-classes/${test.projects.repository}/archetypes/${test.archetype.name}/${test.archetype.version}" />
+
+ <mkdir dir="${test.target.directory}" />
+
+ <jar destfile="${test.target.directory}/${test.archetype.name-version}.jar" basedir="${test.source.directory}/" />
+
+ <copy tofile="${test.target.directory}/${test.archetype.name-version}.pom" file="${test.source.directory}/META-INF/maven/archetypes/${test.archetype.name}/pom.xml" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
<id>repository-metadata</id>
<phase>process-test-resources</phase>
<configuration>
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
----------------------------------------------------------------------
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 2617da5..9acfa58 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
@@ -56,6 +56,8 @@ public class ArchetypeCreationRequest
private String postPhase;
+ private String postScript;
+
private File outputDirectory;
public String getPostPhase()
@@ -70,6 +72,18 @@ public class ArchetypeCreationRequest
return this;
}
+ public String getPostScript()
+ {
+ return postScript;
+ }
+
+ public ArchetypeCreationRequest setPostScript( String postScript )
+ {
+ this.postScript = postScript;
+
+ return this;
+ }
+
public ArtifactRepository getLocalRepository()
{
return localRepository;
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/common/ArchetypeArtifactManager.java
----------------------------------------------------------------------
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 529f0e3..5fdaab1 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
@@ -81,6 +81,8 @@ public interface ArchetypeArtifactManager
ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
List<ArtifactRepository> repos );
+ String getPostGenerationScript( File archetypeFile ) throws UnknownArchetype;
+
/**
*/
ArchetypeDescriptor getFileSetArchetypeDescriptor( File archetypeFile )
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java
----------------------------------------------------------------------
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 9015c62..e0b6f08 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
@@ -34,6 +34,8 @@ public interface Constants
String ARCHETYPE_DESCRIPTOR = "META-INF/maven/archetype-metadata.xml";
+ String ARCHETYPE_POST_GENERATION_SCRIPT = "META-INF/post_create.groovy";
+
String ARCHETYPE_POST_GENERATION_GOALS = "archetype.goals";
String ARCHETYPE_POM = "pom.xml";
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
----------------------------------------------------------------------
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 a3de790..3b766c5 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
@@ -19,6 +19,7 @@ package org.apache.maven.archetype.common;
* under the License.
*/
+import org.apache.commons.io.IOUtils;
import org.apache.maven.archetype.downloader.DownloadException;
import org.apache.maven.archetype.downloader.DownloadNotFoundException;
import org.apache.maven.archetype.downloader.Downloader;
@@ -299,6 +300,26 @@ public class DefaultArchetypeArtifactManager
}
}
+ public String getPostGenerationScript( File archetypeFile ) throws UnknownArchetype
+ {
+ ZipFile zipFile = null;
+ try
+ {
+ zipFile = getArchetypeZipFile( archetypeFile );
+
+ Reader reader = getDescriptorReader( zipFile, Constants.ARCHETYPE_POST_GENERATION_SCRIPT );
+ return reader == null ? null : IOUtils.toString( reader );
+ }
+ catch ( IOException e )
+ {
+ throw new UnknownArchetype( e );
+ }
+ finally
+ {
+ closeZipFile( zipFile );
+ }
+ }
+
public ArchetypeDescriptor getFileSetArchetypeDescriptor( File archetypeFile )
throws UnknownArchetype
{
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
----------------------------------------------------------------------
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 304a2a8..9c32a65 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
@@ -147,6 +147,19 @@ public class FilesetArchetypeCreator
File archetypeDescriptorFile = new File( archetypeResourcesDirectory, Constants.ARCHETYPE_DESCRIPTOR );
archetypeDescriptorFile.getParentFile().mkdirs();
+ if ( request.getPostScript() != null )
+ {
+ File archetypePostGenerationScript = new File( archetypeResourcesDirectory,
+ Constants.ARCHETYPE_POST_GENERATION_SCRIPT );
+ archetypePostGenerationScript.getParentFile().mkdirs();
+
+ File inputFile = new File( request.getPostScript() );
+ if ( inputFile.exists() )
+ {
+ FileUtils.copyFile( inputFile, archetypePostGenerationScript );
+ }
+ }
+
getLogger().debug( "Starting archetype's descriptor " + project.getArtifactId() );
ArchetypeDescriptor archetypeDescriptor = new ArchetypeDescriptor();
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
----------------------------------------------------------------------
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 7ebe3c8..9dad01b 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
@@ -19,6 +19,8 @@ package org.apache.maven.archetype.generator;
* under the License.
*/
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
import org.apache.maven.archetype.ArchetypeGenerationRequest;
import org.apache.maven.archetype.common.ArchetypeArtifactManager;
import org.apache.maven.archetype.common.ArchetypeFilesResolver;
@@ -59,6 +61,7 @@ import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
@@ -204,6 +207,29 @@ public class DefaultFilesetArchetypeGenerator
outputDirectoryFile, packageName, archetypeDescriptor, context );
}
+ String postGenerationScript = archetypeArtifactManager.getPostGenerationScript( archetypeFile );
+ if ( postGenerationScript != null )
+ {
+ getLogger().info( "Executing post-generation script" );
+ Binding binding = new Binding();
+
+ if ( request.getProperties() != null )
+ {
+
+ request.getProperties().putAll( System.getProperties() );
+ Enumeration e = request.getProperties().propertyNames();
+ while ( e.hasMoreElements() )
+ {
+ String key = (String) e.nextElement();
+ binding.setVariable( key, request.getProperties().getProperty( key ) );
+ }
+ }
+
+ GroovyShell shell = new GroovyShell( binding );
+
+ shell.evaluate( postGenerationScript );
+ }
+
// ----------------------------------------------------------------------
// Log message on OldArchetype creation
// ----------------------------------------------------------------------
@@ -468,7 +494,7 @@ public class DefaultFilesetArchetypeGenerator
if ( maybeVelocityExpression( value ) )
{
- value = evaluateExpression( context, key, value );
+ value = evaluateExpression( context, key, value );
}
context.put( key, value );
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetype-metadata.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..6b2523a
--- /dev/null
+++ b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,121 @@
+<?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="fileset" partial="false">
+
+ <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 key="property-without-default-2"/>
+ <requiredProperty key="property-without-default-3"/>
+ <requiredProperty key="property-without-default-4"/>
+ </requiredProperties>
+
+ <fileSets>
+ <fileSet filtered="true" packaged="true">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="false" packaged="true">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.ogg</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="false" packaged="false">
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.png</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false">
+ <directory>src/site</directory>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.apt</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true">
+ <directory></directory>
+ <includes>
+ <include>.classpath</include>
+ <include>*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="false" packaged="false">
+ <directory>src/main/toto</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <modules>
+ <module name="subproject" id="subproject" dir="subproject">
+ <fileSets>
+ <fileSet filtered="true" packaged="true">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false">
+ <directory>src/main/toto</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <modules>
+ <module name="subsubproject" id="subsubproject" dir="subsubproject">
+ <fileSets>
+ <fileSet filtered="true" packaged="true">
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ </modules>
+ </module>
+ </modules>
+
+</archetype-descriptor>
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetypes/fileset_with_postscript/pom.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetypes/fileset_with_postscript/pom.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetypes/fileset_with_postscript/pom.xml
new file mode 100644
index 0000000..b7422de
--- /dev/null
+++ b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/maven/archetypes/fileset_with_postscript/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>fileset</artifactId>
+ <version>1.0</version>
+</project>
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/post_create.groovy
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/post_create.groovy b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/post_create.groovy
new file mode 100644
index 0000000..7b01980
--- /dev/null
+++ b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/post_create.groovy
@@ -0,0 +1,6 @@
+println "Executing the post_create script...";
+
+def projectFolder = this.'user.dir' + this.'file.separator' + "target/test-classes/projects" + this.'file.separator' + "generate-13" + this.'file.separator' + "file-value" + this.'file.separator';
+
+println "Removing file: ${projectFolder}src/main/java/file/value/package/ToDelete.java";
+new File(projectFolder + "src/main/java/file/value/package/ToDelete.java").delete();
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/pom.xml
new file mode 100644
index 0000000..33d6dcf
--- /dev/null
+++ b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/pom.xml
@@ -0,0 +1,38 @@
+<?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</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>subproject</module>
+ </modules>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/profiles.xml
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/App.ogg
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/ToDelete.java b/archetype-common/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-common/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/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/java/inner/package/App2.java
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/App.properties
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__artifactId__/touch.txt
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/__rootArtifactId__/touch_root.txt
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/main/resources/some-dir/App.png b/archetype-common/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-common/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/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/apt/usage.apt
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/src/site/site.xml
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/pom.xml
new file mode 100644
index 0000000..3ae5c9a
--- /dev/null
+++ b/archetype-common/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>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/src/main/java/App.java
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/pom.xml
new file mode 100644
index 0000000..4c2bc23
--- /dev/null
+++ b/archetype-common/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>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java b/archetype-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/App.java
new file mode 100644
index 0000000..8fedfdf
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/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-common/src/test/archetypes/fileset_with_postscript-1.0/archetype-resources/subproject/subsubproject/src/main/java/ArbitraryProperty-__property-with-default-1__.java b/archetype-common/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..e6a5a6e
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/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-common/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-common/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..e6a5a6e
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/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-common/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-common/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..e6a5a6e
--- /dev/null
+++ b/archetype-common/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}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
----------------------------------------------------------------------
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 284f80d..942e815 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
@@ -55,9 +55,13 @@ public class DefaultArchetypeGeneratorTest
private final static Archetype ARCHETYPE_FILESET = new Archetype( "archetypes", "fileset", "1.0" );
+ private final static Archetype ARCHETYPE_FILESET_WITH_POSTCREATE_SCRIPT =
+ new Archetype( "archetypes", "fileset_with_postscript", "1.0" );
+
private final static Archetype ARCHETYPE_OLD = new Archetype( "archetypes", "old", "1.0" );
private final static Properties ADDITIONAL_PROPERTIES = new Properties();
+
static
{
ADDITIONAL_PROPERTIES.setProperty( "property-without-default-1", "file-value" );
@@ -323,8 +327,7 @@ public class DefaultArchetypeGeneratorTest
assertTemplateCopiedWithFileSetArchetype( "src/main/java/file/value/package/App.ogg" );
- assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/App.properties",
- "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/App.properties", "file-value" );
assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/file-value/touch.txt", "file-value" );
assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/file-value/touch_root.txt",
"file-value" );
@@ -354,8 +357,8 @@ public class DefaultArchetypeGeneratorTest
assertEquals( "subproject", model.getArtifactId() );
assertEquals( "file-value", model.getVersion() );
- assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/App.java",
- "subsubproject" );
+ assertTemplateContentGeneratedWithFileSetArchetype(
+ "subproject/subsubproject/src/main/java/file/value/package/App.java", "subsubproject" );
assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/"
+ "file-value/inner/subsubproject/innest/Somefile-valueClasssubsubproject.java",
@@ -363,12 +366,13 @@ public class DefaultArchetypeGeneratorTest
assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/"
/* + "file-value/inner/subsubproject/innest/" + */
- + "ArbitraryProperty-file-value.java", "subsubproject" );
+ + "ArbitraryProperty-file-value.java",
+ "subsubproject" );
// Test that undefined properties are safely ignored (and skipped)
assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/"
/* + "file-value/inner/subsubproject/innest/" + */
- + "SkipsUndefinedProperty-__undefined-property__-file-value.java",
+ + "SkipsUndefinedProperty-__undefined-property__-file-value.java",
"subsubproject" );
model = readPom( new File( projectDirectory, "subproject/subsubproject/pom.xml" ) );
@@ -411,14 +415,97 @@ public class DefaultArchetypeGeneratorTest
System.out.println( "testPropertiesNotDefined" );
ArchetypeGenerationRequest request = createArchetypeGenerationRequest( "generate-3", ARCHETYPE_BASIC );
-
+
request.setProperties( new Properties() );
ArchetypeGenerationResult result = generateProjectFromArchetypeWithFailure( request );
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." ) );
+ && result.getCause().getMessage().endsWith(
+ "Property property-without-default-4 is missing." ) );
+ }
+
+ public void testGenerateArchetypeWithPostScriptIncluded()
+ throws Exception
+ {
+ System.out.println( "testGenerateArchetypeWithPostScriptIncluded" );
+
+ ArchetypeGenerationRequest request =
+ createArchetypeGenerationRequest( "generate-13", ARCHETYPE_FILESET_WITH_POSTCREATE_SCRIPT );
+
+ File projectFile = new File( projectDirectory, "pom.xml" );
+
+ FileUtils.forceDelete( projectDirectory );
+
+ generateProjectFromArchetype( request );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/java/file/value/package/App.java", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/java/file/value/package/inner/package/App2.java",
+ "file-value" );
+
+ assertTemplateCopiedWithFileSetArchetype( "src/main/java/file/value/package/App.ogg" );
+
+ File templateFile = new File( projectDirectory, "src/main/java/file/value/package/ToDelete.java" );
+ assertFalse( templateFile.exists() );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/App.properties", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/file-value/touch.txt", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/main/resources/file-value/touch_root.txt",
+ "file-value" );
+
+ assertTemplateCopiedWithFileSetArchetype( "src/main/resources/some-dir/App.png" );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/site/site.xml", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "src/site/apt/usage.apt", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( ".classpath", "file-value" );
+ assertTemplateContentGeneratedWithFileSetArchetype( "profiles.xml", "file-value" );
+
+ Model model = readPom( projectFile );
+ assertNull( model.getParent() );
+ assertEquals( "file-value", model.getGroupId() );
+ assertEquals( "file-value", model.getArtifactId() );
+ assertEquals( "file-value", model.getVersion() );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "subproject/src/main/java/file/value/package/App.java",
+ "subproject" );
+
+ model = readPom( new File( projectDirectory, "subproject/pom.xml" ) );
+ assertNotNull( model.getParent() );
+ assertEquals( "file-value", model.getParent().getGroupId() );
+ assertEquals( "file-value", model.getParent().getArtifactId() );
+ assertEquals( "file-value", model.getParent().getVersion() );
+ assertEquals( "file-value", model.getGroupId() );
+ assertEquals( "subproject", model.getArtifactId() );
+ assertEquals( "file-value", model.getVersion() );
+
+ assertTemplateContentGeneratedWithFileSetArchetype(
+ "subproject/subsubproject/src/main/java/file/value/package/App.java", "subsubproject" );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/"
+ + "file-value/inner/subsubproject/innest/Somefile-valueClasssubsubproject.java",
+ "subsubproject" );
+
+ assertTemplateContentGeneratedWithFileSetArchetype( "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)
+ assertTemplateContentGeneratedWithFileSetArchetype( "subproject/subsubproject/src/main/java/file/value/package/"
+ /* + "file-value/inner/subsubproject/innest/" + */
+ + "SkipsUndefinedProperty-__undefined-property__-file-value.java",
+ "subsubproject" );
+
+ model = readPom( new File( projectDirectory, "subproject/subsubproject/pom.xml" ) );
+ assertNotNull( model.getParent() );
+ assertEquals( "file-value", model.getParent().getGroupId() );
+ assertEquals( "subproject", model.getParent().getArtifactId() );
+ assertEquals( "file-value", model.getParent().getVersion() );
+ assertEquals( "file-value", model.getGroupId() );
+ assertEquals( "subsubproject", model.getArtifactId() );
+ assertEquals( "file-value", model.getVersion() );
+
}
protected void tearDown()
@@ -601,13 +688,15 @@ public class DefaultArchetypeGeneratorTest
IOUtil.close( pomReader );
}
}
-
+
private static class Archetype
{
public final String groupId;
+
public final String artifactId;
+
public final String version;
-
+
public Archetype( String groupId, String artifactId, String version )
{
this.groupId = groupId;
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/resources/projects/generate-13/archetype.properties.sample
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/resources/projects/generate-13/archetype.properties.sample b/archetype-common/src/test/resources/projects/generate-13/archetype.properties.sample
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/archetype-common/src/test/resources/projects/generate-8/pom.xml.sample
----------------------------------------------------------------------
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 a3f5fa3..722b331 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
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+w<?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
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/d60b8765/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
----------------------------------------------------------------------
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
index ab0162a..b9eb5f6 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
@@ -205,6 +205,13 @@ public class CreateArchetypeFromProjectMojo
private String archetypePostPhase;
/**
+ * The property telling the location of a groovy script which will be included in the archetype. This script is executed after
+ * a project is created from this artchetype.
+ */
+ @Parameter( property = "archetype.postScript", defaultValue = "${project.build.resources[0].directory}/post_create.groovy" )
+ private String archetypePostScript;
+
+ /**
* The directory where the archetype should be created.
*/
@Parameter( defaultValue = "${project.build.directory}/generated-sources/archetype" )
@@ -251,7 +258,7 @@ public class CreateArchetypeFromProjectMojo
/* This should be used before there and use only languages and filtereds */.setArchetypeRegistryFile(
archetypeRegistryFile ).setLocalRepository( localRepository )
/* this should be resolved and asked for user to verify */.setPackageName( packageName ).setPostPhase(
- archetypePostPhase ).setOutputDirectory( outputDirectory );
+ archetypePostPhase ).setPostScript( archetypePostScript ).setOutputDirectory( outputDirectory );
ArchetypeCreationResult result = manager.createArchetypeFromProject( request );