fatherazrael
fatherazrael

Reputation: 5987

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

Following is parent dependency

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

I want to make project as spring boot project without touching parent inclusion and i am not allowed to change parent.

Following are versions in use

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

Following are camel dependency in current project:

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

Could anyone please help how to achieve it in spring boot

Upvotes: 0

Views: 601

Answers (1)

Sukhpal Singh
Sukhpal Singh

Reputation: 2278

You can get benefit of spring-boot dependency management by adding the spring-boot-dependencies artifact with scope=import.

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

Without the parent POM, you no longer will benefit from plugin management. You need to add the spring-boot-maven-plugin explicitly.

To use a different version for a certain dependency than the one managed by Boot, you need to declare it in the dependencyManagement section, before spring-boot-dependencies is declared.

Upvotes: 1

Related Questions