首页 > 代码库 > idea 查看tomcat源码
idea 查看tomcat源码
一.源码下载
SVN :http://svn.apache.org/repos/asf/tomcat/
GIT :https://github.com/apache
二.添加pom.xml文件
1. 在项目目录中添加pom.xml文件
2 pom.xml文件内容
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.tomcat</groupId> <artifactId>Tomcat7.0</artifactId> <name>Tomcat7.0</name> <version>7.0</version> <build> <finalName>Tomcat7.0</finalName> <sourceDirectory>java</sourceDirectory> <testSourceDirectory>test</testSourceDirectory> <resources> <resource> <directory>java</directory> </resource> </resources> <testResources> <testResource> <directory>test</directory> </testResource> </testResources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3</version> <configuration> <encoding>UTF-8</encoding> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.ant/ant --> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> <version>1.10.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.easymock/easymock --> <dependency> <groupId>org.easymock</groupId> <artifactId>easymock</artifactId> <version>3.4</version> </dependency> <dependency> <groupId>wsdl4j</groupId> <artifactId>wsdl4j</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>org.eclipse.jdt.core.compiler</groupId> <artifactId>ecj</artifactId> <version>4.6.1</version> </dependency> </dependencies></project>
三。 打开maven项目
1.
2.设置项目中maven配置
3.刷新 maven project
四。运行设置
1. Run->Edit configurations
2. Main class 设置
org.apache.catalina.startup.Bootstrap
3.vm options 设置
-Dcatalina.home=catalina-home
-Dcatalina.base=catalina-home-Djava.endorsed.dirs=catalina-home/endorsed
-Djava.io.tmpdir=catalina-home/temp-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.util.logging.config.file=catalina-home/conf/logging.properties
catalina-home为环境变量, 本地项目路径为 E:\Projects\TomcatSourceCode\tc7.0.x\trunk-learn2
所以本机配置的 vm options 为
-Dcatalina.home=E:/Projects/TomcatSourceCode/tc7.0.x/trunk-learn2
-Dcatalina.base=E:/Projects/TomcatSourceCode/tc7.0.x/trunk-learn2
-Djava.endorsed.dirs=E:/Projects/TomcatSourceCode/tc7.0.x/trunk-learn2/endorsed
-Djava.io.tmpdir=E:/Projects/TomcatSourceCode/tc7.0.x/trunk-learn2/temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=E:/Projects/TomcatSourceCode/tc7.0.x/trunk-learn2/conf/logging.properties
五 。运行 项目
1.运行项目 发现 test包中 代码报错,找不到类
2.copy
webapps->examples->WEB-INF->classes 中所有文件
复制到
test 中
3. 重新 运行 ,启动成功
4. 浏览器 中检测
http://localhost:8080/
idea 查看tomcat源码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。