You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Elliotte Rusty Harold (Jira)" <ji...@apache.org> on 2019/12/23 12:01:00 UTC
[jira] [Updated] (ARCHETYPE-498) Ability to use properties in
include and exclude pattern in fileset
[ https://issues.apache.org/jira/browse/ARCHETYPE-498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Elliotte Rusty Harold updated ARCHETYPE-498:
--------------------------------------------
Priority: Major (was: Critical)
> Ability to use properties in include and exclude pattern in fileset
> -------------------------------------------------------------------
>
> Key: ARCHETYPE-498
> URL: https://issues.apache.org/jira/browse/ARCHETYPE-498
> Project: Maven Archetype
> Issue Type: New Feature
> Components: Generator
> Affects Versions: 2.4
> Environment: all
> Reporter: Olivier GUILLET
> Priority: Major
> Labels: features, patch
>
> Give user the ability to use maven properties in fileset include / exclude pattern.
> In methodProcessTemplate of class {{org.apache.maven.archetype.generator.DefaultFilesetArchetypeGenerator}}, line 770 (in version 2.4).
> Adding this lines:
> {code}
> FileSet fileSet = iterator.next();
> count++;
> if ( fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty() )
> {
> final List<String> includes = new ArrayList<String>();
> for ( String include : fileSet.getIncludes() )
> {
> includes.add( replaceFilenameTokens( include, context ) );
> }
> fileSet.setIncludes( includes );
> }
> if ( fileSet.getExcludes() != null && !fileSet.getExcludes().isEmpty() )
> {
> final List<String> excludes = new ArrayList<String>();
> for ( String exclude : fileSet.getExcludes() )
> {
> excludes.add( replaceFilenameTokens( exclude, context ) );
> }
> fileSet.setExcludes( excludes );
> }
> {code}
> is really usefull for conditional archetype generation !
> So in {{archetype-metadata.xml}}
> {code}
> <requiredProperties>
> <requiredProperty key="base-name">
> <defaultValue>${artifactId.substring(0,1)}</defaultValue>
> </requiredProperty>
> </requiredProperties>
> <fileSets>
> <fileSet filtered="true" packaged="false" encoding="UTF-8">
> <directory>src/main/resources/directory>
> <includes>
> <include>__base-name__*.*</include>
> </includes>
> </fileSet>
> </fileSets>
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)