Maven小白系列,我們會分為幾個部分?
01 添加依賴并打包
02 添加本地jar包并打包
03 將本地jar包匯入本地maven庫
04 springboot打包jar和war
05 Maven統一版本管理
接下來,我們開始第五部分的內容
通常情況下,我們會將一個專案分層使用,今天我們是講解MAVEN使用,我不負責分層,一切從簡
A專案,有BC兩個子模塊,B參考C
一、新建MAVEN專案




package改成pom

新建B、C兩個子模塊



二、統一版本管理
在A的POM中,新建<dependencyManagement></dependencyManagement>標簽對

如果是SpringBoot的統一版本寫法
<!-- SpringBoot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>

三、子模塊使用
子模塊中使用,子模塊中就不需要<dependencyManagement></dependencyManagement>標簽了
直接使用<dependencies></dependencies>

打包就略了,看之前的博客
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/155288.html
標籤:Java
