springboot maven 多模块项目打包的时候某个被依赖的模块报错
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:
repackage (repackage) on project **-client: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:repackage failed:
Unable to find main class -> [Help 1]
这个被依赖的**-client模块并不需要有main类,解决方法是修改父pom.xml
原来的父pom.xml中的标签内容为
<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>
将父pom.xml中的标签内容改为
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.3</version><configuration><source>1.8</source><target>1.8</target><fork>true</fork><verbose>true</verbose><encoding>UTF-8</encoding><meminitial>256m</meminitial><maxmem>1024m</maxmem></configuration></plugin></plugins></build>
原因可以参考springboot官网
https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html#build-tool-plugins-maven-packaging
Once spring-boot-maven-plugin has been included in your pom.xml,
it automatically tries to rewrite archives to make them executable by using the spring-boot:repackage goal.