java - hibernate 教程。 Maven 编译时出现 MojoFailureException

标签 java hibernate maven compiler-errors

这次开始学习一个Hiberantemvncompile有编译错误:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ hibernate-tutorial --
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ hibernate-tutorial ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Dokumente und Einstellungen\Ettling\tutorial-hibernate\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \Dokumente und Einstellungen\Ettling\tutorial-hibernate\src\main\java\org\hibernate\tutorial\util\HibernateUtil.java:[17,89] error: cannot find symbol
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.344s
[INFO] Finished at: Wed Jun 19 17:53:44 CEST 2013
[INFO] Final Memory: 8M/23M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project hibernate-tutorial: Compilation failure
[ERROR] \Dokumente und Einstellungen\Ettling\tutorial-hibernate\src\main\java\org\hibernate\tutorial\util\HibernateUtil.java:[17,89] error: cannot find symbol
[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/MAVE/MojoFailureException

而且我是 Maven 的新手,所以这对我来说有点困难。

HibernateUtil类代码

package org.hibernate.tutorial.util;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateUtil {

    public static final SessionFactory SESSION_FACTORY = buildSessionFactory();

    private static SessionFactory buildSessionFactory() throws HibernateException {
        Configuration configuration = new Configuration();
        configuration.configure();
        ServiceRegistry serviceRegistry =
                new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
        return configuration.buildSessionFactory(serviceRegistry);
    }
}

如果我目前理解这个类中的问题,但我真的不明白缺少哪个符号。

感谢您的宝贵时间。

最佳答案

问题已解决。 这是一个专家bug 。您也可以使用 JDK 6 来解决这个问题。

关于java - hibernate 教程。 Maven 编译时出现 MojoFailureException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17196281/

相关文章:

java - 更改jdk版本的问题

java - 在Eclipse项目中导入maven库和maven示例

java - Spring Boot 的 JHipster WAR Artifact 重命名为 JAR 无法运行

java - 我可以限制 ViewFlipper 在执行 AsyncTask 之前翻转吗?

java - 为什么不允许未签名的小程序创建自定义类加载器?

Spring Data Jpa通用投影findAll

java - hibernate hbm2java

java - 如何解析在html请求中发送的java中的javascript对象?

java - OpenGL 计算着色器无法在笔记本电脑上链接

java - 何时将 EntityManager.find() 与 EntityManager.getReference() 与 JPA 一起使用