Maven 具有bom表的可传递依赖项
我有一个名为P1的项目,它是一个spring boot项目。 pom已经有了父pom,所以我决定将springboot与bom一起使用Maven 具有bom表的可传递依赖项,maven,spring-boot,maven-bom,Maven,Spring Boot,Maven Bom,我有一个名为P1的项目,它是一个spring boot项目。 pom已经有了父pom,所以我决定将springboot与bom一起使用 <dependencyManagement> <dependencies> <dependency> <!-- Import dependency management from Spring Boot -->
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
P2:
如您所见,spring orm依赖项有所不同。
有人能告诉我这是怎么回事吗?我该怎么解决
此时,我在第二个项目中添加了BOM表。但这不是我的目标。
我希望能够导入P1项目及其真正的依赖项,而无需执行任何其他操作或知道项目正在使用哪个bom表。P2中应该存在导致此问题的其他依赖项,您能否将P1和P2的完整POM粘贴到此处以解决此问题P2项目实际上是空的。。。对P1只有一个依赖关系。看起来,当我在P1中使用bom时,我添加的依赖项的可传递依赖项使用bom中声明的版本。但是当使用P1作为依赖项时,声明的依赖项的可传递性是maven central中的最低版本。
<dependencies>
<dependency>
<groupId>my.company</groupId>
<artifactId>p1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.3.RELEASE:compile
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.6:compile
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.6:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.5.RELEASE:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.10.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-orm:jar:4.3.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.3.RELEASE:compile
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.6:compile
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.6:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.5.RELEASE:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.10.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-orm:jar:4.2.9.RELEASE:compile