在pom文件中添加以下内容
<build>
<plugins>
<!-- 配置Tomcat插件 ,用于启动项目 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<!--如果不设置,则默认为猫的自定义端口,项目路径为http://localhost:默认端口/项目名 -->
<configuration>
<uriEncoding>UTF-8</uriEncoding>
<!--如果端口号改为8081:那么访问的时候路径的端口就要写成8081,否则404 -->
<port>8080</port>
<!-- 如果设置为/,则项目了路径为http://localhost:端口号 /-->
<!-- 如果设置为/123,则项目了路径为http://localhost:端口号/123 -->
<path>/XVS</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<finalName>XVS</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.* </include>
</includes>
</resource>
</resources>
</build>