javac 8 error while metamodel generation (hibernate-jpamodelgen)

泪湿孤枕 提交于 2019-12-10 16:06:08

问题


I am trying to auto generate metamodel classes using hibernate-jpamodelgen library in Play Framework.

My build.sbt file is like this:

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")

While hibernate-jpamodelgen exists,all of metamodel files are created correctly but project compilation fails with following error:

[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

UPDATE: This error exists in JAVA compiler 7


回答1:


Its seems to be problem with that particular version of the compiler plugin. And its not because of jdk or hibernate.

Refer this: IllegalStateException in Hibernate metamodel generation with maven.




回答2:


I am facing the same with Maven 3.3.1 (3.0.1 was fine) and Java 1.8.0.40 when I use mvn package repeatedly. I'm used to solve this by mvn clean package. Maybe an alternative for your environment may help before they fix up?



来源:https://stackoverflow.com/questions/23905549/javac-8-error-while-metamodel-generation-hibernate-jpamodelgen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!