apache / apache/maven-archetype

[ARCHETYPE-498] Ability to use properties in include and exclude pattern in fileset

Open
#777 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
148
Forks
181
Avg merge
1d 20h
Merged PRs (30d)
8

Description

**[Olivier GUILLET](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=olivguillet)** opened **[ARCHETYPE-498](https://issues.apache.org/jira/browse/ARCHETYPE-498?redirect=false)** and commented

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 includes = new ArrayList();
for ( String include : fileSet.getIncludes() )
{
includes.add( replaceFilenameTokens( include, context ) );
}
fileSet.setIncludes( includes );
}
if ( fileSet.getExcludes() != null && !fileSet.getExcludes().isEmpty() )
{
final List excludes = new ArrayList();
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`

```


${artifactId.substring(0,1)}


src/main/resources/directory>

__base-name__*.*

```

---

**Affects:** 2.4

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at methodProcessTemplate in org.apache.maven.archetype.generator.DefaultFilesetArchetypeGenerator, using the issue’s archetype-metadata.xml example as the expected input. Trace how fileset includes and excludes are processed and how filename tokens are resolved. Done means Maven properties can control both patterns for conditional archetype generation, with coverage added wherever this generator is tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.