首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring Boot - Camel - Maven:如何在Spring Boot依赖项中添加自己的父依赖项?

Spring Boot - Camel - Maven:如何在Spring Boot依赖项中添加自己的父依赖项?
EN

Stack Overflow用户
提问于 2019-10-07 13:02:54
回答 1查看 280关注 0票数 0

以下是父依赖关系

代码语言:javascript
复制
<parent>
    <groupId>com.rabu.practor</groupId>
    <artifactId>integrator</artifactId>
    <version>1.2-SNAPSHOT</version>
</parent>

我想让项目作为spring boot项目,而不涉及父母的包含,我不允许改变父母。

以下是正在使用的版本

代码语言:javascript
复制
<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>

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

代码语言:javascript
复制
<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中实现它吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-07 13:50:53

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

代码语言:javascript
复制
<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部分中声明它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58263743

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档