如何使用maven包与jstl和spring等taglib进行战争?

时间:2015-01-21 09:42:11

标签: maven spring-boot taglib

maven + spring boot

当我键入mvn spring-boot时:运行

没有任何错误就没问题

但是当我输入mvn package

服务器抛出异常

org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application

我的pom

我想知道如何解决这个问题

任何高手都可以帮助我吗?

<?xml version="1.0" encoding="UTF-8"?>
<project mlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.2.BUILD-SNAPSHOT</version>
</parent>
<properties>
    <java.version>1.7</java.version>
</properties>
<!-- Additional lines to be added here... -->
<dependencies>
    <!--developing a web application -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- Import Spring Boot’s default HTTP engine (Tomcat) -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <scope>provided</scope>
    </dependency>
    <!-- Support for common test dependencies, including JUnit, Hamcrest and 
        Mockito along with the spring-test module. -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>
<!--To add this blowe to create an executable jar -->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:1)

尝试将以下依赖项添加到您的pom.xml

<dependency>
   <groupId>org.springframework.security</groupId>
   <artifactId>spring-security-taglibs</artifactId>
   <version>Your Security Version</version>
</dependency>

需要注意的另一点是,而不是 mvn mvn package 类型 mvn package