The solution is to use the -i flag. The best way to do this is to create a .conf file. For example, I have the following file defined as opengrok.conf :
OPENGROK_APP_SERVER=Tomcat OPENGROK_TOMCAT_BASE=/usr/local/Cellar/tomcat/8.0.21/libexec OPENGROK_SCAN_DEPTH=4 OPENGROK_VERBOSE=yes OPENGROK_PROGRESS=yes IGNORE_PATTERNS="-if:foo.txt -i *.bar d:target -id:.tox"
And start indexing using: OPENGROK_CONFIGURATION=opengrok.conf ./OpenGrok index $SRC_ROOT
It ignores indexing the foo.txt file, all files matching the *.bar pattern, and all files in directories named target or .tox .
Edit Credits: mrenaud , pcas
source share