maven当中pomimport和< 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