--Environment - CentOS Linux release 7.6.1810 (Core) - find (GNU findutils) 4.5.11
-maxdepth
option to find$ find -type d -maxdepth 2
find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
.
./.settings
./src
./src/main
./src/test
./target
./target/classes
$
I translated the caution statement. It is not enough to specify the options in the order of strong desire to do.
Translation
find:warning:Non-optional arguments-After type-I specified the maxdepth option, but the position of the option is incorrect(-maxdepth affects the previously specified test and the later specified test.).. Specify the option before the other arguments.
Looking at how to use it, it says "Specify before other expressions".
$ find --help
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
...abridgement...
# normal options (always true, (Translation)Specified before other expressions):
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
...abridgement...
-maxdepth
before -type
No longer noticed
$ find -maxdepth 2 -type d
.
./.settings
./src
./src/main
./src/test
./target
./target/classes