Skip to content

Fixes #367 - Do not consider project level glob as additional input v… #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mobe91
Copy link

@Mobe91 Mobe91 commented Aug 12, 2025

Fixes #367

Consider a project level glob such as specified via

    <properties>
        <maven.build.cache.input.glob>{*.properties}</maven.build.cache.input.glob>
    </properties>

This change ensures that this glob does not contribute to the cache inputs as additional file or directory, but is only used as glob pattern during walking input directories.

An integration test has been added that demonstrates that unintended files or directories may be considered as cache input with the logic prior to this change.

Under Windows, above configuration would also lead to an exception in the maven-build-cache-extension because {*.properties} would be considered an invalid path.

Caused by: java.nio.file.InvalidPathException: Illegal char <*> at index 1: {*.properties}                                                                                                                                                                                                                                                                                           
    at sun.nio.fs.WindowsPathParser.normalize (WindowsPathParser.java:204)                                                                                                                                                                                                                                                                                                           
    at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:175)                                                                                                                                                                                                                                                                                                               
    at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:77)                                                                                                                                                                                                                                                                                                                
    at sun.nio.fs.WindowsPath.parse (WindowsPath.java:92)                                                                                                                                                                                                                                                                                                                            
    at sun.nio.fs.WindowsFileSystem.getPath (WindowsFileSystem.java:231)                                                                                                                                                                                                                                                                                                             
    at java.nio.file.Path.of (Path.java:148)                                                                                                                                                                                                                                                                                                                                         
    at java.nio.file.Paths.get (Paths.java:69)                                                                                                                                                                                                                                                                                                                                       
    at org.apache.maven.buildcache.checksum.MavenProjectInput.getInputFiles (MavenProjectInput.java:375)

Following this checklist to help us incorporate your
contribution quickly and easily:

  • [ x ] Your pull request should address just one issue, without pulling in other changes.
  • [ x ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • [ x ] Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • [ x ] Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • [ x ] You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

maven.build.cache.input.glob considered as additional input when specified as project level property
1 participant