Skip to content

Modularize Gradle build into per-module build files - #11241

Merged
artembilan merged 1 commit into
spring-projects:mainfrom
cppwfs:GH-build-gradle-per-module
Aug 3, 2026
Merged

Modularize Gradle build into per-module build files#11241
artembilan merged 1 commit into
spring-projects:mainfrom
cppwfs:GH-build-gradle-per-module

Conversation

@cppwfs

@cppwfs cppwfs commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
  • Add a standalone build.gradle to all 42 spring-integration-* modules, each applying the shared conventions plus its own module-specific dependencies and plugin needs (protobuf for core/grpc, groovy plugin for the groovy module)
  • Remove all per-module project('...') {} blocks and the configure(javaProjects) {} block from root build.gradle, cutting it from 1155 to roughly 300 lines
  • Keep spring-integration-bom's configuration in root build.gradle since it is a java-platform aggregator, not a java-conventions consumer
  • Defer schemaZip and distZip's subproject sourceSets/jar access into gradle.projectsEvaluated to fix task-registration-order failures that surfaced once modules stopped being eagerly configured inline with root
  • Extract shared java/kotlin/checkstyle/publishing config from root build.gradle into buildSrc convention plugins (spring-integration.java-conventions and spring-integration.protobuf-conventions)
  • Implement convention plugins as Plugin classes that delegate to resource .gradle scripts, working around a Gradle 9.6.1 bug where the groovy-gradle-plugin precompiled-script adapter throws UnknownServiceException when the same plugin is applied to more than one project

@cppwfs cppwfs added this to the 7.2.0-M1 milestone Aug 3, 2026
@cppwfs
cppwfs requested a review from artembilan August 3, 2026 18:30
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't want anything in buildSrc.
This is exta code to support and a bit confusing.
But it looks like it is spreading dependency management.
Why configure(javaProjects) doesn't work for us?
I don't want any custom Gradle plugins.

@@ -0,0 +1,12 @@
plugins {
id 'spring-integration.java-conventions'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like this custom plugin helps enough.
We still have to copy/paste it every where.
May we just split root config per modules and leave everything common as is?

That claim about decreasing size is a bit not fair since we are introduce much more complexity into that buildSrc

- Extract each module's dependency and plugin configuration from
  the monolithic root `build.gradle` into a dedicated `build.gradle`
  file within its own module directory.
- Replace `configure(javaProjects)` with a `subprojects` block that
  skips `spring-integration-bom`.
- Keep shared configuration (compiler options, checkstyle,
  publishing, etc.) centralized in the root `build.gradle`.
- Simplify long-term maintenance by co-locating a module's build
  logic with its source rather than in one large shared file.
@cppwfs
cppwfs force-pushed the GH-build-gradle-per-module branch from cae14ee to bc7c165 Compare August 3, 2026 20:52
@cppwfs

cppwfs commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

I took a different tack and so I started from scratch. So there is only one commit.

@artembilan artembilan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!
Merging.
We can come back to any leftover concerns with new Gradle later on.

Thank you!

@artembilan
artembilan merged commit 516b010 into spring-projects:main Aug 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants