我正在尝试使用hibernate-jpamodelgen
Play Framework 中的库自动生成元模型类。
我的build.sbt
文件是这样的:
libraryDependencies ++= Seq(
javaCore,
// filters,
cache,
"org.springframework" % "spring-context" % "4.0.4.RELEASE",
"org.springframework" % "spring-orm" % "4.0.4.RELEASE",
"org.springframework" % "spring-jdbc" % "4.0.4.RELEASE",
"org.springframework" % "spring-tx" % "4.0.4.RELEASE",
"org.springframework" % "spring-expression" % "4.0.4.RELEASE",
"org.springframework" % "spring-aop" % "4.0.4.RELEASE",
"org.springframework" % "spring-test" % "4.0.4.RELEASE" % "test",
"org.hibernate" % "hibernate-entitymanager" % "4.3.5.Final",
"org.hibernate" % "hibernate-jpamodelgen" % "4.3.5.Final",
"cglib" % "cglib" % "2.2.2"
)
javaOptions ++= Seq("-Xmx512M", "-Xmx2048M", "-XX:MaxPermSize=2048M")
//for auto generating jpa model metadata
javacOptions ++= Seq("-s", "app")
虽然hibernate-jpamodelgen
存在,但所有元模型文件均已正确创建,但项目编译失败并出现以下错误:
[error] Note: Hibernate JPA 2 Static-Metamodel Generator 4.3.5.Final
[error] An exception has occurred in the compiler (1.8.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and th
e following diagnostic in your report. Thank you.
[error] java.lang.IllegalStateException: endPosTable already set
[error] at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
[error] at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)
[error] at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:670)
[error] at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:953)
[error] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.<init>(JavacProcessingEnvironment.java:892)
[error] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(JavacProcessingEnvironment.java:921)
[error] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1187)
[error] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1173)
[error] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:859)
[error] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[error] at com.sun.tools.javac.main.Main.compile(Main.java:381)
[error] at com.sun.tools.javac.main.Main.compile(Main.java:370)
[error] at com.sun.tools.javac.main.Main.compile(Main.java:361)
[error] at com.sun.tools.javac.Main.compile(Main.java:56)
[error] at com.sun.tools.javac.Main.main(Main.java:42)
[error] (compile:compile) javac returned nonzero exit code
更新:JAVA 编译器 7 中存在此错误