maven依赖servlet-api和jsp-api的问题

 

如果不配置scope,会把jar包发布,会跟容器里的jar包冲突

 

scope要用provided,由容器提供,不会发布

(或者不配这两个依赖,在项目的Java Build Path的Libraries里添加Server Runtime(Tomcat))

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>

  

你可能感兴趣的:(maven,jsp,servlet,scope)