gpt4 book ai didi

hibernate - 如何用maven编译hibernate项目?

转载 作者:行者123 更新时间:2023-12-04 22:48:52 26 4
gpt4 key购买 nike

我是 maven(以及 hibernate)的新手,但想同时学习两者。我已经从 hibernate.org 下载了一个示例项目,现在尝试使用 Maven 对其进行编译,但出现以下错误:

[INFO] Scanning for projects... Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate-parent/3.5.2- Final/hibernate-parent-3.5.2-Final.pom [INFO] Unable to find resource 'org.hibernate:hibernate-parent:pom:3.5.2-Final' in repository central (http://repo1.maven.org/maven2) [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM).

Project ID: org.hibernate:hibernate-tutorials:pom:null

Reason: Cannot find parent: org.hibernate:hibernate-parent for project: org.hibe rnate:hibernate-tutorials:pom:null for project org.hibernate:hibernate-tutorials :pom:null

[INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.hibern ate:hibernate-parent for project: org.hibernate:hibernate-tutorials:pom:null for project org.hibernate:hibernate-tutorials:pom:null at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6 0) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent : org.hibernate:hibernate-parent for project: org.hibernate:hibernate-tutorials: pom:null for project org.hibernate:hibernate-tutorials:pom:null at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1396) at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:823) at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:508) at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200) at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487) at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391) ... 12 more Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.hibernate :hibernate-parent' not found in repository: Unable to download the artifact from any repository

org.hibernate:hibernate-parent:pom:3.5.2-Final

from the specified remote repositories: central (http://repo1.maven.org/maven2)

for project org.hibernate:hibernate-parent at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:605) at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1392) ... 18 more Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository

org.hibernate:hibernate-parent:pom:3.5.2-Final

from the specified remote repositories: central (http://repo1.maven.org/maven2)

    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De

faultArtifactResolver.java:228) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:90) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo sitory(DefaultMavenProjectBuilder.java:558) ... 19 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to downl oad the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:404) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:216) ... 21 more

看起来它正在尝试从 Web 下载库?我不能在本地驱动器上提供示例项目所需的所有 jar 吗?首先,我的问题有什么快速解决方案吗?或者我应该在开始之前详细研究maven和hibernate?

最佳答案

Hibernate 3.5.2-Final 在 Maven central repository 中不可用但在 JBoss repository 中可用.因此,将以下内容添加到您的 pom.xml(或您的 settings.xml):

<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
...
</repositories>

另见

关于hibernate - 如何用maven编译hibernate项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2999077/

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