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/02/27 12:07:34 UTC

maven-archetype git commit: Files with no extension are not included in the resulting archetype.

Repository: maven-archetype
Updated Branches:
  refs/heads/master c78356648 -> ad70acfd4


Files with no extension are not included in the resulting archetype.

When an archetype is created from a given project, files with no extension are not included in the resulting
archetype. This commit adds a check whether the extension of the file to include is an empty string. A test-case
is also included. Close ARCHETYPE-499


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

Branch: refs/heads/master
Commit: ad70acfd4404197ee39af495ed21cf34533d7be5
Parents: c783566
Author: Petar Tahchiev <pa...@gmail.com>
Authored: Sat Feb 27 13:04:38 2016 +0200
Committer: Petar Tahchiev <pa...@gmail.com>
Committed: Sat Feb 27 13:04:38 2016 +0200

----------------------------------------------------------------------
 .../creator/FilesetArchetypeCreator.java        |  9 +++++-
 .../creator/DefaultArchetypeCreatorTest.java    | 11 +++++++
 .../archetype.properties.sample                 |  8 +++++
 .../pom.xml.sample                              | 34 ++++++++++++++++++++
 .../src/main/csharp/filewithnoextension         |  0
 5 files changed, 61 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/ad70acfd/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 7d1a88d..a430d2c 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
@@ -1784,7 +1784,14 @@ public class FilesetArchetypeCreator
             }
             else
             {
-                includes.add( "**/*." + extension );
+                if ( StringUtils.isEmpty( extension ) )
+                {
+                    includes.add( "**/*" );
+                }
+                else
+                {
+                    includes.add( "**/*." + extension );
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/ad70acfd/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
index b8c5409..8e18b68 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/creator/DefaultArchetypeCreatorTest.java
@@ -168,6 +168,17 @@ public class DefaultArchetypeCreatorTest
         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
     {

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/ad70acfd/archetype-common/src/test/resources/projects/include-file-with-no-extension/archetype.properties.sample
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/resources/projects/include-file-with-no-extension/archetype.properties.sample b/archetype-common/src/test/resources/projects/include-file-with-no-extension/archetype.properties.sample
new file mode 100644
index 0000000..e527799
--- /dev/null
+++ b/archetype-common/src/test/resources/projects/include-file-with-no-extension/archetype.properties.sample
@@ -0,0 +1,8 @@
+archetype.groupId=org.codehaus.mojo.archetypes
+archetype.artifactId=maven-archetype-test
+archetype.version=1.0
+archetype.languages=csharp
+groupId=org.apache.maven.archetype.test
+artifactId=test
+version=1.0-SNAPSHOT
+package=archetype

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/ad70acfd/archetype-common/src/test/resources/projects/include-file-with-no-extension/pom.xml.sample
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/resources/projects/include-file-with-no-extension/pom.xml.sample b/archetype-common/src/test/resources/projects/include-file-with-no-extension/pom.xml.sample
new file mode 100644
index 0000000..74e892e
--- /dev/null
+++ b/archetype-common/src/test/resources/projects/include-file-with-no-extension/pom.xml.sample
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.maven.archetype.test</groupId>
+    <artifactId>include-file-with-no-extension</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>Maven archetype Test Include A File With No Extension</name>
+    <packaging>pom</packaging>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/ad70acfd/archetype-common/src/test/resources/projects/include-file-with-no-extension/src/main/csharp/filewithnoextension
----------------------------------------------------------------------
diff --git a/archetype-common/src/test/resources/projects/include-file-with-no-extension/src/main/csharp/filewithnoextension b/archetype-common/src/test/resources/projects/include-file-with-no-extension/src/main/csharp/filewithnoextension
new file mode 100644
index 0000000..e69de29