File size: 2,102 Bytes
08aee07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- 当前项目的坐标 -->
  <groupId>org.example</groupId>
  <artifactId>Maven_project</artifactId>
  <!--
    打包方式:
      1、jar: java项目。默认值
      2、war: web项目。
      3、pom:
  -->
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>


  <name>Maven_project Maven Webapp</name>
  <url>http://maven.apache.org</url>
  

  <!-- 导入jar包 -->
  <dependencies>
    <!-- 测试jar包 -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <!-- 添加servlet的依赖jar包 -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>

    <!-- 添加JDBC的插件 -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.32</version>
      <scope>runtime</scope>
    </dependency>

  </dependencies>

  <!-- 添加插件 -->
  <build>
    <plugins>
      <!-- 编译插件 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <target>11</target>
          <source>11</source>
        </configuration>
      </plugin>

      <!-- tomcat插件 启动web应用 -->
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>

        <configuration>
          <!-- 修改tomcat的端口号 -->
          <port>80</port>
          <!-- 修改当前项目的虚拟目录 -->
          <path>/</path>
        </configuration>
      </plugin>

    </plugins>
  </build>
</project>