Maven 实战 - maven新建web项目提示"javax.servlet.http.HttpServlet" was not found on the Java Build

Posted 手握太阳

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven 实战 - maven新建web项目提示"javax.servlet.http.HttpServlet" was not found on the Java Build 相关的知识,希望对你有一定的参考价值。

方法一:

<dependency>  
    <groupId>javax.servlet</groupId>  
    <artifactId>servlet-api</artifactId>  
    <version>2.5</version>  
    <scope>provided</scope>  
</dependency>

 

方法二:

Java Build Path -> Libraries ->Add Library… -> Server Runtime ->Next。 具体如下所示:

  

 

点击Next后选择我们之前配置的Apache Tomcat v9.0,然后点击Finish即可。添加完Libraries后不要忘记点击Apply按钮以及OK按钮。

以上是关于Maven 实战 - maven新建web项目提示"javax.servlet.http.HttpServlet" was not found on the Java Build 的主要内容,如果未能解决你的问题,请参考以下文章

Maven运行提示Not a Maven project maven-web-demo

MyEclipse中,使用Maven新建web项目后,提示The superclass "javax.servlet.http.HttpServlet" was not found

使用Eclipse + Maven 构建Java Web 项目

转Maven实战---Maven Build--缺少Jar包

maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu

maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu