java 聚合项目
创建聚合项目的2种方式:
分层项目开发:
1.DAO:java工程项目;(maven quickstart)
2.Service:java工程项目;(maven quickstart)
3.模型:java工程项目;(maven quickstart)
4.共工模块:java工程项目;(maven quickstart)
5.controller+view:webapp:web工程项目(maven webapp)
工程类型:packing来设定
java工程:jar
web工程:war
聚合工程:pom
1.创建module ,erp-parent
2.创建子module,设置每个module的 pom.xml 属性pom及父模块;
3.配置erp-parent 模块里的pom.xml
1.创建module ,erp-parent
2.创建子module--maven archetype(archetype:quickstart(java工程),webapp(web工程),设置每个module的 pom.xml 属性pom及父模块;
3.配置erp-parent 模块里的pom.xml
结合通用mapping实现的SSM项目:SSM 框架:是 Spring + Spring MVC + MyBatis 的缩写
mybatis generator:配置插件
通用mapper:tk.mybatis
1.parent--pom.xml配置文件
4.0.0
<groupId>org.test.java.vip.train</groupId>
<artifactId>test-train-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>test-train-common</module>
<module>test-train-pojo</module>
<module>test-train-dao</module>
<module>test-train-service</module>
<module>test-train-web</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>5.2.5.RELEASE</spring.version>
<mysql.version>8.0.21</mysql.version>
<mybatis.version>3.5</mybatis.version>
<mybatis-spring.version>1.3.1</mybatis-spring.version>
<jackson.version>2.10.0</jackson.version>
<lombok.version>1.18.10 </lombok.version>
<com.alibaba>1.1.22</com.alibaba>
<servlet-api.version>3.1.0</servlet-api.version>
<freemarker.version>2.3.28</freemarker.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>test-train-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>test-train-dao</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>test-train-pojo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>test-train-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${com.alibaba.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.serlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
2.子模块 maven type -->quickstart/webapp--pom.xml配置文件
ex test-train-service --> pom.xml
4.0.0
org.test.java.vip.train
test-train-parent
1.0-SNAPSHOT
<groupId>com.test.java.train</groupId>
<artifactId>test-train-service</artifactId>
<packaging>jar</packaging>
<name>test-train-service</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.test.java.train</groupId>
<artifactId>test-train-dao</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>