使用spring-boot创建web工程时,默认采用embeded tomcat作为容器,实际使用过程中,可能会需要对其中的某些功能做微调,而tomcat又没有给出预留配 ,这时就需要对tomcat-embed-core源码进行编译了,下面说下具体的步骤

创建工程

  1. 在eclipse中创建tomcat-embed-core的maven工程
  2. 通过maven下载一个自己需要编译的tomcat-embed-core版本对应的source包(以8.5.31为例)
  3. 解压tomcat-embed-core对应的source包
  4. 将source包中javax和org两个包copy到刚创建的maven工程的src/main/java目录下
  5. 将source包中的META-INF放到src/main/resources目录下
  6. 编辑pom文件,追加依赖包、编译内容、以及发布的默认maven仓库
    <?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>8.5.31-me</version>
<description>Core Tomcat implementation</description>
<url>http://tomcat.apache.org/</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
<version>8.5.31</version>
<scope>compile</scope>
</dependency> <dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.6</version>
<scope>provided</scope>
</dependency> <dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency> <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency> <dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.ejb</artifactId>
<version>3.1.1</version>
<scope>provided</scope>
</dependency> <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>8.5.31</version>
<scope>provided</scope>
</dependency>
</dependencies> <build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.xsd</include>
<include>**/*.dtd</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build> <distributionManagement>
<repository>
<id>my-releases</id>
<name>my-releases</name>
<url>http://nexus:8081/repository/my-releases/</url>
</repository>
<snapshotRepository>
<id>my-snapshots</id>
<name>my-snapshots</name>
<url>http://nexus:8081/repository/my-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

编辑修改需要定制化的类

重新打包

进入工程目录执行,maven deploy,会将打包好的jar包上传到对应的maven仓库中

之后其他工程就可以依赖新打出的jar包

tomcat-embeded-core源码编译的更多相关文章

  1. wso2esb源码编译总结

    最近花了两周的空闲时间帮朋友把wso2esb的4.0.3.4.6.0.4.7.0三个版本从源码编译出来了.以下是大概的一些体会. wso2esb是基于carbon的.carbon是个基于eclipse ...

  2. Tomcat8源码编译及导入Eclipse中研究

    最近因为需求需要修改Tomcat中的某些功能,无奈只能研究那部分源码然后稍作修改. 目前Tomcat最新版是8.0,下载了源码包,编译并导入Eclipse中研究比较方便. 1. Tomcat8源码编译 ...

  3. 从ApacheTomcat架构谈面试到源码编译环境v10.0.12

    概述 开启博客分享已近三个月,感谢所有花时间精力和小编一路学习和成长的伙伴们,有你们的支持,我们继续再接再厉 **本人博客网站 **IT小神 www.itxiaoshen.com 定义 Tomcat官 ...

  4. 非寻常方式学习ApacheTomcat架构及10.0.12源码编译

    概述 开启博客分享已近三个月,感谢所有花时间精力和小编一路学习和成长的伙伴们,有你们的支持,我们继续再接再厉 **本人博客网站 **IT小神 www.itxiaoshen.com 定义 Tomcat官 ...

  5. 解决Tomcat10.0.12源码编译问题进而剖析其优秀分层设计架构

    概述 Tomcat.Jetty.Undertow这几个都是非常有名实现Servlet规范的应用服务器,Tomcat本身也是业界上非常优秀的中间件,简单可将Tomcat看成是一个Http服务器+Serv ...

  6. Apache Spark源码走读之9 -- Spark源码编译

    欢迎转载,转载请注明出处,徽沪一郎. 概要 本来源码编译没有什么可说的,对于java项目来说,只要会点maven或ant的简单命令,依葫芦画瓢,一下子就ok了.但到了Spark上面,事情似乎不这么简单 ...

  7. mpusher 源码编译 for windows X64

    mpusher 源码编译 for windows X64 对于java我是小白,通过一步步的摸索,将经验总结下来,给更多码友提供入门的帮助.一个人的摸索是很困难的,本教程感谢 [MPush开源消息推送 ...

  8. hadoop-2.6.0源码编译问题汇总

    在上一篇文章中,介绍了hadoop-2.6.0源码编译的一般流程,因个人计算机环境的不同, 编译过程中难免会出现一些错误,下面是我编译过程中遇到的错误. 列举出来并附上我解决此错误的方法,希望对大家有 ...

  9. 【流媒体开发】VLC Media Player - Android 平台源码编译 与 二次开发详解 (提供详细800M下载好的编译源码及eclipse可调试播放器源码下载)

    作者 : 韩曙亮  博客地址 : http://blog.csdn.net/shulianghan/article/details/42707293 转载请注明出处 : http://blog.csd ...

  10. apache kafka & CDH kafka源码编译

    Apache kafka编译 前言 github网站kafka项目的README.md有关于kafka源码编译的说明 github地址:https://github.com/apache/kafka ...

随机推荐

  1. javascript30--day03--Css Variables

     相关视频链接:https://www.bilibili.com/video/av8481988/?p=5 相关github地址:https://github.com/soyaine/JavaScri ...

  2. 错误:EfficientDet网络出现"No boxes to NMS"并且mAP:0.0的解决方案

    近日,在使用谷歌新推出来的一个网络EfficientDet进行目标检测训练自己的数据集的时候,出现了如下错误: 其中项目开源地址是:https://github.com/toandaominh1997 ...

  3. ThreadPoolExecutor之RejectedExecutionHandler

    最近工作种常用到ThreadPoolExecutor这个对象, 这是一个并发编程中非常常用的对象.因为和并发编程相关所以它存在于java.util.concurrent这包中. 创建这个对象的基本方法 ...

  4. clr via c# 参数和属性

    1,可选参数和命名参数 当给参数指定默认值时,可以在调用的时候省略 有默认值的参数,必须放在所有没有默认值的参数后面,但是 参数数组必须放在最后面,parm 默认值必须时编译时能确定的常量值,对于值类 ...

  5. 避免js重复加载的问题

    避免js重复加载的问题 在日常开发中,一个页面加载另一个页面的时候,就会把另一个页面的js也会加载进来,那么如何才能避免被加载页面不再重复加载已经加载过的js呢? 先上代码 动态加载js // 加载j ...

  6. 小白的linux笔记5:关于权限那些事

    在设置smb时发现,目录的权限是个影响访问的大问题,还是得研究清楚. 关于文件权限 查看当前目录下文件和文件夹的权限状态:ls -l drwxrwxr--.  4 root root    4096 ...

  7. Windows10设置系统参数

     屏幕分辨率设置 电源屏幕显示时间 投影可以进行手机投影到电脑进行操作,远程桌面可以进行远程访问,如云服务器 设置桌面图标和背景 设置默认应用 安装软件,必备的几项软件 --其中个人认为(1)(2)是 ...

  8. python3的bytes数据类型

    python已升级到了3.0,都说现在是属于python3,未来也是属于python3,那python3到底改了些什么呢? 其中我记得非常清楚的是,python3对文本和二进制数据作了更为清晰的区分. ...

  9. win10环境下安装mysql-8.0.18-winx64

    下载mysql安装包,然后解压到你想安装的目录下,我下载的是mysql-8.0.18-winx64 Windows 上安装 MySQL 相对来说会较为简单,最新版本可以在 MySQL 下载 中下载中查 ...

  10. P4197 Peaks [克鲁斯卡尔重构树 + 主席树][克鲁斯卡尔重构树学习笔记]

    Problem 在\(Bytemountains\)有\(n\)座山峰,每座山峰有他的高度\(h_i\) .有些山峰之间有双向道路相连,共\(M\)条路径,每条路径有一个困难值,这个值越大表示越难走, ...