新建Maven后,Eclipse报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path.
解决办法如下:
1 打开Maven中央仓库
2 搜索框输入servlet进行搜索
3 选择第一个结果:Java Servlet API
4 查看某个版本依赖
5 在Maven项目pom.xml中添加该依赖
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
来源:oschina
链接:https://my.oschina.net/u/4339899/blog/3434497