项目目录

属于多模块项目
---project
-----pom.xml
------project-admin
--------pom.xml
------project-facade
--------pom.xml

父pom配置如下:

<plugins>
	<plugin>
	    <groupId>org.springframework.boot</groupId>
	    <artifactId>spring-boot-maven-plugin</artifactId>
	    <configuration>
	        <excludes>
	            <exclude>
	                <groupId>org.projectlombok</groupId>
	                <artifactId>lombok</artifactId>
	            </exclude>
	        </excludes>
	    </configuration>
	</plugin>
</plugins>

子pom未配置pom 元素

执行

mvn clean package

问题

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.12:repackage (repackage) on project **project-facade:** Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.6.12:repackage failed: Unable to find main class -> [Help 1]

原因

因为使用的是spring-boot-maven-plugin,会查找所有module中的Main方法,因为只有project-admin有启动方法,project-facade没有,导致此报错。

解决

将该加入到有启动类的pom中,project-admin的pom中即可。

问题2

中间将父pom的spring-boot-maven-plugin插件转成maven的插件,出现:
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:XXXX RELEASE:repackage failed: Unable to find main class

原因

因为spring-boot-maven-plugin的插件,会生成META-INF/MANIFEST.MF时,标记Main-class路径

解决

通过问题1解决版本进行了最终的处理。