Spring-boot-maven-plugin breaks dependency on child node

I have a multi-module maven setup. The parent module plus two submodules (children), A and B. Module B has a dependency on A. However, if I use spring-boot-maven-plugin in module A, the compilation dependency will not get a solution, and the compilation goal for module B will be cause errors “cannot find character” and “package does not exist”. Everything works if I do not use this plugin, however I cannot remove it in this project.

Here is a way to reproduce the problem:

Parent pom.xml

<modelVersion>4.0.0</modelVersion>
<groupId>com.whatever</groupId>
<artifactId>theparent</artifactId>
<version>2.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
    <module>service</module>
    <module>serviceClient</module>
</modules>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
</parent>

Module a

<modelVersion>4.0.0</modelVersion>
<artifactId>service</artifactId>
<packaging>jar</packaging>
<parent>
    <groupId>com.whatever</groupId>
    <artifactId>theparent</artifactId>
    <version>2.7.0-SNAPSHOT</version>
    <relativePath>../</relativePath>
</parent>

Module B

<modelVersion>4.0.0</modelVersion>
<artifactId>serviceClient</artifactId>
<parent>
    <groupId>com.whatever</groupId>
    <artifactId>theparent</artifactId>
    <version>2.7.0-SNAPSHOT</version>
    <relativePath>../</relativePath>
</parent>
<dependencies>
    <dependency>
        <groupId>com.whatever</groupId>
        <artifactId>service</artifactId>
        <version>2.7.0-SNAPSHOT</version>
    </dependency>
</dependencies>

A B, . , , "mvn clean install" . , A:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.whatever.Application</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

B A, , " ", " " .. , , A.

? - ?

+1
1

, post .

+2

Source: https://habr.com/ru/post/1674028/


All Articles