java - Spring Boot-Camel-Maven : How to add my own parent Dependency along with Spring Boot Dependency?

标签 java spring maven spring-boot apache-camel

以下是父依赖

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

我想将项目制作为 Spring Boot 项目,而不触及父级包含,并且不允许更改父级。

以下是正在使用的版本

<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>

以下是当前项目中的camel依赖:

<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>

任何人都可以帮助如何在 Spring Boot 中实现它

最佳答案

您可以通过使用 scope=import 添加 spring-boot-dependencies Artifact 来获得 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 管理的版本不同的版本,您需要在 dependencyManagement 部分中声明它,然后 spring-boot-dependencies 被声明声明。

关于java - Spring Boot-Camel-Maven : How to add my own parent Dependency along with Spring Boot Dependency?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58263743/

相关文章:

java - Intellij模块依赖发现没有模块可以依赖

java - Spring MVC 缺少 URI 模板变量

java - 在最终编译时删除调试方法

java - Spring REST 后处理所有 HTTP 请求

java - CentOS 7 上的 Ambari 2.7.5 安装失败

java - 如何在 Eclipse 中设置默认 Maven 的 Java?

java - 可以在其他程序上打开的文件的 ZipException

java - 搜索子集(有趣的复杂任务)

java - 安卓工作室游戏开发

java - 无法在 spring rest 模板客户端中找到请求目标的有效认证路径