Getting error after upgrading from 3.5 to 5.0 gradle version - "build.gradle' is not part of the build defined by settings file "

Getting error below error after upgrading from 3.5 to 5.0 gradle version

21:28:29 11:58:29.861 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
21:28:29 11:58:29.861 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
21:28:29 11:58:29.861 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
21:28:29 11:58:29.861 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file '/home/jenkins/workspace/tcp/features/v2.1.30/tcp121212.gradleUpgrade/sip/tools/wiut/build.gradle' is not part of the build defined by settings file '/home/jenkins/workspace/tcp/features/v2.1.30/tcp121212.gradleUpgrade/sip/settings.gradle'. If this is an unrelated build, it must have its own settings file.
21:28:29 11:58:29.861 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
21:28:29 11:58:29.862 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
21:28:29 11:58:29.862 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
21:28:29 11:58:29.862 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
21:28:29 11:58:29.862 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
21:28:29 11:58:29.863 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.InvalidUserDataException: Build file '/home/jenkins/workspace/tcp/features/v2.1.30/tcp121212.gradleUpgrade/sip/tools/wiut/build.gradle' is not part of the build defined by settings file '/home/jenkins/workspace/tcp/features/v2.1.30/tcp121212.gradleUpgrade/sip/settings.gradle'. If this is an unrelated build, it must have its own settings file.
21:28:29 11:58:29.863 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at org.gradle.initialization.AbstractProjectSpec.selectProject(AbstractProjectSpec.java:40)
21:28:29 11:58:29.863 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 	at

Generally, I recommend upgrading to latest 3.x version, then fix all deprecation warnings, then upgrade to latest 4.x version, then fix all deprecation warnings, then upgrade to the latest 5.x version, and so on.
This most often makes a much more smooth upgrade experience, as only in a major update deprecated things are removed, but there they are.

And also always consider the release notes and upgrade notes like Upgrading your build from Gradle 4.x to 5.0 which also tell you the change that you are hitting right now.

Every Gradle build needs to have a settings script.
In your case the project within sip/tools/wiut is not part of the build defined in sip/settings.gradle which is the closest settings script found.
So the build fails.
If the project in wiut is actually part of the multi-project build defined in sip, you need to add it.
If it is a standalone build not related to that build, you need to have an own settings script for it.

Thanks a lot. Will implement your suggestions.

1 Like