The name 'aaa/bbb' contains at least one of the following characters: [ , /, \, :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be removed in Gradle 5.0

Now that the use of / is removed and results in an error, is there anyway to exclude the directory which contains subprojects from being treated as a project module themselves?
This (old) thread had suggested the use of / for that purpose.

I know there a way to set projectDir for the projects in the settings.gradle, but that seems to make the file unnecessarily complex if we have many non-module directories containing subprojects.