[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project ahgy: Compilation failure
[ERROR] /Users/lht/workspace/idea_workspace/ahah/src/main/java/com/hn/core/StartSetup.java:[32,63] 找不到符号
[ERROR] 符号: 方法 getContextPath()
[ERROR] 位置: 接口 javax.servlet.ServletContext
[ERROR]
[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
项目是maven-archetype-webapp类型,使用mvn:clean都是正常的 ,pom文件中也增加了servlet依赖jar
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>