问题描述
我正在寻找一种简单的方法来从Maven存储库中获取JSTL 1.2实现JAR,这听起来很简单,但实际上却很困难.
I'm looking for an easy way to fetch a JSTL 1.2 implementation JAR from a Maven repository, which sounds quite easy but in fact proves to be quite difficult.
我尝试了以下软件包:
javax.servlet : jstl : 1.2
通过 http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/jstl-1.2.jar
javax.servlet.jsp.jstl : jstl : 1.2
通过 http://download.java. net/maven/1/javax.servlet.jsp.jstl/jars/jstl-1.2.jar
这两个工件都应包含JSTL 1.2实现.但是,当我下载JAR并在其中一个JAR(其内容相同)中打开文件/META-INF/c.tld
时,标题显示:
Both these artifacts should contain the JSTL 1.2 implementation. However, when I download the JARs and open the file /META-INF/c.tld
within one of these JARs (their content is the same), the header shows:
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
...
这意味着该标记不是1.2而是1.1.为了进行比较,当我直接从 http://download.java.net/maven/glassfish/org/glassfish/web/jstl-impl/1.2/jstl-impl-1.2.jar c.tld
文件看起来正确:
This means that the tag isn't a 1.2 but a 1.1 tag. For comparison, when I download the JAR file directly from http://download.java.net/maven/glassfish/org/glassfish/web/jstl-impl/1.2/jstl-impl-1.2.jar the c.tld
file looks correct:
...
<description>JSTL 1.2 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.2</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
...
所以,问题是:为什么Maven存储库中包含错误版本(1.1而不是1.2)的JAR(或更具体地说是tld声明),我如何通过Maven获取正确的JSTL版本?
So, the question is: Why do the Maven repositories contain the JARs (or more specifically the tld declaration) for the wrong version (1.1 instead of 1.2) and how can I fetch the correct JSTL version via Maven?
推荐答案
作为短期解决方案,将本地.m2
存储库中的JAR文件替换为来自java.net的正确JAR.
As a short term fix, replace the JAR file in your local .m2
repo with the correct JAR from java.net.
如果您使用代理,也请在其中替换.
If you use a proxy, replace it there as well.
这篇关于宣布了JSTL 1.2版,但从Maven存储库交付了1.1版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!