1.下载资源
下载主要包含两个包,已经编译的包和源码包,如图所示。
链接地址为:
http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.93/bin/apache-tomcat-7.0.93-windows-x64.zip
http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.93/src/apache-tomcat-7.0.93-src.zip
2解压文件
1)解压源码压缩包apache-tomcat-7.0.93-src.zip,并在解压后的目录中创建home文件夹
2)解压二进制压缩包apache-tomcat-7.0.93-windows-x64.zip,将下图中的文件放入上面创建的home文件夹中
3.编译文件
<?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.67</artifactId> <name>Tomcat7.0.67</name> <version>7.0</version> <properties> <java.version>1.7</java.version> </properties> <dependencies> <dependency> <groupId>ant</groupId> <artifactId>ant</artifactId> <version>1.7.0</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.5</version> <configuration> <encoding>UTF-8</encoding> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> </build> </project> |
4.配置启动
Main Class为:org.apache.catalina.startup.Bootstrap
VM Options为:-Dcatalina.home=D:\Tonny\Doc\Project\mine\apache-tomcat-7.0.93-src -Dcatalina.base=D:\Tonny\Doc\Project\mine\apache-tomcat-7.0.93-src -Djava.endorsed.dirs=D:\Tonny\Doc\Project\mine\apache-tomcat-7.0.93-src\endorsed -Djava.io.tmpdir=D:\Tonny\Doc\Project\mine\apache-tomcat-7.0.93-srctemp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=D:\Tonny\Doc\Project\mine\apache-tomcat-7.0.93-src\conf\logging.properties
5.登录访问
浏览器中输入http://localhost:8080/