Java 在maven eclipse项目中找不到spring框架的标签库描述符

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

cannot find tag library descriptor for spring framework in maven eclipse project

javaeclipsespringmaven

提问by CodeMed

The following three lines at the top of documents.jsp throw "cannot find tag library descriptor for ..." errors in the spring framework application from this tutorial, which uses eclipse and maven:

本教程使用 eclipse 和 maven的 spring 框架应用程序中,documents.jsp 顶部的以下三行抛出“cannot find tag library descriptor for ...”错误:

<%@ taglib uri="http://www.springframework.org/tags"  prefix="spring"%>  
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  

My understanding is that the maven plugin for eclipse should manage the download of these libraries automatically, so I checked to make sure that the following are included in pom.xml:

我的理解是 eclipse 的 maven 插件应该自动管理这些库的下载,所以我检查以确保 pom.xml 中包含以下内容:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<properties>
  <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>  

So how do I fix my application to enable the required dependencies to be available? I want to avoid having to do it manually, because I was under the impression that maven should manage this. Is there some way that I need to manipulate maven? The application apparently worked when it was tested for the tutorial.

那么如何修复我的应用程序以使所需的依赖项可用?我想避免必须手动执行此操作,因为我的印象是 maven 应该管理此操作。有什么方法可以让我操作 Maven 吗?该应用程序在针对本教程进行测试时显然有效。

EDIT:

编辑:

I converted my eclipse project to a maven project and then right clicked on the eclipse project and chose Maven>Update Project. This did nothing to fix the error that still remains from my original posting above, but it also added the following new error:

我将我的 eclipse 项目转换为 maven 项目,然后右键单击 eclipse 项目并选择 Maven>Update Project。这并没有解决我上面原始帖子中仍然存在的错误,但它也添加了以下新错误:

Missing artifact javax.transaction:jta:jar:1.0.1B  

Which is now thrown by the second line of pom.xml, which reads as follows:

现在被 pom.xml 的第二行抛出,内容如下:

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

SECOND EDIT:

第二次编辑:

When I try to run as..run on server, I get the following error in a dialog box:

当我尝试在服务器上运行 as..run 时,我在对话框中收到以下错误:

'Publishing to Tomcat v7.0 Server at localhost...' has encountered a problem.

Error reading file D:\mypath\.m2\repository\javax\transaction\jta.0.1B\jta-1.0.1B.jar
D:\mypath\.m2\repository\javax\transaction\jta.0.1B\jta-1.0.1B.jar (The system cannot find the file specified)  

I even set "update Maven projects on startup" in Window>preferences>Maven and then closed and restarted eclipse, but the problem persists.

我什至在窗口>首选项>Maven中设置“启动时更新Maven项目”,然后关闭并重新启动eclipse,但问题仍然存在。

回答by Ivan Rodrigues

I passed for this same issue where I receive the message

我在收到消息的地方通过了同样的问题

"cannot find tag library descriptor for ..."

"cannot find tag library descriptor for ..."

I solved putting spring-webmvc inside of my war. This error happened when spring-webmvc were in server folder.

我解决了将 spring-webmvc 放入我的战争中的问题。当 spring-webmvc 在服务器文件夹中时发生此错误。

I suggest you see how do you're packaging your war.

我建议你看看你是如何包装你的战争的。