Skip to content

java(plugins): extend building-plugins guide with ecosystem conventions - #2870

Open
rjayasinghe wants to merge 1 commit into
mainfrom
extend-java-plugin-conventions
Open

java(plugins): extend building-plugins guide with ecosystem conventions#2870
rjayasinghe wants to merge 1 commit into
mainfrom
extend-java-plugin-conventions

Conversation

@rjayasinghe

Copy link
Copy Markdown
Contributor

Summary

  • Adds a comprehensive Plugin Conventions & Reference Implementations section to java/building-plugins.md, derived from an analysis of the real plugins in the cap-java GitHub org (attachments, notifications, ord, event-hub, advanced-event-mesh, auditlog-ng, cds-ai, print, console, n8n, and the plugin-template-emoji skeleton).
  • Adds a groupId caveat clarifying that the cap-java example repos use com.sap.cds as SAP-owned artifacts — the external-plugin rule still stands.
  • Adds a one-paragraph ecosystem-norm note near the existing ServiceLoader-vs-Spring decision, with a forward link to the new Configuration & Enablement subsection.

New section covers

Subsection What it documents
Reference Plugins Table: pattern → living cap-java example repo
Recommended Project Layout Root aggregator + cds-feature-<x> module (+ optional integration-tests, coverage-report)
Maven Skeleton ${revision} + flatten, cds-services-bom import, versionless cds-services-api, cds-maven-plugin pin, package.json companion
Choosing a Registration Hook Decision matrix over CdsRuntimeConfiguration hooks + when to use Spring AutoConfiguration
Custom Services & Event Contexts Service interface + DEFAULT_NAME + EventContext subtype pattern
Configuration & Enablement Binding-driven mock-vs-productive switch; no cds.<feature>.enabled convention; Spring conditional alternative
Testing a Plugin Unit tests with cds-services-impl (test scope); dedicated integration-tests app module; CDS mock handlers
Repository Hygiene REUSE/Apache-2.0, shared CI actions, Maven Central publishing

All existing anchors (#service-loader, #spring-autoconfiguration, #protocol-adapter, #reference-the-new-cds-model-in-an-existing-cap-java-project) are preserved.

Test plan

  • Run the VitePress dev server (npm run docs:dev from repo root) and open /java/building-plugins — confirm new section renders with no parse errors
  • Verify all inbound anchor links still resolve: #service-loader, #spring-autoconfiguration, #protocol-adapter (linked from plugins/index.md, developing-applications/building.md, change-tracking.md)
  • Click through the github.com/cap-java/<repo> links in the reference table to confirm all repos exist
  • Run the repo's markdown lint / link-check if configured

Adds a "Plugin Conventions & Reference Implementations" section to
building-plugins.md, grounded in an analysis of the real plugins in the
cap-java GitHub org (attachments, notifications, ord, event-hub,
advanced-event-mesh, auditlog-ng, cds-ai, print, console, n8n, and the
plugin-template-emoji skeleton).

The new section covers:
- Reference plugin table linking each pattern to a living example
- Recommended multi-module Maven project layout
- Maven skeleton: ${revision} + flatten-maven-plugin, cds-services-bom
  import, versionless cds-services-api, cds-maven-plugin pinning,
  and a package.json companion for hermetic cds-dk builds
- CdsRuntimeConfiguration hook decision matrix (environment / services /
  eventHandlers / providers / order, with when-to-use and reference repo)
- Spring AutoConfiguration as the alternative when typed
  @ConfigurationProperties / @ConditionalOn… wiring is needed
- Custom Service interface + DEFAULT_NAME + EventContext pattern
- Configuration & enablement: binding-driven mock-vs-productive handler
  switching; no cds.<feature>.enabled convention
- Testing: cds-services-impl (test scope) for unit tests, a dedicated
  integration-tests app module, CDS mock handlers for external services
- Repository hygiene: REUSE/Apache-2.0, CI workflows, Maven Central publishing

Also adds two small in-place edits:
- groupId caveat clarifying that cap-java example repos use com.sap.cds
  as SAP-owned artifacts; the external-plugin rule still stands
- Ecosystem norm note pointing from the ServiceLoader-vs-Spring decision
  to the new Configuration & Enablement subsection
@rjayasinghe

Copy link
Copy Markdown
Contributor Author

@Akatuoro I asked Claude to reverse-engineer some information on how to build CAP Java plugins. Let me know what you think about it. :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant