Skip to content

Fragile endsWith check for maven-shared-archive-resources in createArchiver #307

Description

@elharo

In AbstractSourceJarMojo.createArchiver(), the shared archive resources directory is identified using endsWith:

if (r.getDirectory().endsWith("maven-shared-archive-resources")) {
    addDirectory(
            archiver.getArchiver(),
            Paths.get(r.getDirectory()),
            getCombinedIncludes(null),
            getCombinedExcludes(null));
}

A resource directory with a path like /path/tmp-maven-shared-archive-resources-extra or /var/lib/maven-shared-archive-resources-backup would falsely match. This should use exact filename matching (e.g., check the last path segment with Paths.get(r.getDirectory()).getFileName().toString()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions