Skip to content

[8.x] Fix outdated docs code samples and run the docs tests in CI - #899

Merged
mkurz merged 1 commit into
playframework:8.xfrom
mkurz:update-docs-samples-8.x
Oct 8, 2026
Merged

mkurz merged 1 commit into
playframework:8.xfrom
mkurz:update-docs-samples-8.x

Conversation

@mkurz

@mkurz mkurz commented Oct 8, 2026

Copy link
Copy Markdown
Member

Backport of #898 to 8.x. Unlike on main, this doesn't depend on the plugin fix (#895), because on 8.x the plugin still swallows the enhancer error for the missing models package.

The docs code samples were outdated and did not compile anymore:

  • MyServerConfigStartup used io.ebean.config.ServerConfig, which doesn't exist anymore. ServerConfigStartup.onStart takes a DatabaseBuilder now.
  • The transaction samples used the io.ebean.Ebean class, which doesn't exist anymore either. They now use io.ebean.DB, and the "traditional" sample uses a try-with-resources Transaction (DB has no commitTransaction()/endTransaction()). The text also mentioned TxRunnable and TxCallable, which are gone as well.

This went unnoticed, because CI only ran validateCode for the docs, which never compiles the samples. The docs job now also runs the docs tests, like e.g. twirl and play-slick do. For that, the docs build now enhances the models of its test sources (where the samples live); before, it only set Test / playEbeanModels, without actually wiring up the enhancement for Test.

Also, the docs now point out that a ServerConfigStartup has to be covered by an ebean. config line: Play Ebean registers the configured classes with Ebean explicitly, which disables Ebean's classpath scanning, so any other ServerConfigStartup gets silently ignored. That's what happened in #355.

Testing

cd docs && sbt ++2.13.x "validateCode; test" and ++3.x: all 4 JavaEbeanTest tests pass.

The ServerConfigStartup and transaction samples still used Ebean APIs
that have been removed in the meantime (ServerConfig and the Ebean
class), so they did not compile anymore. That went unnoticed, because
CI only validated the docs, but never compiled or ran the samples.
Their models did not even get enhanced, as the docs build did not
enhance its test sources.

Also point out that a ServerConfigStartup has to be covered by an
"ebean." config line, since Ebean does not scan the classpath for it
when used with Play Ebean.
@mergify

mergify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@mkurz
mkurz merged commit 8401214 into playframework:8.x Oct 8, 2026
21 checks passed
@mkurz
mkurz deleted the update-docs-samples-8.x branch October 8, 2026 11:03
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