Spring Boot - Camel - Maven:如何添加我自己的父依赖项以及 Spring Boot 依赖项?



以下是父依赖关系

<parent>
<groupId>com.rabu.practor</groupId>
<artifactId>integrator</artifactId>
<version>1.2-SNAPSHOT</version>
</parent>

我想在不触及父级包含的情况下将项目制作为 Spring 启动项目,并且不允许更改父级。

以下是正在使用的版本

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.24.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

以下是当前项目中的骆驼依赖关系:

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-infinispan</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cdi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
</dependency>

任何人都可以帮助如何在春季启动中实现它

您可以通过添加带有scope=importspring-boot-dependencies工件来获得 spring-boot 依赖项管理的好处。

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.9.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

如果没有父 POM,您将不再受益于插件管理。您需要显式添加spring-boot-maven-plugin

若要对某个依赖项使用与 Boot 管理的依赖项不同的版本,需要在声明spring-boot-dependencies之前在dependencyManagement部分中声明该版本。

最新更新