Hibernate Metamodel Generator 1.1.0.Final 现已可通过以下方式下载:从 JBoss Maven 仓库 或从 SourceForge。
查看 变更日志,显示三个问题,其中只有 METAGEN-45 值得提及。许多人报告了元模型类无法编译的问题,尤其是在使用注解处理器并与-s选项(指定放置生成的源文件的位置)一起使用时。这是通过 METAGEN-45 解决的。
我还想跟进有关如何在 最佳方式将处理器集成到 Maven 构建中 的问题。一如既往,有不止一种方式可以“剥皮猫”,以下是我的首选版本
... <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <compilerArgument>-proc:none</compilerArgument> </configuration> </plugin> <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <version>1.3.7</version> <executions> <execution> <id>process</id> <goals> <goal>process</goal> </goals> <phase>process-sources</phase> </execution> </executions> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-jpamodelgen</artifactId> <version>1.1.0.Final</version> <scope>compile</scope> </dependency> </dependencies> </plugin> ...
这个版本的好处是无需使用构建助手插件,更重要的是,处理器被定义为 maven-processor-plugin 的插件依赖项,而不是直接的项目依赖项。你可以在 Hibernate Metamodel Generator 的 在线文档 中找到这个和其他设置版本。
一如既往,欢迎反馈。如果你发现了一个错误,请确保在 METAGEN 中报告。
--Hardy