ant编译tomcat

简介: 安装jdk,用jdk6即可,如果要编译JSR-356 (Java WebSocket 1.1)则需要jdk7.安装ant,Ant 1.8.2或更新版本。
  • 安装jdk,用jdk6即可,如果要编译JSR-356 (Java WebSocket 1.1)则需要jdk7.
  • 安装ant,Ant 1.8.2或更新版本。
  • 连到apache的svn上下载自己想要的版本,比如这里使用TOMCAT_7_0_73。
  • Tomcat目录下新建build.properties文件,可以以build.properties.default文件作为模板修改,比如可以修改base.path=${user.home}/tomcat-build-libs,此路径用于构建过程中存放下载的文件。包含以下目录:
commons-daemon-1.0.15
commons-dbcp-1.4-src
commons-pool-1.5.7-src
ecj-4.4.2
tomcat7-deps
tomcat-native-1.2.10
  • 如果使用了代理需要配置
proxy.host=proxy.domain
proxy.port=8080
proxy.use=on
  • 运行ant构建
D:\workspace\tomcat-workspace\TOMCAT_7_0_73>ant
Buildfile: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\build.xml

build-prepare:
   [delete] Deleting directory D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\temp
    [mkdir] Created dir: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\temp

download-compile:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/tomcat-native-1.2.10/tomcat-native.tar.gz

downloadfile-2:

proxyflags:

setproxy:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/commons-daemon-1.0.15/commons-daemon-1.0.15.jar

downloadgz-2:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/commons-daemon-1.0.15/commons-daemon-1.0.15-native-src.tar.gz

downloadfile-2:

proxyflags:

setproxy:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/commons-pool-1.5.7-src/build.xml

downloadgz-2:

proxyflags:

setproxy:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/commons-dbcp-1.4-src/build.xml

downloadgz-2:

build-prepare:
   [delete] Deleting directory D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\temp
    [mkdir] Created dir: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\temp

build-manifests:

build-tomcat-dbcp:

testexist:
     [echo] Testing  for C:\Users\wj/tomcat-build-libs/ecj-4.4.2/ecj-4.4.2.jar

downloadfile-2:

compile-prepare:

download-validate:

validate:

compile-java6:
     [copy] Copying 7 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\classes\javax\servlet\resources

guess-java7:

check-java7:

compile-java7:

compile:

build-manifests:

package-java7:

package:
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\annotations-api.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\servlet-api.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\jsp-api.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\el-api.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\bin\bootstrap.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\bin\tomcat-juli.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\catalina.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\catalina-tribes.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\catalina-ha.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\catalina-ant.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\tomcat-api.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\tomcat-util.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\tomcat-coyote.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\jasper.jar
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib\jasper-el.jar

build-docs:
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs\appdev
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs\funcspecs
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs\config
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs\architecture
     [xslt] Transforming into D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\docs\tribes

compile-webapp-examples:

deploy:

examples-sources:
 [txt2html] Converted 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\simpletag
 [txt2html] Converted 4 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\simpletag
 [txt2html] Converted 5 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\simpletag
 [txt2html] Converted 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\jspattribute
 [txt2html] Converted 4 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\jspattribute
 [txt2html] Converted 4 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\cal
 [txt2html] Converted 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsptoserv
 [txt2html] Converted 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\el
 [txt2html] Converted 2 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\el
 [txt2html] Converted 3 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\el
 [txt2html] Converted 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\misc
 [txt2html] Converted 4 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples\jsp\jsp2\tagfiles
 [txt2html] Converted 51 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\webapps\examples
     [copy] Copying 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib
     [echo] Building Tomcat JDBC pool libraries

prepare:
    [mkdir] Created dir: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\build
    [mkdir] Created dir: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\classes
    [mkdir] Created dir: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\testclasses
     [copy] Copying 7 files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool

download:

build-src:
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\tomcat-jdbc-src.jar

build:
    [javac] Compiling 31 source files to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\classes
      [jar] Building jar: D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\jdbc-pool\tomcat-jdbc.jar
     [copy] Copying 1 file to D:\workspace\tomcat-workspace\TOMCAT_7_0_73\output\build\lib

BUILD SUCCESSFUL
Total time: 30 seconds

可参考
http://tomcat.apache.org/tomcat-7.0-doc/building.html

点击订购作者《Tomcat内核设计剖析》

博主的书

目录
相关文章
|
Java 应用服务中间件 Maven
maven打包war在tomcat下不能编译的问题
maven打包war在tomcat下不能编译的问题
212 0
maven打包war在tomcat下不能编译的问题
|
测试技术 应用服务中间件
ant+Jacoco 统计tomcat远程部署后项目接口自动化测试或者功能测试代码覆盖率
ant+Jacoco 统计tomcat远程部署后项目接口自动化测试或者功能测试代码覆盖率
ant+Jacoco 统计tomcat远程部署后项目接口自动化测试或者功能测试代码覆盖率
|
Web App开发 jenkins 持续交付
Jenkins +ant+tomcat自动化构建部署(学习笔记三十五)
other:https://blog.csdn.net/qq_32517251/article/details/52469623 1、工具版本  Ant:apache-ant-1.9.1 Jenkins:jenkins-2.46.3 Tomcat:apache-tomcat-8.0.43 系统:window7 开发工具:IDEA 2、Web项目     简述:这里只是在本地简单的构建了一个Web项目,并没有使用Maven或者在Git上托管。
1209 0
|
应用服务中间件 容器
Angular 自动编译部署 Tomcat Jboss
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.
1425 0
|
Java 应用服务中间件 Android开发
|
Java 应用服务中间件 Android开发