Skip to content
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

lacking understanding on how to match paths/files in -Dgib.excludePathsMatching or -Dgib.skipIfPathMatches #387

Closed
polaroidkidd opened this issue Jul 27, 2021 · 3 comments
Labels

Comments

@polaroidkidd
Copy link

Hi there

We have a project structure something like this

root/
  - pom.xml
  /modules/
    /module-1/
      - pom.xml
    /module-2/
      - pom.xml

Our master build pipe-line parses the module pom files and replaces the version tag values from 0.1.4--SNAPSHOT with 0.1.4.123312 (some build hash).

It does this prior to actually launching the build. This means, when GIB compares the master branch with the master--reference branch it will notices the changes in the pom files and build all of the sub-modules, even if there was no change in the actual code.

When I use the excludePathsMatching or skipIfPathMatches with exact paths (i.e. modules/module-1/pom.xml) the change is noted, but skipped since it's part of the regex.

However, I have been trying to get the regex to work on all sub-modules using standard regex notation (for example modules/module-.*/pom\.xml) but it doesn't match. If I'm understanding the documentation I should be able to use

mvn clean install -Dgib.excludePathsMatching=pom\..*

and it should match all files starting with pom, right?

Unfortunately it isn't working and so I must be missing some crucial part to this puzzle. Any help would be appreciated.

@famod
Copy link
Member

famod commented Jul 27, 2021

modules/module-.*/pom\.xml looks correct! Just pom\..* won't work because you have to match the entire path within the repo (in your example: not root or anything before that). I changed that here not long ago: #359

Have you tried quoting the argument, e.g.:

mvn clean install -Dgib.excludePathsMatching='modules/module-.*/pom\.xml'

?

Btw, regarding:

Our master build pipe-line parses the module pom files and replaces the version tag values from 0.1.4--SNAPSHOT with 0.1.4.123312 (some build hash).

Have you considered https://maven.apache.org/maven-ci-friendly.html? With that you don't need to modify the pom.xml files.

@polaroidkidd
Copy link
Author

Have you tried quoting the argument

It works! I can't believe I didn't think of that..

Have you considered https://maven.apache.org/maven-ci-friendly.html? With that you don't need to modify the pom.xml files.

I'm not sure we have. but I'll bring it up with the DevOps team. Thanks for the hlep!

@famod
Copy link
Member

famod commented Jul 28, 2021

I can't believe I didn't think of that..

No worries, glad it now works for you!

@famod famod added the question label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants