Skip to content

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

Merged
rjayasinghe merged 5 commits into
mainfrom
extend-java-plugin-conventions
Oct 30, 2026
Merged

rjayasinghe merged 5 commits 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. :)

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I posted two inline comments on issues that could mislead readers: an outdated CAP Java version example and a Java snippet that would not compile as shown. The rest of the added guide content looks broadly consistent with the existing page structure and intent.

PR Bot Information

Version: 1.31.30

Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
@hyperspace-pr-bot hyperspace-pr-bot Bot deleted a comment from renejeglinsky Sep 11, 2026
Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
Comment thread java/building-plugins.md Resolved
Co-authored-by: hyperspace-pr-bot[bot] <209611008+hyperspace-pr-bot[bot]@users.noreply.github.com>
@rjayasinghe

Copy link
Copy Markdown
Contributor Author

Internal fragment for the SAP-specific repo hygiene details extracted from this PR: https://github.tools.sap/cap/docs/pull/2737

- Use {{ versions.java_services }} instead of hardcoded CAP Java version
- Fix undefined `runtime` variable; use configurer.getCdsRuntime()
- Add missing eventHandlers() registration alongside services()
- Mention that generated service interfaces can be used when the plugin compiles CDS
- Move local integration-test setup into Configuration & Enablement as a core feature
- Strip SAP-internal repo hygiene details (Artifactory, Black Duck) into internal fragment
  via anchor #building-plugins-repo-hygiene-internal (see cap/docs#2737)
@rjayasinghe
rjayasinghe requested a review from Akatuoro October 29, 2026 15:05
Comment thread java/building-plugins.md Resolved
@rjayasinghe
rjayasinghe added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 1fb0260 Oct 30, 2026
4 checks passed
@rjayasinghe
rjayasinghe deleted the extend-java-plugin-conventions branch October 30, 2026 08:23
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.

2 participants