Repository navigation
Fix outdated docs code samples and run the docs tests in CI - #898
Merged
Merged
Conversation
The sbt plugin passed the configured models as they are to Ebean's enhancer, which treats every entry as a package directory. So single classes (e.g. "models.Task", as shown in the docs) and packages without compiled classes (e.g. not existing yet, or provided by a dependency) made it throw. Up to the sbt 2 cross build, the plugin swallowed that error, which also skipped all following entries, so entities silently stayed unenhanced and the application failed at runtime. Since then, compilation fails. Now single classes get enhanced via their package and packages without compiled classes get skipped.
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.
This was referenced Oct 8, 2026
playEbeanModels can also contain package names without a ".*" suffix,
e.g. Seq("models"), which Ebean's enhancer handles just like "models.*".
However, the previous commit took them for single classes and enhanced
their parent package instead, which for "models" is the whole classes
directory.
Now only entries that are no package with compiled classes are treated
as single classes.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requires #895: without it the docs project doesn't compile on
main(it has nomodelspackage), so this PR includes its commits. Please merge #895 first.The docs code samples were outdated and did not compile anymore:
MyServerConfigStartupusedio.ebean.config.ServerConfig, which doesn't exist anymore.ServerConfigStartup.onStarttakes aDatabaseBuildernow.io.ebean.Ebeanclass, which doesn't exist anymore either. They now useio.ebean.DB, and the "traditional" sample uses a try-with-resourcesTransaction(DBhas nocommitTransaction()/endTransaction()). The text also mentionedTxRunnableandTxCallable, which are gone as well.This went unnoticed, because CI only ran
validateCodefor 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 setTest / playEbeanModels, without actually wiring up the enhancement forTest.Also, the docs now point out that a
ServerConfigStartuphas to be covered by anebean.config line: Play Ebean registers the configured classes with Ebean explicitly, which disables Ebean's classpath scanning, so any otherServerConfigStartupgets silently ignored. That's what happened in #355.Testing
cd docs && sbt "validateCode; test": all 4JavaEbeanTesttests pass.Backports: #899 (
8.x), #900 (7.x)