gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 09:20:52 25 4
gpt4 key购买 nike

这次开始学一个Hiberantemvn compile编译报错:

[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);
}
}

如果我目前理解这门课的问题,但我真的无法理解缺少哪个符号。

谢谢你的时间。

最佳答案

问题解决了。这是 maven bug .您也可以使用 JDK 6 来解决这个问题。

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com