如何在罐子中增强ebean模型 [英] how to enhance ebean models in a jar
问题描述
我有这样的要求,以排除
项目的ebean模型,以便其他游戏项目可以重用它们。我考虑过创建一个仅包含模型的
子项目,但是那意味着我必须在依赖它的每个项目中复制
子项目,这对我来说还不够干。所以
然后我使用publishLocal创建了一个子项目的jar,所以现在主项目
就像build.sbt文件中的任何其他库一样包含了它。一切都能很好地编译
,但是当我运行主项目时,我得到了此异常
java.lang.IllegalStateException:Bean类module.models.User没有得到增强。
我如何确保jar中的模型得到增强?
i have this requirement to factor out the ebean models of a project so they can be reused by other play projects. i thought about creating a subproject containing only the models, but then that means i have to duplicate the subproject in every project that depends on it which isn't DRY enough to me. so then i created a jar of the subproject using publishLocal so the main project now just includes it like any other library in the build.sbt file. everything compiles well but when i run the main project i get this exception java.lang.IllegalStateException: Bean class module.models.User is not enhanced. how do i make sure the models in the jar are enhanced?
推荐答案
可能最好使用编译时间增强。例如,maven增强器。
Probably best to use compile time enhancement. For example, the maven enhancer.
引用: http://ebean-orm.github.io/docs/setup/enhancement#maven
<plugin>
<groupId>org.avaje.ebeanorm</groupId>
<artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
<version>4.8.1</version>
<executions>
<execution>
<id>main</id>
<phase>process-classes</phase>
<configuration>
<packages>org.example.domain.**,org.example.anotherdomain.**</packages>
<transformArgs>debug=1</transformArgs>
</configuration>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
这篇关于如何在罐子中增强ebean模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!