第一步:搭建Maven项目

  首先是父模块:Demo-parent

  然后是子模块:Demo-entity,Demo-dao,Demo-service,Demo-web

  在Demo-web层添加Web目录。

第二步:父模块的pom.xml文件里,如下:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
 3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 5     <modelVersion>4.0.0</modelVersion>
 6 
 7     <groupId>com.nf</groupId>
 8     <artifactId>mvnBatis-parent</artifactId>
 9     <packaging>pom</packaging>
10     <version>1.0-SNAPSHOT</version>
11     <modules>
12         <module>mvnBatis-entity</module>
13         <module>mvnBatis-dao</module>
14         <module>mvnBatis-service</module>
15         <module>mvnBatis-web</module>
16     </modules>
17     
18     <properties>
19         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20         <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
21         <java.version>1.8</java.version>
22         <maven.compiler.source>1.8</maven.compiler.source>
23         <maven.compiler.target>1.8</maven.compiler.target>
24 
25             <javax.servlet.version>3.1.0</javax.servlet.version>
26             <mysql.version>8.0.11</mysql.version>
27             <jstl.version>1.2</jstl.version>
28             <myBatis.version>3.4.6</myBatis.version>
29             <pagehelper.version>5.1.2</pagehelper.version>
30     </properties>
31 
32     <dependencyManagement>
33         <dependencies>
34             <dependency>
35                 <groupId>javax.servlet</groupId>
36                 <artifactId>javax.servlet-api</artifactId>
37                 <version>${javax.servlet.version}</version>
38             </dependency>
39 
40             <dependency>
41                 <groupId>mysql</groupId>
42                 <artifactId>mysql-connector-java</artifactId>
43                 <version>${mysql.version}</version>
44             </dependency>
45 
46             <dependency>
47                 <groupId>javax.servlet</groupId>
48                 <artifactId>jstl</artifactId>
49                 <version>${jstl.version}</version>
50             </dependency>
51 
52             <dependency>
53                 <groupId>org.mybatis</groupId>
54                 <artifactId>mybatis</artifactId>
55                 <version>${myBatis.version}</version>
56             </dependency>
57 
58             <dependency>
59                 <groupId>com.github.pagehelper</groupId>
60                 <artifactId>pagehelper</artifactId>
61                 <version>${pagehelper.version}</version>
62             </dependency>
63 
64 
65         </dependencies>
66     </dependencyManagement>
67 
68     <build>
69         <plugins>
70             <plugin>
71                 <artifactId>maven-war-plugin</artifactId>
72                 <version>3.2.0</version>
73                 <configuration>
74                     <warSourceDirectory>web</warSourceDirectory>
75                 </configuration>
76             </plugin>
77         </plugins>
78     </build>
79 
80 </project>
View parent-pom

相关文章:

  • 2021-07-25
  • 2021-04-01
  • 2021-05-28
  • 2021-08-05
  • 2021-05-28
  • 2022-01-08
  • 2021-10-03
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2021-11-02
  • 2021-11-12
  • 2021-04-28
  • 2021-08-28
  • 2022-12-23
相关资源
相似解决方案