IDEA导入Tomcat源码

一、下载Tomcat和Tomcat源码(本例使用的是7.0.88版本),解压之后如下:

二、在apache-tomcat-7.0.88-src目录下新建home目录和pom.xml文件,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.88</artifactId>
    <name>Tomcat7.0.88</name>
    <version>7.0</version>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.7.1</version>
        </dependency>
        <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-apache-log4j</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-commons-logging</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.rpc</groupId>
            <artifactId>javax.xml.rpc-api</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
            <version>4.5.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>Tomcat7.0</finalName>
        <sourceDirectory>java</sourceDirectory>
        <resources>
            <resource>
                <directory>java</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

三、将apache-tomcat-7.0.88目录下的webapps目录和conf目录拷贝到apache-tomcat-7.0.88-src的home目录下,并在apache-tomcat-7.0.88-src的home目录下创建lib、work目录,如下图:

四、导入到IDEA中(File、Open),然后maven下载依赖

五、编辑启动配置:

其中,Main class:

org.apache.catalina.startup.Bootstrap

VM Options:就是上面在apache-tomcat-7.0.88-src目录下加的home目录

-Dcatalina.home=/Users/baohuajie/installedDir/apache-tomcat-7.0.88-src/home

Working directory:源码路径

/Users/baohuajie/installedDir/apache-tomcat-7.0.88-src

六、启动:

七、也可以debug

八、配置好的完整Tomcat源码

https://github.com/JQuery134/TomcatSRC/blob/master/apache-tomcat-7.0.88-src.zip

 

 

 

 

 

 

 

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读