Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.4.0:repackage failed

When spring boot performs the packaging operation, the following errors are reported:

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:XXXX RELEASE:repackage failed: Unable to find main class

The root cause is that in my project scenario,

Only the – boot sub module as shown in the figure produces executable jar packages. Other modules do not need to be executable. In my root POM, spring boot helps me add the following build strategy by default

< build>
        & lt; plugins>
            & lt; plugin>
                & lt; groupId> org.springframework.boot
                & lt; artifactId> spring-boot-maven-plugin
            & lt;/ plugin>
        & lt;/ plugins>
    & lt;/ build>

The solution is relatively simple, that is, remove the build part of the Spirng boot for all modules and put it into the sub module you need to package. Here is the API service boot module, Other modules do not need to produce executable jars.
copyright notice: This article is an original article of CSDN blogger “@ within” and follows the CC 4.0 by-sa copyright agreement. Please attach the source link of the original text and this notice for reprint
original link: https://blog.csdn.net/qq_ 41264674/article/details/106539584

Read More: