'Gradle multi-module build, make sure all module exists

In a multi module gradle build, the file settings.gralde contains:

include('lorem-api')
include('lorem-run')
include('lorem-gradle-plugin')
include('lorem-mock-impl')

I have noticed that, you nothing make sure that the modules exists.

What did I miss?


My current workaround is to add following in the build.gradle of the root project:

subprojects {
    if(!project.getProjectDir().exists()) {
        throw new GradleException("Project '" + project.getProjectDir() + "' does not exist, fix the 'settings.gradle' file")
    }
}

Is this the correct approach?

I consider it wired to copy paste this code in each of my projects.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source