在Maven项目中添加JSLT 1.2.1的标准方法? [英] Standard way of adding JSLT 1.2.1 in a Maven Project?

查看:105
本文介绍了在Maven项目中添加JSLT 1.2.1的标准方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在maven项目中添加 1.2.1 JSTL taglib的标准pom是什么.关于何时/是否可以将其范围限定为provided的任何建议?任何服务器特性(对Jboss 7,Glassfish 4和/或Tomcat 7感兴趣)

What is the standard pom for adding the 1.2.1 JSTL taglib in a maven project. Any recommendations as to when/if can this be scoped as provided ? Any server peculiarities (interested in Jboss 7, Glassfish 4 and/or Tomcat 7)

编辑:已添加:

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.servlet.jsp.jstl</artifactId>
    <version>1.2.1</version>
    <scope>provided</scope>
</dependency>

这添加了:

请注意,它会过渡性地添加1.2 API.

Notice it transitively adds the 1.2 api.

我正在使用provided,就像我正在使用应该提供它的Jboss一样:

I am using provided as I am using Jboss which should provide it: Basic question complicated solution - Tomcat to JBoss. Still this is the 1.2 api apparently

$ find . -name *jstl*.jar
./modules/javax/servlet/jstl/api/main/jboss-jstl-api_1.2_spec-1.0.2.Final.jar

(也包含实现).那么正确的方法是将jstl jars添加到pom中(不在提供的范围内)并标记servlet-api(无论如何我还是3人),以某种方式提供?

(contains implementation also). So would the correct way be to add the jstl jars to the pom (not in provided scope) and mark the servlet-api (I'm on 3 anyway) as provided somehow ?

推荐答案

最终使用:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>
<!-- Add the jstl-api dependency explicitly - otherwise jstl-api 1.2 is added -->
<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>javax.servlet.jsp.jstl-api</artifactId>
    <version>1.2.1</version>
</dependency>
<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.servlet.jsp.jstl</artifactId>
    <version>1.2.1</version>
    <exclusions>
         <!-- jstl-api was adding selvlet-api 2.5 and jsp-api-->
        <exclusion>
            <artifactId>jstl-api</artifactId>
            <groupId>javax.servlet.jsp.jstl</groupId>
        </exclusion>
    </exclusions>
</dependency>

不确定我是否应该添加jstl-api依赖项-请发表评论(实际上,我会接受更权威的答案).结果:

Not sure if I should add the jstl-api dependency - please comment (I would accept a more authoritative answer actually). Result:

请参阅:

  • Autocomplete with JSP, JSTL 1.2.1 and Servlet 3.0 in Tomcat 7 with Eclipse Kepler
  • Fix maven JSTL 1.2.1 dependency so maven-war-plugin doesn't package JARs that offend Tomcat 7
  • JBoss 7.1 - Migration to JSF 2.2 - includes how to upgrate your jstl to 1.2.1

对于1.2:

这篇关于在Maven项目中添加JSLT 1.2.1的标准方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆