maven中dependencyManagement 和dependencies 的區別
阿新 • • 發佈:2019-02-12
dependencies :寫在dependencies 中的
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope>
</dependency>
專案預設會載入 依賴 所有引用 jar包
dependencyManagement :寫在dependencyManagement中的
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency>
專案不會預設 載入,只是相當於建立了一個介面,然後子專案中引用父專案中所引用的依賴jar包 ,不用寫版本號即可等。
可以保證所有子專案中的所依賴包的版本號一致性,便於以後的版本升級 等。
參考:http://liugang594.iteye.com/blog/1687781