JSTL version 1.2 declared but 1.1 delivered from Maven Repository

谁说我不能喝 提交于 2019-12-14 02:03:32

问题


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

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:


  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.




回答2:


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.



来源:https://stackoverflow.com/questions/6535119/jstl-version-1-2-declared-but-1-1-delivered-from-maven-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!