You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier GUILLET (JIRA)" <ji...@apache.org> on 2016/02/12 09:47:18 UTC
[jira] [Created] (ARCHETYPE-498) Ability to use properties in
include and exclude pattern in fileset
Olivier GUILLET created ARCHETYPE-498:
-----------------------------------------
Summary: 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: Critical
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:
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 );
}
is really usefull for conditional archetype generation !
So in archetype-metadata.xml
<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>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)