Return-Path: X-Original-To: apmail-maven-issues-archive@minotaur.apache.org Delivered-To: apmail-maven-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 934C5176AE for ; Tue, 6 Oct 2015 08:50:27 +0000 (UTC) Received: (qmail 27268 invoked by uid 500); 6 Oct 2015 08:50:26 -0000 Delivered-To: apmail-maven-issues-archive@maven.apache.org Received: (qmail 27050 invoked by uid 500); 6 Oct 2015 08:50:26 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 26727 invoked by uid 99); 6 Oct 2015 08:50:26 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2015 08:50:26 +0000 Date: Tue, 6 Oct 2015 08:50:26 +0000 (UTC) From: "Oliver Dungey (JIRA)" To: issues@maven.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Oliver Dungey created ARCHETYPE-492: --------------------------------------- Summary: Underscore in filenames problematic due to greedy regex Key: ARCHETYPE-492 URL: https://issues.apache.org/jira/browse/ARCHETYPE-492 Project: Maven Archetype Issue Type: Bug Components: Plugin Affects Versions: 2.4 Environment: Windows 7, Sun JDK Reporter: Oliver Dungey If you have a file in a project with an underscore adjacent to a substitution variable, the substitution will fail i.e. if {{artifactId}} is 'Test' and a target file is to be named {{something_test.txt}} the file in the template should be named {{something___artifactId__.txt}} (3 underscores in the middle) but the result is an error stating that the property {{_artifactId}} cannot be found. This is because the term inside the regex is a greedy {{.*}}, a simple fix would be to change this to something like {{__[^_]*__}} which would only match non-underscore characters. Fixing this issue would allow the use of underscores in filenames in all circumstances rather than the current situation where you may get lucky. The only down side to fixing this issue is that properties with leading or trailing underscores will not be valid - this seems a far more preferable situation. A patch for this issue was put on this bug back in 01//2009 but somehow got ignored - see [~maslovalex] patch and comments at the end of this issue: https://issues.apache.org/jira/browse/ARCHETYPE-191 -- This message was sent by Atlassian JIRA (v6.3.4#6332)