tomcat 8.5 源码编译 --- maven方式

官方自带的是ant编译、这玩意不太懂 不捣鼓了

解压下载的源码包 目录结构大致如下

java
test
bin
conf
modules
res
target
webapps
build.properties.default
build.xml
BUILDING.txt
CONTRIBUTING.md
KEYS
LICENSE
MERGE.txt
NOTICE
README.md
RELEASE-NOTES
RUNNING.txt

新建一个pom.xml


<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.0modelVersion>
    <groupId>org.apache.tomcatgroupId>
    <artifactId>Tomcat8.5artifactId>
    <name>Tomcat8.5name>
    <version>8.5version>
    <build>
        <finalName>Tomcat8.0finalName>
        
        <sourceDirectory>javasourceDirectory>
        <testSourceDirectory>testtestSourceDirectory>
        <resources>
            <resource>
                <directory>javadirectory>
            resource>
        resources>
        <testResources>
            <testResource>
                <directory>testdirectory>
            testResource>
        testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <version>2.3version>
                <configuration>
                    <encoding>UTF-8encoding>
                    
                    <source>1.8source>
                    <target>1.8target>
                configuration>
            plugin>
        plugins>
    build>
    
    <dependencies>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.12version>
            <scope>testscope>
        dependency>
        <dependency>
            <groupId>antgroupId>
            <artifactId>antartifactId>
            <version>1.7.0version>
        dependency>
        <dependency>
            <groupId>wsdl4jgroupId>
            <artifactId>wsdl4jartifactId>
            <version>1.6.2version>
        dependency>
        <dependency>
            <groupId>javax.xmlgroupId>
            <artifactId>jaxrpcartifactId>
            <version>1.1version>
        dependency>
        <dependency>
            <groupId>org.easymockgroupId>
            <artifactId>easymockartifactId>
            <version>3.3version>
        dependency>
        <dependency>
            <groupId>org.eclipse.jdt.core.compilergroupId>
            <artifactId>ecjartifactId>
            <version>4.6.1version>
        dependency>
    dependencies>
project>

然后import到eclipse
编译会有错误、删除test目录下的有错误的几个文件就ok
启动的

org.apache.catalina.startup.Bootstrap 的main方法

发现运行的时候也会报错、继续删除
webapps/examples 文件夹

大功告成

你可能感兴趣的:(Tomcat)