Maven编译错误:无法访问HttpServletResponse 找不到HttpServletResponse的类文件
maven项目重新编译后报错
项目里也有加入servlet-api.jar,也试过换成tomcat7 runtime,都不行,项目有几个子项目已包形式加载com.abc.common等,我怀疑是servlet-api冲突,但是不知道怎么解决,有没有大佬指点一下,谢谢了。
apache-tomcat-7.0.61
pom.xml
<dependency>
<groupId>com.abc</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.abc</groupId>
<artifactId>user</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<!-- 只在编译和测试的时候用 -->
<scope>provided</scope>
</dependency>
<!-- XSSF_EXCEL -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version><!-- 2.1 --><!-- 3.8.0 -->
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
错误日志log
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AdminUserController.java:[49,45] 无法访问HttpServletResponse
找不到HttpServletResponse的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AdminUserController.java:[61,40] 无法访问HttpServletRequest
找不到HttpServletRequest的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[149,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[191,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[233,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[264,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[294,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[334,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[374,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[416,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[458,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[500,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[542,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[592,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[634,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[701,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[750,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[793,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[896,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/Hop2ApiController.java:[102,70] 无法访问Page
找不到Page的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/Hop2ApiController.java:[142,70] 不兼容的类型: Page无法转换为com.abc.common.dto.Page<com.alibaba.fastjson.JSONObject>
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[70,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[89,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[108,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SourceController.java:[43,69] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SourceController.java:[59,69] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookRecordController.java:[195,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/MallController.java:[56,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/web/interceptors/LoginInterceptor.java:[35,95] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/web/interceptors/LoginInterceptor.java:[36,98] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[164,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[198,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[298,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/TravelskyRecordController.java:[211,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AirlineContractController.java:[106,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AirlineContractController.java:[128,61] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/aop/OperationAop.java:[81,59] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookTicketController.java:[71,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookTicketController.java:[90,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SnatchOrderController.java:[195,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SnatchOrderController.java:[227,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/PageViewLogController.java:[27,56] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[62,57] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[71,79] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[113,71] 不兼容的类型: javax.servlet.http.HttpServletResponse无法转换为HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[125,55] 不兼容的类型: javax.servlet.http.HttpServletResponse无法转换为HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/dao/impl/VendorApiDaoImpl.java:[19,56] 类型参数com.abc.hop2.models.FooModel不在类型变量T的范围内
[INFO] 47 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.927 s
[INFO] Finished at: 2020-07-09T10:27:40+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project admin: Compilation failure: Compilation failure:
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AdminUserController.java:[49,45] 无法访问HttpServletResponse
[ERROR] 找不到HttpServletResponse的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AdminUserController.java:[61,40] 无法访问HttpServletRequest
[ERROR] 找不到HttpServletRequest的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[149,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[191,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[233,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[264,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[294,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[334,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[374,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[416,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[458,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[500,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[542,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[592,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[634,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[701,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[750,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[793,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/ReportController.java:[896,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/Hop2ApiController.java:[102,70] 无法访问Page
[ERROR] 找不到Page的类文件
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/Hop2ApiController.java:[142,70] 不兼容的类型: Page无法转换为com.abc.common.dto.Page<com.alibaba.fastjson.JSONObject>
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[70,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[89,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/CtripApiOrderController.java:[108,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SourceController.java:[43,69] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SourceController.java:[59,69] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookRecordController.java:[195,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/MallController.java:[56,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/web/interceptors/LoginInterceptor.java:[35,95] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/web/interceptors/LoginInterceptor.java:[36,98] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[164,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[198,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BaseBookRecordController.java:[298,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/TravelskyRecordController.java:[211,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AirlineContractController.java:[106,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/AirlineContractController.java:[128,61] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/aop/OperationAop.java:[81,59] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookTicketController.java:[71,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/BookTicketController.java:[90,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SnatchOrderController.java:[195,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/SnatchOrderController.java:[227,59] 不兼容的类型: HttpServletResponse无法转换为javax.servlet.http.HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/controllers/PageViewLogController.java:[27,56] 不兼容的类型: HttpServletRequest无法转换为javax.servlet.http.HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[62,57] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[71,79] 不兼容的类型: javax.servlet.http.HttpServletRequest无法转换为HttpServletRequest
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[113,71] 不兼容的类型: javax.servlet.http.HttpServletResponse无法转换为HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/services/impl/RefundServiceImpl.java:[125,55] 不兼容的类型: javax.servlet.http.HttpServletResponse无法转换为HttpServletResponse
[ERROR] /D:/workspace/admin/src/main/java/com/abc/admin/dao/impl/VendorApiDaoImpl.java:[19,56] 类型参数com.abc.hop2.models.FooModel不在类型变量T的范围内
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了,我将maven仓库指向其他地方重新下载了一份,重新配置tomcat就能跑了