maven當中 pom import 和< dependencyManagement>的用法maven的繼承和引用到底怎么用的


馬克-to-win@馬克java社區:maven當中避免重復發明輪子的方法,一種是繼承,一種是引用(參考我參考目錄下的文章)。maven中配置引 用關系的方法是,<type>pom</type>和<scope>import</scope>,很 簡單,這樣就引入一個pom文件,這樣<dependencies>里面的<groupId> org.springframework.cloud</groupId>和<artifactId>spring-cloud -starter-eureka-server</artifactId>,由於沒有版本信息,就可以參考引入的pom文件的< dependencyManagement>里面的版本信息。就像maven繼承方法似的,在父pom的< dependencyManagement>里,放入版本信息,在若干子pom里都省去版本信息了。馬克-to-win@馬克java社區:子 pom只需到父pom的<dependencyManagement>里,找到相應的artifactId和groupId的版本信息即可。 引用和繼承原理是類似的。我機器里面的引入文件就在: E:\m2\repository\org\springframework\cloud\spring-cloud-netflix-dependencies \1.3.1.RELEASE里面有個spring-cloud-netflix-dependencies-1.3.1.RELEASE.pom,里面 <dependencyManagement>里面有句話:       
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka-server</artifactId>
                <version>${project.version}</version>
            </dependency>

 



更多內容請見原文,文章轉載自:http://www.mark-to-win.com/index.html?content=Frame/frameUrl.html&chapter=Frame/springCloud_web.html#typePomScopeimportisWhat


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM