标签:col project VID webapp hot mode cal hello ack
1.目录结构:注意webapp目录的目录结构,它在src/main下面,若不在,第一次在控制台输入mvn clean tomcat7:run时会告诉这个问题
2.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>maven_struts</groupId> <artifactId>maven_struts</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.3.16.1</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/</path> <uriEncoding>UTF-8</uriEncoding> <port>8888</port> </configuration> </plugin> </plugins> </build> </project>
其中plugin中的tomcat7-maven-plugin是使用mavne插件的方式来布署工程,且web 工程必须得打包成war的形式,即
<packaging>war</packaging>
配置启动时:
然后在浏览器中输入http://localhost:8888/hello,注意端口号是pom文件中配置端口号port
3.另外一种方式布署项目:需要在本地安装tomcat 8.5.28
然后在浏览器中输入
标签:col project VID webapp hot mode cal hello ack
原文地址:https://www.cnblogs.com/zf201149/p/9142650.html