[jira] [Comment Edited] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex
[ https://issues.apache.org/jira/browse/ARCHETYPE-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16374383#comment-16374383 ] Giovanni Lovato edited comment on ARCHETYPE-492 at 2/23/18 2:07 PM: This is an issue also for archetypes which contains Flyway database migration files, which has a specific filename pattern, e.g. {{V2\_\_my-schema.sql}} (i.e. version + {{\_}} + {{\_}} + description). So if I include in the archetype a file named {{V2\_\_\_\_rootArtifactId\_\_-schema.sql}} I would expect it to be created as {{V2\_\_my-artifact-schema.sql}}. was (Author: heruan): This is an issue also for archetypes which contains Flyway database migration files, which has a specific filename pattern, e.g. {{V2__my-schema.sql}} (i.e. version + _ + _ + description). So if I include in the archetype a file named {{V2rootArtifactId__-schema.sql}} I would expect it to be created as {{V2__my-artifact-schema.sql}}. > 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 >Priority: Major > > 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 > {{somethingartifactId__.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 > Apologies for the formatting - it appears double underscores are an issue :-) -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex
[ https://issues.apache.org/jira/browse/ARCHETYPE-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16374383#comment-16374383 ] Giovanni Lovato edited comment on ARCHETYPE-492 at 2/23/18 2:06 PM: This is an issue also for archetypes which contains Flyway database migration files, which has a specific filename pattern, e.g. {{V2__my-schema.sql}} (i.e. version + _ + _ + description). So if I include in the archetype a file named {{V2rootArtifactId__-schema.sql}} I would expect it to be created as {{V2__my-artifact-schema.sql}}. was (Author: heruan): This is an issue also for archetypes which contains Flyway database migration files, which has a specific filename pattern, e.g. \{{V2__my-schema.sql}} (i.e. version + _ + _ + description). So if I include in the archetype a file named {{V2rootArtifactId__-schema.sql}} I would expect it to be created as {{V2__my-artifact-schema.sql}}. > 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 >Priority: Major > > 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 > {{somethingartifactId__.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 > Apologies for the formatting - it appears double underscores are an issue :-) -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex
[ https://issues.apache.org/jira/browse/ARCHETYPE-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16292219#comment-16292219 ] Matthias Hanisch edited comment on ARCHETYPE-492 at 12/15/17 9:19 AM: -- Just to let everybody else know my workaround: In archetype-metadata I created a requiredProperty like this: {noformat} _${artifactId} {noformat} The above filename can be now written as {noformat} errors__underscoreArtifactId__.properties {noformat} This avoids the triple-underscore-problem. Ugly, but works. was (Author: matze): Just to let everybody else know my workaround: In archetype-metadata I created a requiredProperty like this: {noformat} _${artifactId} {noformat} The above filename can be now written as errors___underscoreArtifactId___.properties. This avoids the triple-underscore-problem > 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 > {{somethingartifactId__.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 > Apologies for the formatting - it appears double underscores are an issue :-) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex
[ https://issues.apache.org/jira/browse/ARCHETYPE-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16290895#comment-16290895 ] Matthias Hanisch edited comment on ARCHETYPE-492 at 12/15/17 9:17 AM: -- Got the same problem today. Wanted to generate a file {noformat} errors_${artifactId}.properties {noformat} so I chose the filename {noformat} errors___artifactId__.properties {noformat} in the archetype. The placeholder in the file name was not resolved. was (Author: matze): Got the same problem today. Wanted to generate a file errors_${artifactId}.properties, so I chose the filename errorsartifactId___.properties in the archetype. The placeholder in the file name was not resolved. > 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 > {{somethingartifactId__.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 > Apologies for the formatting - it appears double underscores are an issue :-) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (ARCHETYPE-492) Underscore in filenames problematic due to greedy regex
[ https://issues.apache.org/jira/browse/ARCHETYPE-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16290895#comment-16290895 ] Matthias Hanisch edited comment on ARCHETYPE-492 at 12/14/17 2:20 PM: -- Got the same problem today. Wanted to generate a file errors_${artifactId}.properties, so I chose the filename errorsartifactId___.properties in the archetype. The placeholder in the file name was not resolved. was (Author: matze): Got the same problem today. Wanted to generate a file errors_${artifactId}.properties, so I chose the filename errors___artifactId__.properties in the archetype. The placeholder in the file name was not resolved. > 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 > {{somethingartifactId__.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 > Apologies for the formatting - it appears double underscores are an issue :-) -- This message was sent by Atlassian JIRA (v6.4.14#64029)