【问题标题】:how to enhance ebean models in a jar如何在 jar 中增强 ebean 模型
【发布时间】:2015-11-24 10:33:14
【问题描述】:
我有这个要求来分解一个 ebean 模型
项目,以便它们可以被其他游戏项目重用。我想过创建一个
仅包含模型的子项目,但这意味着我必须复制
每个依赖它的项目中的子项目对我来说还不够干燥。所以
然后我使用publishLocal创建了一个子项目的jar,所以现在是主项目
就像在 build.sbt 文件中的任何其他库一样包含它。一切都编译得很好
但是当我运行主项目时,我得到了这个异常
java.lang.IllegalStateException:Bean 类 module.models.User 未增强。
如何确保 jar 中的模型得到增强?
【问题讨论】:
标签:
ebean
playframework-2.4
【解决方案1】:
可能最好使用编译时增强。例如,maven 增强器。
参考: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>