Skip to content

Comments

feat: publish Groovydoc Enhancer Plugin for use in end-user Grails apps#15430

Draft
jamesfredley wants to merge 2 commits intofix/groovydoc-java-versionfrom
feat/publish-groovydoc-plugin
Draft

feat: publish Groovydoc Enhancer Plugin for use in end-user Grails apps#15430
jamesfredley wants to merge 2 commits intofix/groovydoc-java-versionfrom
feat/publish-groovydoc-plugin

Conversation

@jamesfredley
Copy link
Contributor

Summary

Potential path to allow end-user Grails applications to use modern Java features (17+) and still generate accurate Groovydoc documentation.

Gradle's built-in Groovydoc task does not expose the javaVersion parameter (added in Groovy 4.0.27 via GROOVY-11668), so projects using Java 17+ features (sealed classes, records, pattern matching, text blocks, etc.) fail to generate Groovydoc. This PR publishes the GroovydocEnhancerPlugin (from #15420) as a standalone Gradle plugin that end-user Grails applications can consume.

Changes

New Published Module: grails-gradle-groovydoc

  • Maven coordinate: org.apache.grails.gradle:grails-gradle-groovydoc
  • Plugin ID: org.apache.grails.gradle.groovydoc
  • Located in grails-gradle/groovydoc/ following the existing grails-gradle subproject pattern
  • Automatically included in grails-gradle-bom (subproject auto-inclusion)
  • Manually added to grails-bom via gradleBuildProjects map for end-user app BOM resolution

Forge Integration (DefaultFeature)

  • New GroovydocEnhancer feature class applied to all generated Grails applications by default
  • Adds grails-gradle-groovydoc as a buildscript classpath dependency (version managed by grails-bom)
  • Applies org.apache.grails.gradle.groovydoc plugin via apply plugin

Profile Integration

  • Updated base/profile.yml to include the plugin for grails CLI-based app generation
  • Both forge and profile paths now generate apps with Groovydoc enhancer support

Build-Logic

  • build-logic/ retains its own copy of the plugin for the framework build itself (bootstrap constraint - build-logic cannot depend on grails-gradle artifacts without circular dependency)
  • The published grails-gradle-groovydoc module is the canonical version for end-user consumption

Architecture Note

There are two copies of the enhancer plugin:

  1. build-logic/plugins/ - convention plugin for building grails-core itself (unpublished, internal)
  2. grails-gradle/groovydoc/ - published plugin for end-user Grails apps

This duplication exists because build-logic is evaluated before grails-gradle builds, creating a bootstrap dependency that prevents build-logic from consuming the published artifact directly. Future work could explore composite build substitution or a shared source set to eliminate this duplication.

Testing

  • grails-gradle-groovydoc builds successfully standalone
  • grails-bom POM generation succeeds with the new artifact
  • grails-forge-core compiles with the new feature class
  • Code style checks pass

Depends On

Add grails-gradle-groovydoc as a published Gradle plugin module that
enables Grails applications using modern Java features (17+) to generate
accurate Groovydoc documentation. Without this plugin, Groovydoc fails
to parse Java sources using sealed classes, records, pattern matching,
and other post-Java 11 language features.

Changes:
- New module grails-gradle/groovydoc with GroovydocEnhancerPlugin
  published as org.apache.grails.gradle:grails-gradle-groovydoc
  with plugin ID org.apache.grails.gradle.groovydoc
- Forge DefaultFeature adds the plugin to all generated Grails apps
- Profile base/profile.yml applies the plugin via grails CLI generation
- grails-bom updated with the new artifact for BOM version management
- build-logic retains its own copy for the framework build (bootstrap)

Assisted-by: Claude Code <Claude@Claude.ai>
@jamesfredley
Copy link
Contributor Author

A Third "commons" build appears to be the only way to remove the duplication.

@jamesfredley
Copy link
Contributor Author

Or moving it to a separate repo, as we have done with publishing.

@jdaugherty
Copy link
Contributor

In order to publish this, its going to have to go to a separate repository...

@jamesfredley
Copy link
Contributor Author

@jdaugherty I will add that to agenda for the meeting, next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants