You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Wendy Smoak (JIRA)" <ji...@codehaus.org> on 2008/07/15 19:42:26 UTC

[jira] Created: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Ability to filter filenames (rename files) during project generation
--------------------------------------------------------------------

                 Key: ARCHETYPE-191
                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
             Project: Maven Archetype
          Issue Type: New Feature
          Components: Generator
    Affects Versions: 2.0-alpha-3
            Reporter: Wendy Smoak


When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.

For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.

Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.

See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Raphaël Piéroni (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=145939#action_145939 ] 

Raphaël Piéroni commented on ARCHETYPE-191:
-------------------------------------------

given a multi-module archetype, would something like this is a sufficient soluton ?

in a module of the archetype named prefix-${rootArtifactId} we found a file with name ${rootArtifactId}-${artifactId}-suffix.extension

say we call the generation of this archetype with -DartifactId=someartifact

the resulting file will be located in module prefix-someartifact and will be named someartifact-prefix-someartifact-suffix.extension

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Earl Baugh (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=260559#action_260559 ] 

Earl Baugh edited comment on ARCHETYPE-191 at 3/17/11 10:42 AM:
----------------------------------------------------------------

I'm seeing that this behavior doesn't properly work when trying to rename the "top" level directory under the archetype-resources directory, at least for multi module projects.
It seems that the replacement strategy gets confused... This first line, it shows that "test" (the variable value has been replaced) but velocity doesn't know how to reference it or the like. The line in the file was <module id="${rootArtifactId}" dir="__rootArtifactId__" >.  The dir in the archtype-resources is named __rootArtifactId__, so that's right, and from the below it replaced the value correctly.

[ERROR] ResourceManager : unable to find resource 'archetype-resources/test/pom.xml' in any resource loader.
[ERROR] org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/test/pom.xml'

Should I open a new issue on this?

      was (Author: ebaugh):
    I'm seeing that this behavior doesn't properly work when trying to rename the "top" level directory under the archetype-resources directory, at least for multi module projects.
It seems that the replacement strategy gets confused... This first line, it shows that "test" (the variable value has been replaced) but velocity doesn't know how to reference it or the like. The line in the file was <module id="${rootArtifactId}" dir="__rootArtifactId__" >.  </i>The dir in the archtype-resources is named __rootArtifactId__, so that's right, and from the below it replaced the value correctly.

[ERROR] ResourceManager : unable to find resource 'archetype-resources/test/pom.xml' in any resource loader.
[ERROR] org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/test/pom.xml'

Should I open a new issue on this?
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Earl Baugh (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=260559#action_260559 ] 

Earl Baugh commented on ARCHETYPE-191:
--------------------------------------

I'm seeing that this behavior doesn't properly work when trying to rename the "top" level directory under the archetype-resources directory, at least for multi module projects.
It seems that the replacement strategy gets confused... This first line, it shows that "test" (the variable value has been replaced) but velocity doesn't know how to reference it or the like. The line in the file was <module id="${rootArtifactId}" dir="__rootArtifactId__" >.  The dir in the archtype-resources is named __rootArtifactId__, so that's right, and from the below it replaced the value correctly.

[ERROR] ResourceManager : unable to find resource 'archetype-resources/test/pom.xml' in any resource loader.
[ERROR] org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/test/pom.xml'

Should I open a new issue on this?

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160206#action_160206 ] 

Alexander Maslov edited comment on ARCHETYPE-191 at 1/7/09 2:59 AM:
--------------------------------------------------------------------

this does not work for files like:

messages\_\_\_property-name\_\_.properties

So if there is "\_" before "\_\_property-name\_\_" the it tries to use "\_property-name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "\_\_" and as a result TOKEN_PATTERN is ".\*\_\_.\*\_\_.\*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.


TOKEN_PATTERN might be not a problem but here:

{code:title:DefaultFilesetArchetypeGenerator.java}
    private String replaceFilenameTokens( String filePath, Context context ) 
    {
        String interpolatedResult = filePath;
        String propertyToken = null;
        String contextPropertyValue = null;

        int start = 0;
        int end = 0;
        int skipUndefinedPropertyIndex = 0;

        int maxAttempts = StringUtils.countMatches( interpolatedResult, 
                DELIMITER ) / 2;

        for ( int x = 0; x < maxAttempts && start != -1; x++ ) 
        {
            start = interpolatedResult.indexOf( DELIMITER, skipUndefinedPropertyIndex );

            if ( start != -1 ) 
            {
                end = interpolatedResult.indexOf( DELIMITER, 
                        start + DELIMITER.length() );

                if ( end != -1 ) 
                {
                   propertyToken = interpolatedResult.substring( 
                           start + DELIMITER.length(), end );
                }
{code}




      was (Author: maslovalex):
    this does not work for files like:

messages\_\_\_property-name\_\_.properties

So if there is "\_" before "\_\_property-name\_\_" the it tries to use "\_property-name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "\_\_" and as a result TOKEN_PATTERN is ".\*\_\_.\*\_\_.\*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.


  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160206#action_160206 ] 

Alexander Maslov edited comment on ARCHETYPE-191 at 1/7/09 2:18 AM:
--------------------------------------------------------------------

this does not work for files like:

messages\_\_\_property-name\_\_.properties

So if there is "\_" before "\_\_property-name\_\_" the it tries to use "\_property-name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "\_\_" and as a result TOKEN_PATTERN is ".\*\_\_.\*\_\_.\*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.



      was (Author: maslovalex):
    this does not work for files like:

messages____property-name__.properties

So if there is "_" before "__property-name__" the it tries to use "_property_name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "__" and as a result TOKEN_PATTERN is ".*__.*__.*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.


  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Raphaël Piéroni (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=152337#action_152337 ] 

Raphaël Piéroni commented on ARCHETYPE-191:
-------------------------------------------

Frédéric, 

This feature is only available with the new archetype descriptor.
This file is archetype-metadata.xml.
Try 'mvn archetype:create-from-project' in a project
Then go in target/generated-sources/archetype to see such a file.

To enable the feature, please change the name of the files you have in src/main/resources/archetype-resources

You can se an example of this in the test archetype like in : http://svn.apache.org/repos/asf/maven/archetype/trunk/archetype-common/src/test/archetypes/fileset-1.0/

Regards,

Raphaël

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Maslov updated ARCHETYPE-191:
---------------------------------------

    Attachment: ReplaceFileNameToken_RegExp.patch

patch changes 
{code}
private String replaceFilenameTokens( String filePath, Context context )
{code}

to use regexp Matcher for property values interpolation.
e.g. 

prop1= 1
prop_2 = 2
prop3 = 3
pr_o_p4= 4
prop_PP= 5

{code}
messages___prop1_____prop_2__prop3__pr_o_p4_____prop_PP__.properties   >>>  messages_1_2prop34_5.properties
{code}

patch made against trunk rev732308

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Earl Baugh (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=260559#action_260559 ] 

Earl Baugh edited comment on ARCHETYPE-191 at 3/17/11 10:42 AM:
----------------------------------------------------------------

I'm seeing that this behavior doesn't properly work when trying to rename the "top" level directory under the archetype-resources directory, at least for multi module projects.
It seems that the replacement strategy gets confused... This first line, it shows that "test" (the variable value has been replaced) but velocity doesn't know how to reference it or the like. The line in the file was <module id="${rootArtifactId}" dir="__rootArtifactId__" >.  </i>The dir in the archtype-resources is named __rootArtifactId__, so that's right, and from the below it replaced the value correctly.

[ERROR] ResourceManager : unable to find resource 'archetype-resources/test/pom.xml' in any resource loader.
[ERROR] org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/test/pom.xml'

Should I open a new issue on this?

      was (Author: ebaugh):
    I'm seeing that this behavior doesn't properly work when trying to rename the "top" level directory under the archetype-resources directory, at least for multi module projects.
It seems that the replacement strategy gets confused... This first line, it shows that "test" (the variable value has been replaced) but velocity doesn't know how to reference it or the like. The line in the file was <module id="${rootArtifactId}" dir="__rootArtifactId__" >.  The dir in the archtype-resources is named __rootArtifactId__, so that's right, and from the below it replaced the value correctly.

[ERROR] ResourceManager : unable to find resource 'archetype-resources/test/pom.xml' in any resource loader.
[ERROR] org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/test/pom.xml'

Should I open a new issue on this?
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Pat Podenski (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=144730#action_144730 ] 

Pat Podenski commented on ARCHETYPE-191:
----------------------------------------

I could use the capability for renaming a file as well. My use case concerns filenames such as for wsdl and xml schema.

Please see the following posting in the user forum for more details:

<http://www.nabble.com/Renaming-a-file-during-creation-of-a-project-from-an-archetype-tt18933073.html>

My vote: +1

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Brad Szabo (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brad Szabo updated ARCHETYPE-191:
---------------------------------

    Attachment: ReplaceAnyContextPropertyEnhancement.patch

Here is a patch that improves upon the token replacement to work with any available context properties (not just {{artifactId}} & {{rootArtifactId}}). It includes a test.

With this patch, any properties that are set can be used.

Example Archetype file:
{noformat}
example-archetype/src/main/resources/archetype-resources/module1/src/main/resources/__my-property__.properties
{noformat}

Example Generated output (where -DartifactId=sample2 -Dmy-property=arbitrary):
{noformat}
sample2/module1/src/main/resources/arbitrary.properties 
{noformat}





> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Vick Martz (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=153399#action_153399 ] 

Vick Martz commented on ARCHETYPE-191:
--------------------------------------

When I deleted all the content of this location: C:\Documents and Settings\myUser\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin I've solved all problems.
At the next run the application automatically downloaded the last version of maven-archetype-plugin which is 2.0-alpha-4

It was my solution way. Try if it's yours.

Vick




> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "David Tucker (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259496#action_259496 ] 

David Tucker edited comment on ARCHETYPE-191 at 3/9/11 12:45 PM:
-----------------------------------------------------------------

We had this problem as well and as it turns out, the documentation that is presented here is misleading if you're trying to do this with child modules.  If you want to have your child projects renamed the way Joe asked about you have to have the archetype named with the following pattern:

{code:xml}
parent-project
    \parent-project-core
    \parent-project-persistence
    \parent-project-web
{code}

This way if you name your project "blar" when you generate it from the archetype, you should get:

{code:xml}
blar
    \blar-core
    \blar-persistence
    \blar-web
{code}

The only problem I see here is that I can't name my parent project "blar-parent" or it will use that as the string to rename the children.  The ___artifactId___ token doesn't do anything as far as we've been able to tell.

      was (Author: codefox):
    We had this problem as well and as it turns out, the documentation that is presented here is misleading if you're trying to do this with child modules.  If you want to have your child projects renamed the way Joe asked about you have to have the archetype named with the following pattern:

{code:xml}
parent-project
    \parent-project-core
    \parent-project-persistence
    \parent-project-web
{code}

This way if you name your project "blar" when you generate it from the archetype, you should get:

{code:xml}
blar
    \blar-core
    \blar-persistence
    \blar-web
{code}

The only problem I see here is that I can't name my parent project "blar-parent" or it will use that as the string to rename the children.  The __artifactId__ token doesn't do anything as far as we've been able to tell.
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Geir Pettersen (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=148792#action_148792 ] 

Geir Pettersen commented on ARCHETYPE-191:
------------------------------------------

This is exactly what I am looking for. I notice that 2.0-alpha-4-SNAPSHOT plugin already exists in the snapshot repositories and I assume that this fix should be included there as the issue has been marked as "fixed" , right?

If so, how do i tell Maven to use 2.0-alpha-4-SNAPSHOT instead of 2.0-alpha-3 ? I tried running "mvn -U archetype:generate .." but it still uses 2.0-alpha-3.

Thank you very much!

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160206#action_160206 ] 

Alexander Maslov edited comment on ARCHETYPE-191 at 1/7/09 2:59 AM:
--------------------------------------------------------------------

this does not work for files like:

messages\_\_\_property-name\_\_.properties

So if there is "\_" before "\_\_property-name\_\_" the it tries to use "\_property-name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "\_\_" and as a result TOKEN_PATTERN is ".\*\_\_.\*\_\_.\*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.


TOKEN_PATTERN might be not a problem but here:

{code:title=DefaultFilesetArchetypeGenerator.java}
    private String replaceFilenameTokens( String filePath, Context context ) 
    {
        String interpolatedResult = filePath;
        String propertyToken = null;
        String contextPropertyValue = null;

        int start = 0;
        int end = 0;
        int skipUndefinedPropertyIndex = 0;

        int maxAttempts = StringUtils.countMatches( interpolatedResult, 
                DELIMITER ) / 2;

        for ( int x = 0; x < maxAttempts && start != -1; x++ ) 
        {
            start = interpolatedResult.indexOf( DELIMITER, skipUndefinedPropertyIndex );

            if ( start != -1 ) 
            {
                end = interpolatedResult.indexOf( DELIMITER, 
                        start + DELIMITER.length() );

                if ( end != -1 ) 
                {
                   propertyToken = interpolatedResult.substring( 
                           start + DELIMITER.length(), end );
                }
{code}




      was (Author: maslovalex):
    this does not work for files like:

messages\_\_\_property-name\_\_.properties

So if there is "\_" before "\_\_property-name\_\_" the it tries to use "\_property-name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "\_\_" and as a result TOKEN_PATTERN is ".\*\_\_.\*\_\_.\*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.


TOKEN_PATTERN might be not a problem but here:

{code:title:DefaultFilesetArchetypeGenerator.java}
    private String replaceFilenameTokens( String filePath, Context context ) 
    {
        String interpolatedResult = filePath;
        String propertyToken = null;
        String contextPropertyValue = null;

        int start = 0;
        int end = 0;
        int skipUndefinedPropertyIndex = 0;

        int maxAttempts = StringUtils.countMatches( interpolatedResult, 
                DELIMITER ) / 2;

        for ( int x = 0; x < maxAttempts && start != -1; x++ ) 
        {
            start = interpolatedResult.indexOf( DELIMITER, skipUndefinedPropertyIndex );

            if ( start != -1 ) 
            {
                end = interpolatedResult.indexOf( DELIMITER, 
                        start + DELIMITER.length() );

                if ( end != -1 ) 
                {
                   propertyToken = interpolatedResult.substring( 
                           start + DELIMITER.length(), end );
                }
{code}



  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=155516#action_155516 ] 

Frederic commented on ARCHETYPE-191:
------------------------------------

So, folks from m2eclipse answered me that it can't work since it is now yet part of maven core:

??"Unfortunately we can't pickup new version of archetype component and have to wait until Maven core will be ready. "??

Hope that they will add this kind of flexibility on m2eclipse side, but in the meantime, do we know when 2.0-alpha-4 fixes will be included in maven core?

thx 
Frederic

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Raphaël Piéroni (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raphaël Piéroni closed ARCHETYPE-191.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-alpha-4

Fixed since revision 692533

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "David Tucker (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259496#action_259496 ] 

David Tucker commented on ARCHETYPE-191:
----------------------------------------

We had this problem as well and as it turns out, the documentation that is presented here is misleading if you're trying to do this with child modules.  If you want to have your child projects renamed the way Joe asked about you have to have the archetype named with the following pattern:

parent-project
    \parent-project-core
    \parent-project-persistence
    \parent-project-web

This way if you name your project "blar" when you generate it from the archetype, you should get:

blar
    \blar-core
    \blar-persistence
    \blar-web

The only problem I see here is that I can't name my parent project "blar-parent" or it will use that as the string to rename the children.  The __artifactId__ token doesn't do anything as far as we've been able to tell.

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=152334#action_152334 ] 

Frederic commented on ARCHETYPE-191:
------------------------------------

I am still not able to enjoy the new feature...

First, to enable it, I uderstand that i must configure the plugin against 2.0-alpha-4 in the pom of ,y archetype???

and then, I configure in my archetype.xml something like:
<resource filtered="true">src/main/config/setup/__artifactId__.properties</resource>    

but it still does not replace the token with generating the file.

Any Idea?

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Brad Szabo (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=147841#action_147841 ] 

bszabo edited comment on ARCHETYPE-191 at 9/12/08 5:09 PM:
---------------------------------------------------------------

Thanks for adding this valuable feature Raphaël!

I just wanted to give an example of how this works (since I could not find an example anywhere else and it may help others).

Files & directories which contain \_\_artifactId\_\_  or  \_\_rootArtifactId\_\_ are replaced by the property values.

Example Archetype file:
{noformat}
example-archetype/src/main/resources/archetype-resources/module1/src/main/resources/__rootArtifactId__.properties
{noformat}

Example Generated output (where -DartifactId=sample):
{noformat}
sample/module1/src/main/resources/sample.properties 
{noformat}

      was (Author: bszabo):
    Thanks for adding this valuable feature Raphaël!

I just wanted to give an example of how this works (since I could not find an example anywhere else and it may help others).

Files & directories which contain __artifactId__ or __rootArtifactId__ are replaced by the property values.

Example Archetype file:
example-archetype/src/main/resources/archetype-resources/module1/src/main/resources/__rootArtifactId__.properties

Example Generated output (where -DartifactId=sample):
sample/module1/src/main/resources/sample.properties 

  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Mickaël Leduque (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=148784#action_148784 ] 

Mickaël Leduque commented on ARCHETYPE-191:
-------------------------------------------

Is the "any property" feature merged in?
The artifactId version seems far too limited...

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Brad Szabo (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=147841#action_147841 ] 

Brad Szabo commented on ARCHETYPE-191:
--------------------------------------

Thanks for adding this valuable feature Raphaël!

I just wanted to give an example of how this works (since I could not find an example anywhere else and it may help others).

Files & directories which contain __artifactId__ or __rootArtifactId__ are replaced by the property values.

Example Archetype file:
example-archetype/src/main/resources/archetype-resources/module1/src/main/resources/__rootArtifactId__.properties

Example Generated output (where -DartifactId=sample):
sample/module1/src/main/resources/sample.properties 


> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=153716#action_153716 ] 

Frederic commented on ARCHETYPE-191:
------------------------------------

I have tried this but it still does not replace the filename tokens. Anyways, as specified in pom of the example attached, the plugin's version was already enforced with 2.0-alpha-4.

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160261#action_160261 ] 

Alexander Maslov edited comment on ARCHETYPE-191 at 1/7/09 8:19 AM:
--------------------------------------------------------------------

patch [^ReplaceFileNameToken_RegExp.patch] changes 
{code}
private String replaceFilenameTokens( String filePath, Context context )
{code}

to use regexp Matcher for property values interpolation.
e.g. 

prop1= 1
prop_2 = 2
prop3 = 3
pr_o_p4= 4
prop_PP= 5

{code}
messages___prop1_____prop_2__prop3__pr_o_p4_____prop_PP__.properties   >>>  messages_1_2prop34_5.properties
{code}

patch made against trunk rev732308

      was (Author: maslovalex):
    patch changes 
{code}
private String replaceFilenameTokens( String filePath, Context context )
{code}

to use regexp Matcher for property values interpolation.
e.g. 

prop1= 1
prop_2 = 2
prop3 = 3
pr_o_p4= 4
prop_PP= 5

{code}
messages___prop1_____prop_2__prop3__pr_o_p4_____prop_PP__.properties   >>>  messages_1_2prop34_5.properties
{code}

patch made against trunk rev732308
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=152459#action_152459 ] 

frederic.tardif edited comment on ARCHETYPE-191 at 10/30/08 8:58 AM:
--------------------------------------------------------------

I have moved my archetype to the new version. 

BTW, the create-from-project goal is really cool!

Unfortunately, the replacement of filename token still does not work.

I have attached in the ticket a simple archetype (and its pom) in which I try to apply filename filtering. Maybe you can have a glimpse on it and point out what I am doing wrong for to take advantage of filename filtering.

thanks
Frederic

      was (Author: frederic.tardif):
    I have moved my archetype to the new version. 

BTW, the create-from-project goal is really cool!

Unfortunately, the replacement of filename token still does not work.

I have attached in the ticket a simple archetype (and its pom) in which I try to apply filename filtering. Maybe you can have a glimpse on it and point out what I am doing wrong for the take advantage of filename filtering.

thanks
Frederic
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=153826#action_153826 ] 

Frederic commented on ARCHETYPE-191:
------------------------------------

I discovered that it works fine with command line. But it does not work when I try it using maven integration plugin for eclipse. I have open a ticket on their side:
http://jira.codehaus.org/browse/MNGECLIPSE-1054


> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=152334#action_152334 ] 

frederic.tardif edited comment on ARCHETYPE-191 at 10/29/08 2:29 PM:
--------------------------------------------------------------

I am still not able to enjoy the new feature...

First, to enable it, I uderstand that i must configure the plugin against 2.0-alpha-4 in the pom of my archetype???

and then, I configure in my archetype.xml something like:
<resource filtered="true">src/main/config/setup/__artifactId__.properties</resource>    

but it still does not replace the token with generating the file.

Any Idea?

      was (Author: frederic.tardif):
    I am still not able to enjoy the new feature...

First, to enable it, I uderstand that i must configure the plugin against 2.0-alpha-4 in the pom of ,y archetype???

and then, I configure in my archetype.xml something like:
<resource filtered="true">src/main/config/setup/__artifactId__.properties</resource>    

but it still does not replace the token with generating the file.

Any Idea?
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frederic updated ARCHETYPE-191:
-------------------------------

    Attachment: mytest-1.0.1.jar

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Pat Podenski (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=146443#action_146443 ] 

Pat Podenski commented on ARCHETYPE-191:
----------------------------------------

Raphael,

This sounds like the solution to the problem I described. Is this feature already available? Or is this a potential feature of archetype NG?

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Brad Szabo (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brad Szabo updated ARCHETYPE-191:
---------------------------------

    Attachment: ReplaceAnyContextPropertyEnhancement-v2.patch

Attached a second version of the patch {{ReplaceAnyContextPropertyEnhancement-v2.patch}}. This one properly handles undefined properties.

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Joe Littlejohn (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=242768#action_242768 ] 

Joe Littlejohn commented on ARCHETYPE-191:
------------------------------------------

Is this patch present in the core for Maven 2.2.1?

Also, would it work for directories as well as files? What I need is the ability to create this kind of project:

{noformat}
XXX-Parent
   \XXX-Core
   \XXX-Persistence
   \XXX-Web
      \...
{noformat} 

When I generate the archetype, I'd like the XXX to be replaced with a supplied name. I've tried various techniques to achieve this, all without success. It seems to be complicated by the fact that in order for resources to be put in the right place, the structure of 'archetype-resources' must match the structure of the project being generated. Is what I'm trying to do impossible with the archetype plugin right now?

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Raphaël Piéroni (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=146593#action_146593 ] 

Raphaël Piéroni commented on ARCHETYPE-191:
-------------------------------------------

Hi Pat, 
My last comment was a proposition of solution.
Now i know it is what is desired, i will try to implement it.

Thanks

Raphaël

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=152459#action_152459 ] 

Frederic commented on ARCHETYPE-191:
------------------------------------

I have moved my archetype to the new version. 

BTW, the create-from-project goal is really cool!

Unfortunately, the replacement of filename token still does not work.

I have attached in the ticket a simple archetype (and its pom) in which I try to apply filename filtering. Maybe you can have a glimpse on it and point out what I am doing wrong for the take advantage of filename filtering.

thanks
Frederic

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Frederic (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frederic updated ARCHETYPE-191:
-------------------------------

    Attachment: mytest-1.0.1.pom

> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "Alexander Maslov (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160206#action_160206 ] 

Alexander Maslov commented on ARCHETYPE-191:
--------------------------------------------

this does not work for files like:

messages____property-name__.properties

So if there is "_" before "__property-name__" the it tries to use "_property_name" which is undefined.

This is because DELIMITER in DefaultFilesetArchetypeGenerator.java is "__" and as a result TOKEN_PATTERN is ".*__.*__.*"

If you restrict property name to start and end with letter or number, then TOKEN_PATTERN could be changed to avoid this kind of situations.



> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (ARCHETYPE-191) Ability to filter filenames (rename files) during project generation

Posted by "David Tucker (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/ARCHETYPE-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259496#action_259496 ] 

David Tucker edited comment on ARCHETYPE-191 at 3/9/11 12:43 PM:
-----------------------------------------------------------------

We had this problem as well and as it turns out, the documentation that is presented here is misleading if you're trying to do this with child modules.  If you want to have your child projects renamed the way Joe asked about you have to have the archetype named with the following pattern:

{code:xml}
parent-project
    \parent-project-core
    \parent-project-persistence
    \parent-project-web
{code}

This way if you name your project "blar" when you generate it from the archetype, you should get:

{code:xml}
blar
    \blar-core
    \blar-persistence
    \blar-web
{code}

The only problem I see here is that I can't name my parent project "blar-parent" or it will use that as the string to rename the children.  The __artifactId__ token doesn't do anything as far as we've been able to tell.

      was (Author: codefox):
    We had this problem as well and as it turns out, the documentation that is presented here is misleading if you're trying to do this with child modules.  If you want to have your child projects renamed the way Joe asked about you have to have the archetype named with the following pattern:

parent-project
    \parent-project-core
    \parent-project-persistence
    \parent-project-web

This way if you name your project "blar" when you generate it from the archetype, you should get:

blar
    \blar-core
    \blar-persistence
    \blar-web

The only problem I see here is that I can't name my parent project "blar-parent" or it will use that as the string to rename the children.  The __artifactId__ token doesn't do anything as far as we've been able to tell.
  
> Ability to filter filenames (rename files) during project generation
> --------------------------------------------------------------------
>
>                 Key: ARCHETYPE-191
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-191
>             Project: Maven Archetype
>          Issue Type: New Feature
>          Components: Generator
>    Affects Versions: 2.0-alpha-3
>            Reporter: Wendy Smoak
>             Fix For: 2.0-alpha-4
>
>         Attachments: mytest-1.0.1.jar, mytest-1.0.1.pom, ReplaceAnyContextPropertyEnhancement-v2.patch, ReplaceAnyContextPropertyEnhancement.patch, ReplaceFileNameToken_RegExp.patch
>
>
> When generating a new project from an archetype, I need to filter not only values within files, but the names of the files themselves.
> For example, in .NET projects, the project files (.sln, .csproj) match the name of the solution or project rather than having a fixed name like Maven's pom.xml does.
> Another user raised a similar issue on the mailing list, the ability to filter in the name of Java source code files.
> See:  http://www.nabble.com/Archetype%2C-define-file-name-ts18430983.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira