apache / apache/maven-archetype

[ARCHETYPE-616] Filelist scanning does not use substitute property in directory name

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

Description

**[Ryan](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=stewartie4)** opened **[ARCHETYPE-616](https://issues.apache.org/jira/browse/ARCHETYPE-616?redirect=false)** and commented

When creating an archetype, I would like directories to be copied based on a property **p**.

eg. given a directory structure

root

— a

------ pom.xml

— b

------ pom.xml

 

if the **p** property is passed as "a" Only the "a" directory is copied, "b" is not copied.

 

My archetype-metadata.xml looks like the following:

> \
> > > \
> > >    \
> > >       \__p__\
> > >       \
> > >          \***/***\
> > >       \
> > >    \
> > > \
> > > \
> > >    \
> > >       \a\
> > >    \
> > > \
> > > \

And I can see in the debug logs that the directory name is being substituted correctly

[DEBUG] Replacing property 'p' in file path '__p__//' with value 'a'.

[DEBUG] Final interpolated file path: 'a//'

**However the file search itself is not using the substituted directory name, leading to it finding no files** 

[DEBUG] Processing fileset __p__ (Filtered-Flat) [**/** -- ] -> 0:

[DEBUG] Processed 0 files.

 

I am very confident this is not an issue with my archetype-metadata.xml because when I replace "__p__" with either "a" or "b" (hardcode) it searches, finds and copies the files in that directory successfully.

 

**Expected behaviour:**

Property is substituted in directory path and that same substituted directory is scanned for files, as is stated in the docs

**Actual behaviour:**

Property is substituted, but the scan takes place in the non-substituted ___p___ directory. This may be a feature if the directory was named "__p__" but both situations should be covered

---

**Affects:** 3.2.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown archetype-metadata.xml, the __p__ directory, and property p=a, then follow the filelist scanning path and its debug output. Compare the substituted directory used for the final path with the directory used by the file search; done means files under a are found and copied while the documented behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.