1、在tomcat官网下载tomcat源码:https://tomcat.apache.org/download-80.cgi
之后解压,
2、进入apache-tomcat-8.5.37-src目录:
可将test文件夹删除(如果不删除在后期编译时会报错TestCookieFilter,可将TestCookieFilter的代码注调)
添加pom文件:
4.0.0 org.apache.tomcat Tomcat8.0 Tomcat8.0 8.0 Tomcat8.0 java test java test org.apache.maven.plugins maven-compiler-plugin 2.3 UTF-8 junit junit 4.12 test org.easymock easymock 3.4 ant ant 1.7.0 wsdl4j wsdl4j 1.6.2 javax.xml jaxrpc 1.1 org.eclipse.jdt.core.compiler ecj 4.5.1
3、之后可将tomcat的源码导入idea:
4、配置:
mainClass :org.apache.catalina.startup.Bootstrap
vm options: -Dcatalina.home="/Users/xxxx/apache-tomcat-8.5.37-src"
5、修改ContextConfig类:
在769行后手动添加:
context.addServletContainerInitializer(new JasperInitializer(), null);
6、
7、