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 2016/01/16 22:21:05 UTC

maven-archetype git commit: [ARCHETYPE-496] Copy archetype integration tests when create-from-project

Repository: maven-archetype
Updated Branches:
  refs/heads/master 6b0b51c06 -> f32d67fd9


[ARCHETYPE-496] Copy archetype integration tests when create-from-project

Copy all project integration tests from folder `src/it/projects/` into `src/test/resources/projects/` so that they can be executed
when creating an archetype from existing project.

Close https://issues.apache.org/jira/browse/ARCHETYPE-496


Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/f32d67fd
Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/f32d67fd
Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/f32d67fd

Branch: refs/heads/master
Commit: f32d67fd94bf2b271d885012c7415a94f8e6339f
Parents: 6b0b51c
Author: Petar Tahchiev <pa...@gmail.com>
Authored: Sat Jan 16 23:17:57 2016 +0200
Committer: Petar Tahchiev <pa...@gmail.com>
Committed: Sat Jan 16 23:17:57 2016 +0200

----------------------------------------------------------------------
 .../creator/FilesetArchetypeCreator.java          | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/f32d67fd/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 df62ba6..7d1a88d 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
@@ -266,6 +266,23 @@ public class FilesetArchetypeCreator
 
             createArchetypeBasicIt( archetypeDescriptor, outputDirectory );
 
+            // Copy archetype integration tests.
+            File archetypeIntegrationTestInputFolder =
+                new File( basedir, Constants.SRC + File.separator + "it" + File.separator + "projects" );
+            File archetypeIntegrationTestOutputFolder = new File( outputDirectory,
+                                                                  Constants.SRC + File.separator + Constants.TEST
+                                                                      + File.separator + Constants.RESOURCES
+                                                                      + File.separator + "projects" );
+
+            if ( archetypeIntegrationTestInputFolder.exists() )
+            {
+                getLogger().info( "Copying: " + archetypeIntegrationTestInputFolder.getAbsolutePath() + " into "
+                                      + archetypeIntegrationTestOutputFolder.getAbsolutePath() );
+
+                FileUtils.copyDirectoryStructure( archetypeIntegrationTestInputFolder,
+                                                  archetypeIntegrationTestOutputFolder );
+
+            }
             InvocationRequest internalRequest = new DefaultInvocationRequest();
             internalRequest.setPomFile( archetypePomFile );
             internalRequest.setGoals( Collections.singletonList( request.getPostPhase() ) );
@@ -887,7 +904,6 @@ public class FilesetArchetypeCreator
             pom.setDescription( getReversedPlainContent( pom.getDescription(), pomReversedProperties ) );
             pom.setUrl( getReversedPlainContent( pom.getUrl(), pomReversedProperties ) );
 
-
             rewriteReferences( pom, pomReversedProperties.getProperty( Constants.ARTIFACT_ID ),
                                pomReversedProperties.getProperty( Constants.GROUP_ID ) );