Java 容器“Maven Dependencies”引用了不存在的库 - STS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21274732/
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-13 07:48:26  来源:igfitidea点击:

The container 'Maven Dependencies' references non existing library - STS

javaeclipsespringmaven

提问by Pablo Fallas

I'm using win8 previously I had been running Eclipse Juno on my pc but from now on I wanted to start using STS, I am getting the below error as soon as I create a new project. I deleted my .m2 folder and everything related to Eclipse in order to start over from scratch still didn't work, I've ran out of ideas. Any advice???

我之前使用的是 win8,我一直在我的电脑上运行 Eclipse Juno,但从现在开始我想开始使用 STS,一旦我创建一个新项目,我就会收到以下错误。我删除了我的 .m2 文件夹和与 Eclipse 相关的所有内容,以便从头开始仍然不起作用,我已经没有想法了。有什么建议???

Can not find the tag library descriptor for "springframework.org/tags" index.jsp /app/src/main/webapp line 6 JSP Problem

找不到“springframework.org/tags”的标签库描述符 index.jsp /app/src/main/webapp line 6 JSP 问题

The container 'Maven Dependencies' references non existing library 'C:\Users\Pablo.m2\repository\org\springframework\spring-webmvc\3.2.3.RELEASE\spring-webmvc-3.2.3.RELEASE.jar' app Build path Build Path Problem

容器“Maven Dependencies”引用非现有库“C:\Users\Pablo.m2\repository\org\springframework\spring-webmvc\3.2.3.RELEASE\spring-webmvc-3.2.3.RELEASE.jar”应用程序构建路径构建路径问题

The project cannot be built until build path errors are resolved app Unknown Java Problem

在解决构建路径错误之前无法构建项目 app Unknown Java Problem

ArtifactTransferException: Failure to transfer antlr:antlr:jar:2.7.7 from http://repo.maven.apache.org/maven2was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact antlr:antlr:jar:2.7.7 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000 pom.xml /app line 1 Maven Dependency Problem

ArtifactTransferException: failed to transfer antlr:antlr:jar:2.7.7 from http://repo.maven.apache.org/maven2已缓存在本地存储库中,直到central 的更新间隔已过或更新后才会重新尝试解析被迫。原始错误:无法将工件 antlr:antlr:jar:2.7.7 from/to central ( http://repo.maven.apache.org/maven2):60000pom.xml /app line 1 Maven Dependency 后未收到响应问题

22 more errors like this for each of my dependencies...

对于我的每个依赖项,还有 22 个这样的错误...

Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found [config set: app/web-context] mvc-config.xml /app/src/main/webapp/WEB-INF line 16 Spring Beans Problem

找不到类 'org.springframework.web.servlet.view.InternalResourceViewResolver' [配置集:app/web-context] mvc-config.xml /app/src/main/webapp/WEB-INF 第 16 行 Spring Beans 问题

采纳答案by Alexis Dufrenoy

So I get you are using Eclipse with the M2E plugin. Try to update your Maven configuration : In the Project Explorer, right-click on the project, Maven -> Update project.

所以我知道您正在使用带有 M2E 插件的 Eclipse。尝试更新您的 Maven 配置:在项目资源管理器中,右键单击项目,Maven -> 更新项目。

If the problem still remains, try to clean your project: right-click on your pom.xml, Run as -> Maven build (the second one). Enter "clean package" in the Goals fields. Check the Skip Tests box. Click on the Run button.

如果问题仍然存在,请尝试清理您的项目:右键单击您的 pom.xml,Run as -> Maven build(第二个)。在目标字段中输入“clean package”。选中跳过测试框。单击运行按钮。

Edit: For your new problem, you need to add Spring MVC to your pom.xml. Add something like the following:

编辑:对于您的新问题,您需要将 Spring MVC 添加到您的 pom.xml。添加如下内容:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.0.0.RELEASE</version>
</dependency>

Maybe you have to change the version to match the version of your Spring framework. Take a look here:

也许您必须更改版本以匹配您的 Spring 框架的版本。看看这里:

http://mvnrepository.com/artifact/org.springframework/spring-webmvc

http://mvnrepository.com/artifact/org.springframework/spring-webmvc

回答by Saket Mittal

I got the same problem and this is how i solved. :

我遇到了同样的问题,这就是我解决的方法。:

  1. Right click your Spring MVC project, choose Run As -> Maven install. Observe the output console to see the installation progress. After the installation is finished, you can continue to the next step.
  1. 右键单击您的 Spring MVC 项目,选择 Run As -> Maven install。观察输出控制台以查看安装进度。安装完成后,您可以继续下一步。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

  1. Right click your Spring MVC project, choose Maven -> Update Project.
  1. 右键单击您的 Spring MVC 项目,选择 Maven -> 更新项目。

enter image description here

在此处输入图片说明

  1. Choose your project and click OK. Wait until update process is finished.
  2. The error still yet, then do Project->Clean and then be sure you have selected our project directory and then do the follow Project->Build.
  1. 选择您的项目并单击确定。等待更新过程完成。
  2. 错误仍然存​​在,然后执行 Project->Clean 并确保您选择了我们的项目目录,然后执行以下 Project->Build。

回答by Leo Lee

I finally found my maven repo mirror is down. I changed to another one, problem solved.

我终于发现我的 Maven 回购镜像已关闭。我换了另一个,问题解决了。

回答by Mike Sallese

I'm a little late to the party but I'll give my two cents. I just resolved this issue after spending longer than I'd like on it. The above solutions didn't work for me and here's why:

我参加聚会有点晚了,但我会给我两分钱。在花费了比我想要的时间更长的时间之后,我才解决了这个问题。上述解决方案对我不起作用,原因如下:

there was a network issue when maven was downloading the required repositories so I actually didn't have the right jars. adding a -U to a maven clean install went and got them for me. So if the above solutions aren't working try this:

当 maven 下载所需的存储库时出现网络问题,所以我实际上没有正确的 jars。向 Maven 全新安装添加 -U 并为我获取了它们。因此,如果上述解决方案不起作用,请尝试以下操作:

  1. Right click on your project -> Choose Run as -> 5 Maven build...
  2. In the Goals field type "clean install -U" and select Run
  3. After that completes right click on your project again and choose Maven -> Update Project and click ok.
  1. 右键单击您的项目 -> 选择 Run as -> 5 Maven build...
  2. 在目标字段中输入“clean install -U”并选择运行
  3. 完成后再次右键单击您的项目并选择 Maven -> 更新项目并单击确定。

Hope it works for you.

希望对你有效。

回答by Mostafa

Although it's too late , But here is my experience .

虽然为时已晚,但这是我的经验。

Whenever you get your maven project from a source controller or just copying your project from one machine to another , you need to update the dependencies .

每当您从源控制器获取 Maven 项目或只是将项目从一台机器复制到另一台机器时,您都需要更新依赖项。

For this Right-click on Project on project explorer -> Maven -> Update Project.

为了这 Right-click on Project on project explorer -> Maven -> Update Project.

Please consider checking the "Force update of snapshot/releases"checkbox.

请考虑选中"Force update of snapshot/releases"复选框。

If you have not your dependencies in m2/repository then you need internet connection to get from the remote maven repository.

如果您在 m2/repository 中没有依赖项,那么您需要 Internet 连接才能从远程 maven 存储库获取。

In case you have get from the source controller and you have not any unit test , It's probably your test folder does not include in the source controller in the first place , so you don't have those in the new repository.so you need to create those folders manually.

如果您从源控制器获取并且没有任何单元测试,则可能是您的测试文件夹首先不包含在源控制器中,因此您在新存储库中没有这些文件夹。所以您需要手动创建这些文件夹。

I have had both these cases .

这两种情况我都遇到过。

回答by Kenny

Today I had this same problem with another jar. I tried multiple things people said on Stackoverflow, but nothing worked. Eventually I did this:

今天我在另一个罐子上遇到了同样的问题。我尝试了人们在 Stackoverflow 上所说的多种内容,但没有任何效果。最终我这样做了:

  1. Close eclipse and any project-app that is running.
  2. Delete the .m2 folder (Users --> [your_username] --> .m2). It's an invisible folder, make sure you are able to view invisible folders.
  3. Restarted Eclipse (I guess it works in other IDE too) and updated my project.
  1. 关闭 eclipse 和任何正在运行的项目应用程序。
  2. 删除 .m2 文件夹(用户 --> [your_username] --> .m2)。这是一个不可见的文件夹,请确保您能够查看不可见的文件夹。
  3. 重新启动 Eclipse(我猜它也适用于其他 IDE)并更新了我的项目。

Now it works again for me. Perhaps this solves the problem for someone else too.

现在它又对我有用了。也许这也解决了其他人的问题。

回答by KontrCode

I have solved it using "force update", pressing Alt+F5as it is mentioned in the following link.

我已经使用“强制更新”解决了这个问题,按下Alt+,F5正如以下链接中提到的那样。