When I run the build.gradle above. the output appears to indicate that the sub-projects are being built. Problem is that they aren’t. The sub-projects are not being built when running the build.gradle in the parent project. It appears that Gradle doesn’t even care if the sub-projects even exist (I’ve tried to change the names in the settings.gradle file. It pretends to build the sup-projects, even though they don’t exist!)
Hope you can help me. This one is really getting the best of me!
I’ve tried to includeFlat instead of simply include, but the result is the same. The output “simulates” the projects being built, but not build is actually taking place. The output below is taken after deliberately making a compile error in my-lib - it cannot compile.
Renaming the sub-project references in settings.gradle to something that does not exist creates no error or warning - it simply changes the text on the output, pretending to compilt, test etc.
Runing the build.gradle script with eclipse argument (to set-up the Eclipse envirinment for the project), doesn’t seem to have any effect on the Eclipse set-up with respects to project dependencies.
As I said, the actual directory structure likely doesn’t match the configured one, and so all that Gradle sees is empty source directories, which it happily compiles. Perhaps post a tree view of the directory layout, including locations of ‘settings.gradle’ and ‘build.gradle’.
As the project directory structure is hierarchical, you’ll need to use ‘include’ rather than ‘includeFlat’. In case this doesn’t solve the problem, where are the source files located?
to the subprojects section of the parent project, and that made Gradle compile the sub projects, reporting errors and all. Shouldn’t this be the default path to the source files?
But!
When I try to clean build on the sub project my-lib, I get a lot of these errors:
org.springsource.ide.eclipse.gradle.core.InconsistenProjectHierarchyException: Gradle project hierarchy is inconsistent for 'my-lib'
at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.inconsistentProjectHierachy(ExceptionUtil.java:82)
at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.getCachedModel(GradleModelProvider.java:334)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:542)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:537)
at org.springsource.ide.eclipse.gradle.core.classpathcontainer.GradleClassPathContainer.getClasspathEntries(GradleClassPathContainer.java:136)
at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersSaveHelper.saveContainers(JavaModelManager.java:4144)
at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersSaveHelper.saveProjects(JavaModelManager.java:4211)
at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersSaveHelper.save(JavaModelManager.java:4052)
... (truncated)...
Same for sub project product…
What is this? The main project compiles, but the sub projects doesn’t?