What is the propper way to specify entity packages with gradle plugin

24 views
Skip to first unread message

Peter

unread,
Oct 8, 2024, 7:25:06 PM10/8/24
to Ebean ORM
When enhancing using ebean-agent, I can use ebean.search.packages to specify which packages to search for entities. However when I switch to gradle plugin, this setting is either ignored or no longer works. I have found references to ebean.mf, but also notes that this is no longer necessary after 12.1.8 (https://ebean.io/docs/query/background/typesafe#enhancement, https://ebean.io/docs/trouble-shooting#npe-querybeans, https://ebean.io/docs/query/query-beans#enhancement - though these might be specifically refereeing to query-beans and not entity-beans) and broken links to documentation for the manifest (https://ebean.io/docs/configuration/manifest).

thank you

Peter

Rob Bygrave

unread,
Oct 8, 2024, 9:53:14 PM10/8/24
to eb...@googlegroups.com
Yes we are missing some documentation on that so I need to fix that.


We can put a src/main/resources/ebean.mf manifest file as a resource with content like:
```
entity-packages: my.some.mypackage; my.other;

```
This will then restrict the ebean-agent to only look at classes in these packages to enhance. Otherwise it will look at all the classes apart from ones in a blacklist that is defined at:

NB: make sure to include a empty line at the bottom of the manifest file 


Now an alternative answer is to NOT actually do anything and just let the ebean-agent look to enhance everything (that isn't automatically excluded via the IgnoreClassHelper). This is actually the expected default approach and I'm suggesting that today we no longer expect projects to look to specify entity-packages explicitly and limit the ebean-agent in that way. This is also partly because today most applications are using build time enhancement (so we are less concerned about reading classes that will not be enhanced from a performance perspective) and because anyone using query beans get an META-INF/ebean-generated-info.mf generated that contains the entity-packages specified there.

So yes we can explicitly specify the entity-packages, but my recommendation would be to not bother. 

Cheers, Rob.


--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/7c942c31-3d89-4a62-a9f2-b7ebe42e10d8n%40googlegroups.com.

Peter

unread,
Oct 8, 2024, 11:06:56 PM10/8/24
to Ebean ORM

I ended up using ebean.mf and it seems to have worked for gradle run tests and build, but Eclipse is still broken. Is the Eclipse enhancer plugin dead? I am not able to find current version anywhere and the /eclipse/update returns 404? Is the only way to get ebean working in eclipse to use the  -javaagent argument?

> Now an alternative answer is to NOT actually do anything and just let the ebean-agent look to enhance everything (that isn't automatically excluded via the IgnoreClassHelper).

This seems to only work when the entities are under the same package structure as the application. In my case the app is under my.some.package and the entities are under my.other.package. When I move entities to my.some.package, it enhances them.

Thank you
Peter
Reply all
Reply to author
Forward
0 new messages