某些war
包程序會由於缺乏運行時環境,在maven
打包時偶爾出現如下異常:java
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project pa_remove_peel: Compilation failure: Compilation failure: [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[3,26] 程序包javax.servlet.http不存在 [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[4,26] 程序包javax.servlet.http不存在 [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[10,44] 找不到符號 [ERROR] 符號: 類 HttpServletRequest [ERROR] 位置: 類 com.hengbao.utils.service.SimpleService [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[24,64] 找不到符號 [ERROR] 符號: 類 HttpServletRequest [ERROR] 位置: 類 com.hengbao.utils.service.SimpleService [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[27,17] 找不到符號 [ERROR] 符號: 類 Cookie [ERROR] 位置: 類 com.hengbao.utils.service.SimpleService [ERROR] /F:/FruitsWorkspace/pineapple/pa_remove_peel/src/main/java/com/hengbao/utils/service/SimpleService.java:[29,30] 找不到符號 [ERROR] 符號: 類 Cookie
右鍵項目 -> Build Path
-> Configure Build Path
-> Libraires
-> Add Library
-> Server Runtime
apache
若是列表中沒有選項,那麼你尚未添加tomcat
環境。你能夠在菜單欄中的Window
-> Preferences
中添加,搜索Server
,對應的環境的添加在此處:tomcat
感謝 https://blog.csdn.net/qqqxiaobaiji/article/details/53404925 給我思路app