Run mvn clean package spring-boot:repackage,error as below:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default)
on project webapps-api-bid: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.3.RELEASE:
repackage failed: Unable to find main class
error message:
repackage failed: Unable to find main class
Reason.
When packaging multiple modules, if the project module contains common, core and other modules, these modules do not need to start, they should be typed as non-executable packages to use that when we have multiple dependencies in maven, we should pay attention to one thing, Common should be packaged out as non-executable jar packages, so do not define in Common's pom spring-boot-maven-plugin plugin.
Project
yixue (parent project, define each module, specify the module dependency jar version)
|------------------------------
|--yixue-admin backend user registration
|yixue
|--yixue-course backend video management
|yixue-admin
|--yixue-commom common toolkit, maintenance tools, public classes
|common
|--yixue-ui web interface, request jumping, interception, etc.
|yixue-ui
|--yixue-eureka SpringCloud registration
Solution:
Common project in addition to the necessary dependency packages, maven packaged plug-ins do not add again, because this SpringBoot plug-in will be packaged twice after the Maven package, in order to generate executable jar packages, if the C defined this plug-in, will report an error prompting not found main function
In short, if your root: `<parent></parent>` project has added `spring-boot-maven-plugin` plug-in, then common do not depend on the root, include some of their own necessary dependency packages, and then do not manually add the packaging plug-in can be, if the packaging If the package still fails, clean the root project and install it again, and then there should be no more problems
Similar Posts:
- Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.5. RELEASE:repackage (repackage) on project tristone-boot-module-system: zip file is empty
- SpringBoot Project Package Error: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin (Running Normally)
- Unable to find a single main class from the following candidates [xxx,xxx]
- Eureka server project startup error handling
- Unregistering JMX-exposed beans on shutdown Solution
- Springboot always reports an error when importing JSP dependencies
- [Solved] Spring Boot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0
- [Solved] SpringBoot Project Package to jar Error: ClassNotFound…
- [Solved] Plugin ‘org.springframework.boot:spring-boot-maven-plugin:’not found
- How to Solve Error: spring-boot-maven-plugin not found