Well not a very sophisticated solution, but I have a custom plugin in which I added a condition to add plugin for only specific modules. After that when I run the command `./gradlew dokkaHtmlMultiModule`, it creates documentation for only those modules.