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里都省去版本信息了。子 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>
更多请见:https://blog.csdn.net/qq_44639795/article/details/94339551
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。