我是Maven的新手(以及hibernate的人),但想同时学习两者。我从hibernate.org下载了一个示例项目,现在尝试使用maven进行编译,但出现以下错误:
[INFO]扫描项目…下载:http : //repo1.maven.org/maven2/org/hibernate/hibernate- parent/3.5.2- Final / hibernate-parent-3.5.2-Final.pom [INFO] ]无法在资源库中央(http://repo1.maven.org/maven2)中找到资源“ org.hibernate:hibernate-parent:pom:3.5.2-Final” [INFO] --------- [ERROR]致命错误[INFO] ----------------------------- ------------------------------------------- [INFO]建立POM时出错(可能不是该项目的POM)。 项目ID:org.hibernate:hibernate-tutorials:pom:null 原因:找不到父项目:项目的org.hibernate:hibernate-parent:org.hibe rnate:项目的org.hibernate:hibernate-tutorials:pom:null [INFO] ----------------------------------------------- [INFO]跟踪org.apache.maven.reactor.MavenExecutionException:找不到父项:org.hibern ate:hibernate-项目的父对象:项目的org.hibernate:hibernate-tutorials:pom:null org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)的项目org.hibernate:hibernate- tutorials:pom:null。在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)在org.apache.maven.cli.MavenCli.main(MavenCli.java:362)在org.apache.maven的maven.DefaultMaven.doExecute(DefaultMaven.java:272) .apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6 0)位于sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)位于sun.reflect.NativeMethodAccessorImpl。org.codehaus.classworlds.Launcher的java.lang.reflect.Method.invoke(Method.java:597)处的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)处的invoke(NativeMethodAccessorImpl.java:39)。 org.codehaus.classworlds的launchEnhanced(Launcher.java:315).org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)的launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) 由以下原因引起:org.apache.maven.project.ProjectBuildingException:找不到父项:项目的org.hibernate:hibernate- parent:org.hibernate:hibernate-tutorials:pom:null for project org.hibernate:hibernate- tutorials:pom:在org.apache.maven.project的org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:823)的org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1396)处为null。 org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200)的org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)的DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:508) .apache.maven.DefaultMaven。在org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)的collectProjects(DefaultMaven.java:487)… 12更多原因:org.apache.maven.project.ProjectBuildingException:POM’org.hibernate:hibernate -parent’在存储库中找不到:无法从任何存储库下载工件 org.hibernate:hibernate-parent:pom:3.5.2-Final 从指定的远程存储库中:中央(http://repo1.maven.org/maven2) 适用于org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo位置(DefaultMavenProjectBuilder.java:605)的项目org.hibernate:hibernate- parent(位于org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1392))。 .. 18更多原因:org.apache.maven.artifact.resolver.ArtifactNotFoundException:无法从任何存储库下载工件 org.hibernate:hibernate-parent:pom:3.5.2-Final 从指定的远程存储库中:中央(http://repo1.maven.org/maven2) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:90)的faultArtifactResolver.java:228)org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo位置(DefaultMavenProjectBuilder.java:558)的FaultArtifactResolver.java:90).. 。19更多原因:org.apache.maven.wagon.ResourceDoesNotExistException:无法从组织中org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:404)的任何存储库中删除工件。 apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:216)…还有21个
[INFO]扫描项目…下载:http : //repo1.maven.org/maven2/org/hibernate/hibernate- parent/3.5.2- Final / hibernate-parent-3.5.2-Final.pom [INFO] ]无法在资源库中央(http://repo1.maven.org/maven2)中找到资源“ org.hibernate:hibernate-parent:pom:3.5.2-Final” [INFO] ---------
[ERROR]致命错误[INFO] ----------------------------- ------------------------------------------- [INFO]建立POM时出错(可能不是该项目的POM)。
项目ID:org.hibernate:hibernate-tutorials:pom:null
原因:找不到父项目:项目的org.hibernate:hibernate-parent:org.hibe rnate:项目的org.hibernate:hibernate-tutorials:pom:null
[INFO]跟踪org.apache.maven.reactor.MavenExecutionException:找不到父项:org.hibern ate:hibernate-项目的父对象:项目的org.hibernate:hibernate-tutorials:pom:null org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)的项目org.hibernate:hibernate- tutorials:pom:null。在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)在org.apache.maven.cli.MavenCli.main(MavenCli.java:362)在org.apache.maven的maven.DefaultMaven.doExecute(DefaultMaven.java:272) .apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6 0)位于sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)位于sun.reflect.NativeMethodAccessorImpl。org.codehaus.classworlds.Launcher的java.lang.reflect.Method.invoke(Method.java:597)处的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)处的invoke(NativeMethodAccessorImpl.java:39)。 org.codehaus.classworlds的launchEnhanced(Launcher.java:315).org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)的launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
由以下原因引起:org.apache.maven.project.ProjectBuildingException:找不到父项:项目的org.hibernate:hibernate- parent:org.hibernate:hibernate-tutorials:pom:null for project org.hibernate:hibernate- tutorials:pom:在org.apache.maven.project的org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def aultMavenProjectBuilder.java:823)的org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1396)处为null。 org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave nProjectBuilder.java:200)的org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)的DefaultMavenProjectBuilder.buildFromSourceFi leInternal(DefaultMavenProjectBuilder.java:508) .apache.maven.DefaultMaven。在org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)的collectProjects(DefaultMaven.java:487)… 12更多原因:org.apache.maven.project.ProjectBuildingException:POM’org.hibernate:hibernate -parent’在存储库中找不到:无法从任何存储库下载工件
org.hibernate:hibernate-parent:pom:3.5.2-Final
从指定的远程存储库中:中央(http://repo1.maven.org/maven2)
适用于org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo位置(DefaultMavenProjectBuilder.java:605)的项目org.hibernate:hibernate- parent(位于org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D efaultMavenProjectBuilder.java:1392))。 .. 18更多原因:org.apache.maven.artifact.resolver.ArtifactNotFoundException:无法从任何存储库下载工件
at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:90)的faultArtifactResolver.java:228)org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo位置(DefaultMavenProjectBuilder.java:558)的FaultArtifactResolver.java:90).. 。19更多原因:org.apache.maven.wagon.ResourceDoesNotExistException:无法从组织中org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(Def aultWagonManager.java:404)的任何存储库中删除工件。 apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(De faultArtifactResolver.java:216)…还有21个
看起来它正在尝试从网上下载库?我不能在本地驱动器上提供我的示例项目所需的所有jars吗?首先,有什么快速解决我的问题的方法吗?还是我应该在开始学习Maven并进行详细hibernate之后?
Hibernate 3.5.2-Final在Maven中央存储库中不可用,但在JBoss存储库中可用。因此,将以下内容添加到您pom.xml(或您的settings.xml)中:
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>