Exclude changes from outside Java pattern
This filter prevents a build from being triggered unless at least one file in a changelist matches one of the specified Java regular expression patterns.
-
If none of the files in a changelist match the defined patterns, the build is not triggered.
-
If any file matches a pattern, the build is triggered.
This filter is useful for narrowing build triggers to specific file types or paths, but care should be taken when writing patterns to avoid unintended matches.
Below is an example of a Java pattern.
//depot/main/tests.* //depot/main/src/.*\.cpp //depot/main/build/.*(?:\.rb|\.py|\.bat|Jenkinsfile) //depot/main/lib/(?!Lib1|Lib2).*
Example scenarios
The following examples would trigger a build.
The change below triggers a build because these files match the pattern on tests.*:
//depot/main/tests/CONTRIUBTING.md //depot/main/tests/001/index.xml
The change below triggers a build because the file matches the pattern on tests.* which was probably intended to describe the tests/ directory. This is an example as to why you should be careful when using incomplete file paths.
//depot/main/tests.doc
The change below triggers a build because all of the files match the pattern looking for script files in build/:
//depot/main/build/rbs/deploy_server.rb //depot/main/build/deploy/deploy.bat //depot/main/build/Jenkinsfile
The following examples do not trigger a build.
The change below does not trigger a build because none of the files match the pattern looking for .cpp files under main/src:
//depot/main/src/howto.doc //depot/main/src/oldmain.c //depot/main/src/art/splash.bmp //depot/main/src/bt/funnelcake.php
The change below does not trigger a build because Lib1 is included in a negative lookahead, and is excluded:
//depot/main/lib/Lib1/build.xml