Until now I regularly postponed updating to a later version of ebean-gradle-plugin than 11.11.1, since it seemed to break the enhancement.
Now I finally got the time to narrow down the issue and discovered that my issue seems to be related to the gradle build cache.
It can be easily reproduced with the "example-gradle-kotlin" project:
In the root directory create a "gradle.properties" and add the line "org.gradle.caching=true"
Run ./gradlew clean test
On the first build it will still show the "ebean-enhance" messages:
On consecutive builds the enhancement isn't triggered anymore and a BeanNotEnhancedException is thrown :
Build cache is an incubating feature.
> Task :test FAILED
org.example.domain.CustomerTest > save STANDARD_OUT
10:59:30.752 [Test worker] INFO io.ebean.EbeanVersion - ebean version: 11.32.1
10:59:30.812 [Test worker] INFO i.e.config.properties.LoadContext - loaded properties from [application-test.yaml]
10:59:30.848 [ForkJoinPool.commonPool-worker-2] INFO io.ebean.test.config.platform.Config - Using jdbc settings - username:sa url:jdbc:h2:mem:mykt_app driver:org.h2.Driver
10:59:30.860 [Test worker] INFO i.e.t.c.provider.ProviderAutoConfig - for testing purposes a current user and tenant provider has been configured. Use io.ebean.test.UserContext to set current user and tenant in tests.
10:59:30.916 [Test worker] INFO i.e.datasource.pool.ConnectionPool - DataSourcePool [db] autoCommit[false] transIsolation[READ_COMMITTED] min[2] max[200]
10:59:31.077 [Test worker] INFO io.ebean.internal.DefaultContainer - DatabasePlatform name:db platform:h2
org.example.domain.CustomerTest > save FAILED
java.lang.ExceptionInInitializerError
at io.ebean.Model.db(Model.java:114)
at io.ebean.Model.save(Model.java:188)
at org.example.domain.CustomerTest.setup(CustomerTest.kt:39)
at org.example.domain.CustomerTest.save(CustomerTest.kt:14)
Caused by:
io.ebean.config.BeanNotEnhancedException: Bean class org.example.domain.OrderLine is not enhanced? Check packages specified in ebean.mf. If you are running in IDEA or Eclipse check that the enhancement plugin is installed. See https://ebean.io/docs/trouble-shooting#not-enhanced
If you run the build again with "./gradlew clean test --no-build-cache" the enhancement is triggered again and the tests pass:
The last version of the plugin where the enhancements are still working seems to be "11.12.1".
With any later version I get the enhancement exceptions.
Until now I regularly postponed updating to a later version of ebean-gradle-plugin than 11.11.1, since it seemed to break the enhancement. Now I finally got the time to narrow down the issue and discovered that my issue seems to be related to the gradle build cache.
It can be easily reproduced with the "example-gradle-kotlin" project:
On the first build it will still show the "ebean-enhance" messages:
On consecutive builds the enhancement isn't triggered anymore and a BeanNotEnhancedException is thrown :
If you run the build again with "./gradlew clean test --no-build-cache" the enhancement is triggered again and the tests pass:
The last version of the plugin where the enhancements are still working seems to be "11.12.1". With any later version I get the enhancement exceptions.