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

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88740948