开发者

JSTL version 1.2 declared but 1.1 delivered from Maven Repository

开发者 https://www.devze.com 2023-03-16 05:53 出处:网络
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'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

via http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/jstl-1.2.jar

javax.servlet.jsp.jstl : jstl : 1.2

via http://download.java.net/maven/1/javax.servlet.jsp.jstl/jars/jstl-1.2.jar

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?


  1. Report an issue at https://issues.sonatype.org/browse/MVNCENTRAL

  2. 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:

  1. In your .m2 directory*, copy and paste a new copy of the 1.1 folder.
  2. Rename the copy to 1.2
  3. Copy over the real 1.2 jar to that folder.
  4. Update the POM and other text files there to reflect the fact it is 1.2

* $HOME/.m2 on all platforms.

0

精彩评论

暂无评论...
验证码 换一张
取 消