One of the subprojects (A) in my project does not build when the project is built. This subproject has dependendencies on others, but no other subprojects depend on it (as soon as I change this A builds). This subproject A is in the settings.gradle and builds fine in itself.
How can I achieve building this subproject together with the root project?
‘Project.dependsOn’ is deprecated. It’s important to understand that Gradle always executes tasks, not projects. Hence execution dependencies are also between tasks. If subproject ‘B’ does not “execute”, then it just means that none of its tasks are required for this particular build invocation. For example, maybe you typed ‘gradle build’ and subproject ‘B’ does not have a ‘build’ task.
This subproject part of the project as an autonome service. What to do then? As a quick hack I made one of the subprojects to depend on A, but there must be a more elegant solution.
If the project has no ‘build’ task, then you should add one. Then running ‘gradle build’ from the top will also run that task (and its task dependencies).