欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Idea創(chuàng)建多模塊maven聚合項(xiàng)目的實(shí)現(xiàn)

 更新時(shí)間:2019年12月25日 15:30:33   作者:恒不動  
這篇文章主要介紹了Idea創(chuàng)建多模塊maven聚合項(xiàng)目的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

1.怎么理解maven的繼承和聚合

maven多模塊項(xiàng)目通常由一個(gè)父模塊和若干個(gè)子模塊構(gòu)成,每個(gè)模塊都對應(yīng)著一個(gè)pom.xml。它們之間通過繼承和聚合(也稱作多模塊)相互關(guān)聯(lián)。多模塊適用于一些比較大的項(xiàng)目,通過合理的模塊拆分,實(shí)現(xiàn)代碼的復(fù)用,便于維護(hù)和管理。
繼承:和java中的繼承有點(diǎn)類似,就是父pom.xml聲明的版本和引用的jar,子模塊可以不用再引用直接調(diào)用。
聚合:父模塊包含多個(gè)子模塊就是聚合,多個(gè)子模塊之間可以調(diào)用,但是要注意關(guān)系,不要兩個(gè)互相依賴,這樣做的好處就是可以通過一條命令進(jìn)行構(gòu)建

注意:

groupId是項(xiàng)目組織唯一的標(biāo)識符,實(shí)際對應(yīng)JAVA的包的結(jié)構(gòu),artifactId是項(xiàng)目的唯一的標(biāo)識符,實(shí)際對應(yīng)項(xiàng)目的名稱,就是項(xiàng)目根目錄的名稱。groupId一般分為多個(gè)段,一般第一段為域,第二段為公司名稱,第三段通常為項(xiàng)目名稱。

2.Idea創(chuàng)建多模塊項(xiàng)目

2.1創(chuàng)建父模塊(空的maven項(xiàng)目)




pom.xml配置
<modelVersion>4.0.0</modelVersion> 
<parent> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-parent</artifactId> 
 <version>2.1.6.RELEASE</version> 
</parent> 
 
<groupId>cn.yskcoder.fire</groupId> 
<artifactId>fire</artifactId> 
<packaging>pom</packaging> 
<version>v1.0</version> 
 
 
<modules> 
 <module>fire-common</module> 
 <module>fire-dao</module> 
 <module>fire-service</module> 
 <module>fire-web</module> 
</modules> 
 
<properties> 
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
 <java.version>1.8</java.version> 
 <spring-boot.version>2.1.6.RELEASE</spring-boot.version> 
 
</properties>

2.2.創(chuàng)建工具類(common)模塊(dao、service同這個(gè)操作一樣)



pom.xml配置
<modelVersion>4.0.0</modelVersion> 
<parent> 
 <artifactId>fire</artifactId> 
 <groupId>cn.yskcoder.fire</groupId> 
 <version>v1.0</version> 
</parent> 
 
<!--模塊信息--> 
<packaging>jar</packaging> 
<name>fire-common</name> 
<artifactId>fire-common</artifactId> 
<description>fire 通用工具類模塊</description> 
 
<!--模塊依賴--> 
<dependencies> 
 
</dependencies>

2.3.創(chuàng)建數(shù)據(jù)庫訪問(dao)模塊(只貼pom.xml代碼)

<modelVersion>4.0.0</modelVersion> 
<parent> 
 <artifactId>fire</artifactId> 
 <groupId>cn.yskcoder.fire</groupId> 
 <version>v1.0</version> 
</parent> 
 
<!--模塊信息--> 
<packaging>war</packaging> 
<name>fire-web</name> 
<artifactId>fire-web</artifactId> 
<description>fire web模塊</description> 
 
<!--模塊依賴--> 
<dependencies> 
 <dependency> <groupId>cn.yskcoder.fire</groupId> 
 <artifactId>fire-service</artifactId> 
 <version>v1.0</version> 
 </dependency> 
 <dependency> <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-web</artifactId> 
 </dependency> 
 <dependency> <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-aop</artifactId> 
 </dependency> 
 <dependency> <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-test</artifactId> 
 <scope>test</scope> 
 </dependency> 
</dependencies>


<build> 
 <plugins> 
  <plugin> 
   <groupId>org.apache.maven.plugins</groupId> 
   <artifactId>maven-compiler-plugin</artifactId> 
   <version>3.1</version> 
   <configuration> 
    <source>${java.version}</source> 
    <target>${java.version}</target> 
   </configuration> 
  </plugin>
 </plugins>
 <resources> 
  <resource> 
  <directory>src/main/webapp</directory> 
  <filtering>false</filtering> 
  </resource> 
  <resource> 
   <directory>src/main/resources</directory> 
   <filtering>true</filtering> 
  </resource> 
 </resources>
</build>

3.Idea打包多模塊項(xiàng)目

clean package -Dmaven.test.skip=true

接下來有空會繼續(xù)更新這個(gè)項(xiàng)目
https://github.com/yskcoder/Fire

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論