- 首先将所有
开始于 <dependencies> 结束于 </dependencies>中的文件放到最外层的项目中,里面的方法就不需要写version了
- 需要在2中的pom.xml文件中新增一层
-
<dependencyManagement> <dependencies>...</dependencies> </dependencyManagement>
- 可以将所有版本号信息就行抽离
-
<properties> <project.build.soureEncoding>UTF-8</project.build.soureEncoding> <project.compile.soureEncoding>UTF-8</project.compile.soureEncoding> <sharedingsphere.version>4.1.0</sharedingsphere.version> <springboot.versinon>2.2.5.RELEASE</springboot.versinon> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> <version>${springboot.versinon}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <version>${springboot.versinon}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>${springboot.versinon}</version> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.8</version> </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>sharding-jdbc-spring-boot-starter</artifactId> <version>${sharedingsphere.version}</version> </dependency> </dependencies> </dependencyManagement>
version中版本信息为上面properties中配置的信息,起到方便管理的作用
spring boot如何讲jar包抽离到最外层pom文件中
最新推荐文章于 2024-05-03 11:47:20 发布