编译错误" org.hibernate.annotations不存在"

时间:2014-06-19 17:19:53

标签: jhipster

我刚创建了一个应用程序,它开始工作正常。然后我生成了一个实体并重新启动它,现在我收到了这个错误。有什么建议吗?

我也想知道起始方法之间的区别是什么:

  1. mvn spring-boot:run

  2. grunt服务器

  3. 我得到前者的编译错误并且它启动但不允许我使用后者进行身份验证。我没有使用IDE。我只是从iTerm运行它。

    [INFO] Scanning for projects...
    [INFO]
    [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building jhipster 0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> spring-boot-maven-plugin:1.0.2.RELEASE:run (default-cli) @ jhipster >>>
    [INFO]
    [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-versions) @ jhipster ---
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jhipster ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 22 resources
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:copy (copy) @ jhipster ---
    [INFO] Configured Artifact: io.github.jhipster.loaded:agent:0.8:jar
    [INFO] Copying agent-0.8.jar to /Users/Dan/work/jhipster-mongo/spring_loaded/springloaded-jhipster.jar
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jhipster ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 80 source files to /Users/Dan/work/jhipster-mongo/target/classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] /Users/Dan/work/jhipster-mongo/src/main/java/com/dancancro/picker/domain/Decision.java:[7,33] package org.hibernate.annotations does not exist
    [ERROR] /Users/Dan/work/jhipster-mongo/src/main/java/com/dancancro/picker/domain/Decision.java:[8,33] package org.hibernate.annotations does not exist
    [INFO] 2 errors
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.603 s
    [INFO] Finished at: 2014-06-19T19:03:32+01:00
    [INFO] Final Memory: 28M/135M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jhipster: Compilation failure: Compilation failure:
    [ERROR] /Users/Dan/work/jhipster-mongo/src/main/java/com/dancancro/picker/domain/Decision.java:[7,33] package org.hibernate.annotations does not exist
    [ERROR] /Users/Dan/work/jhipster-mongo/src/main/java/com/dancancro/picker/domain/Decision.java:[8,33] package org.hibernate.annotations does not exist
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    

3 个答案:

答案 0 :(得分:0)

这是MongoDB的错误(使用Hibernate注释,但不是Hibernate - 不是一个简单的用例!)。 现在已经纠正了。

答案 1 :(得分:0)

hazelcast pom将hibernate视为“已提供” cf https://github.com/hazelcast/hazelcast/blob/3.2-fix-eacg/hazelcast-hibernate/hazelcast-hibernate4/pom.xml#L68

您需要添加hibernate依赖项

我还没有看到主树中的修复程序。 因此:https://github.com/jhipster/generator-jhipster/issues/604

答案 2 :(得分:0)

它只是意味着您的pom.xml文件不包含org.hibernate.annotations依赖项

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-annotations</artifactId>
  <version>3.5.6-Final</version>
</dependency>

复制&amp;将其粘贴到代码中的 pom.xml 文件中:<dependencies> </dependencies>