tomcat源码阅读--eclipse源码搭建

 

寒暄部分:

一直说阅读tomcat源码但始终没有着手去做这件事,但感觉很有必要,今天想回过头来去做这件事情。

今天就开始在本地eclipse中搭建阅读tomcat源码的环境。

本地环境搭建:

first:

源码下载:首先要到官网下载tomcat源码如果怕麻烦可以到其它博客的下载:tomcat源码下载路径 ps:本人上传的

second:

源码下载了要用什么构建编译工具管理这个问题很是头疼,一般都会在这一步放弃了,make ant maven gradle 大部分都是用ant 然后各种操作,到最后都是无疾而终。这边采用maven(妹问 麦问 不要读成妈问)

这里就涉及到了各种工程之间的转换问题了,eclipse中的普通项目  git项目  maven项目  ,不同项目都会有其对应的标致文件的,maven 的标致文件就是pom.xml 这个时候要这解压后的文件新建一个pom.xml 在这里面添加所依赖的jar坐标了,涉及到了maven的知识不清楚的去复习一下maven的基本使用。

然后再用eclipse 导入,就会发现eclipse会读到pom.xml文件。这个时候原先下载的源码就变成了maven项目了。

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</groupId>
    <artifactId>tomcat</artifactId>
    <name>apache-tomcat-8.5.24</name>
    <version>8.5.24</version>

    <build>
        <finalName>Tomcat-8.5.24</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>3.5.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>3.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.10.0</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项目,因为有些测试类依赖了examples目录的类,因此把apache-tomcat-8.5.24-src\webapps\examples\WEB-INF\classes目录在开发工具上面设置为java源文件,编译的class输出目录设为classes,如下图所示

final

代码仓库的利用:

如果说你阅读源码什么都不注释什么都不动那就没意思了,但改过后都不知道自己都干了些啥,所以源码备份很重要,所以选择上传到 github 或者是码云 这里涉及到了  git的使用,有时间可以学习一下。git小结

参考资料:

https://blog.csdn.net/Dwade_mia/article/details/79051370

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值