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.
I've tried the following packages:
javax.servlet : jstl : 1.2
javax.servlet.jsp.jstl : jstl : 1.2
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.xs开发者_JAVA百科d"
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>
...
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>
...
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?
Report an issue at https://issues.sonatype.org/browse/MVNCENTRAL
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.
You can override it locally by following these steps:
- In your .m2 directory*, copy and paste a new copy of the 1.1 folder.
- Rename the copy to 1.2
- Copy over the real 1.2 jar to that folder.
- Update the POM and other text files there to reflect the fact it is 1.2
* $HOME/.m2 on all platforms.
精彩评论