Maven基础知识(2)
1.插件运行失败(这个找了很久,都是讲我的jdk和eclipse的jdk路径不一致,但是我的是一致的,结果重启了eclipse就可以了,很神奇,下次实在找不到参考可以先重启一下软件)
严重: Null component localEngine:type=JspMonitor,name=jsp,WebModule=//localhost/Maven-first,J2EEApplication=none,J2EEServer=none
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.555 s
[INFO] Finished at: 2018-04-04T14:29:29+08:00
[INFO] Final Memory: 14M/145M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (default-cli) on project Maven-first: Execution default-cli of goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run failed. NullPointerException -> [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/PluginExecutionException
2.遇到这样的错误可能是软件包冲突,或者是JDK版本过高,或者是Tomcat服务器版本过低,从而导致冲突。解决方法更改高版本Tomcat或者降低JDK的版本。
严重: Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
3.为什么jar包的依赖范围设置为compile就会报错,设置为provided就不会报错?
严重: Exception starting filter struts2
java.lang.ClassCastException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter cannot be cast to javax.servlet.Filter
因为若是provided则项目会依赖tomcat带的jar包,否则项目中有jar包,tomcat也有,导致重复冲突,不知道使用谁的。
看一下打包后的jar(provided)
compile的情况
4.依赖范围
5.添加插件修改端口和路径
这个系统自带的tomcat,平时使用默认的是tomcat6
6.debug时如果程序进不去,就配置一下再调试