Java 工件丢失:org.hibernate:hibernate-entitymanager:jar:3.3.2.ga

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20058386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:46:03  来源:igfitidea点击:

artifact missing: org.hibernate:hibernate-entitymanager:jar:3.3.2.ga

javaspringhibernatemaven

提问by CodeMed

I am relatively new to Spring and maven, and am just revisiting both of them for the first time in a couple months. I am encountering the following error in pom.xml when I try to run code from this tutorial:

我对 Spring 和 maven 比较陌生,几个月后我才第一次重新访问它们。当我尝试运行本教程中的代码时,在 pom.xml 中遇到以下错误:

Missing artifact: org.hibernate:hibernate-entitymanager:jar:3.3.2.ga  

Does this mean that I have to download and install an additional jar? I am pretty sure that I downloaded hibernate with spring, and this is supported by the fact that the spring pet clinic sample application runs fine on my system when launched from eclipse on tomcat server.

这是否意味着我必须下载并安装一个额外的 jar?我很确定我下载了带有 spring 的 hibernate,这得到了以下事实的支持:spring pet Clinic 示例应用程序在我的系统上从 Eclipse 在 tomcat 服务器上启动时运行良好。

I have done google searches for this error message, and have tried many of the suggestions, but they have not fixed the problem on my machine. How can I get past this error message?

我已经针对此错误消息进行了 google 搜索,并尝试了许多建议,但他们并没有解决我机器上的问题。我怎样才能克服这个错误信息?



EDIT/ANSWER?

编辑/回答?

I dug into the directory structure of the project, and found another copy of pom.xml which did not throw the error. It actually used the syntax 3.3.2.ga, so I do not think that case was the problem. The new pom.xml file was located deep in the target/m2e-wtp/web-resources/META-INF/Maven/MavenWeb/MavenWeb/ subdirectory. When I moved this new pom.xml to the root directory, the error message went away, even though the syntax of the node was still:

我深入研究了项目的目录结构,发现了另一个没有抛出错误的 pom.xml 副本。它实际上使用了语法 3.3.2.ga,所以我不认为这种情况是问题所在。新的 pom.xml 文件位于 target/m2e-wtp/web-resources/META-INF/Maven/MavenWeb/MavenWeb/ 子目录的深处。当我将这个新的 pom.xml 移动到根目录时,错误消息消失了,即使节点的语法仍然是:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.3.2.ga</version>
</dependency>  

For the moment, this question is answered, at least until I try to run it later. Let me think about how to give credit for the work people did on this while still leaving the answer clear to people who find this on the search engines.

目前,这个问题得到了回答,至少在我稍后尝试运行它之前。让我想想如何赞扬人们在这方面所做的工作,同时仍然让那些在搜索引擎上找到这个问题的人清楚地知道答案。

回答by grepit

You may have downloaded the hibernate as you described but it may have been the incorrect version. Anyways, make sure you change pom.xml file, where you are defining hibernate-entitymanager to look like below lines. (because that's the exact version it will look for)

您可能已经按照您的描述下载了 hibernate,但它可能是不正确的版本。无论如何,请确保更改 pom.xml 文件,在其中定义 hibernate-entitymanager 看起来像下面几行。(因为这是它将寻找的确切版本)

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.3.2.GA</version>
</dependency>

回答by Ralph

Maven will download the required jars form the maven central repository automatically.

Maven 将自动从 Maven 中央存储库下载所需的 jar。

But I have not found org.hibernate:hibernate-entitymanager:jar:3.3.2.gaat maven centralbut instead one with Version 3.3.2.GAwith upper case GA! :

但是我还没有org.hibernate:hibernate-entitymanager:jar:3.3.2.gamaven central找到,而是一个3.3.2.GA带有大写 GA 的版本!:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-entitymanager</artifactId>
  <version>3.3.2.GA</version>
</dependency>


On windows you while have an other problem (because the windows file system does not distinguish between upper case and lower case file names): You will need to delete a directory:

在 Windows 上,您还有另一个问题(因为 Windows 文件系统不区分大小写文件名):您需要删除一个目录:

c:\documents\<yourName>\.m2\repository\org\hibernate\hibernate-entitymanager.3.2.ga\

delete this directory and the try again eclipse update maven dependencies.

删除此目录,然后重试 eclipse 更新 maven 依赖项。

回答by Michael

You need to set the default builder in your project to be maven.

您需要将项目中的默认构建器设置为 maven。

To do so, right click on your project and select Properties(or select the project and press the alt+enter keys on your keyboard)

为此,请右键单击您的项目并选择Properties(或选择项目并按键盘上的 alt+enter 键)

In the dialog, on the left, select Builders.

在对话框的左侧,选择Builders

On the right, select the Maven Project Builder, and using the Upbutton on the right advance it to the top of the list.

在右侧,选择Maven Project Builder,然后使用Up右侧的按钮将其移至列表顶部。

Click Okand you are done.

单击Ok即可完成。

EDIT:

编辑:

To fix the issue that you've described, you'll need to go to the root folder of your application. Find the following two files: .projectand .classpath

要解决您所描述的问题,您需要转到应用程序的根文件夹。找到以下两个文件:.project.classpath

You will need to edit them, so exit eclipse and back those files up.

您将需要编辑它们,因此退出 eclipse 并备份这些文件。

In .project, change the following lines:

在 中.project,更改以下几行:

  1. In the build command that relates to maven, change the value of the nametag to: org.eclipse.m2e.core.maven2Builder
  2. In nature, change it to: org.eclipse.m2e.core.maven2Nature
  1. 在maven相关的build命令中,将nametag的值改为:org.eclipse.m2e.core.maven2Builder
  2. 在 中nature,将其更改为:org.eclipse.m2e.core.maven2Nature

In .classpath, change the following lines:

在 中.classpath,更改以下几行:

  1. <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>to <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
  1. <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/><classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>

Hope it helps.

希望能帮助到你。