最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

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

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

注意:

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

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

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




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同這個操作一樣)



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打包多模塊項目

clean package -Dmaven.test.skip=true

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

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

相關文章

最新評論

樟树市| 苏尼特右旗| 大田县| 旬邑县| 安阳县| 博乐市| 青川县| 西宁市| 普陀区| 高安市| 清水河县| 临武县| 东港市| 电白县| 黎平县| 房山区| 大名县| 高邑县| 铁岭县| 姜堰市| 法库县| 平山县| 临湘市| 桐城市| 吉林市| 阳春市| 泗阳县| 香格里拉县| 巴林左旗| 永年县| 贵溪市| 故城县| 芒康县| 和田市| 合山市| 广汉市| 双鸭山市| 无极县| 丰镇市| 剑阁县| 民勤县|