Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.12:repackage (repackage) on project logic: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.7.12:repackage failed: Unable to find a single main class from the following candidates [com.test.SpringCenterServer, com.test.SpringGatewayServer, com.test.SpringServer]
找到的所有人都是说 是要添加
<execution>
<id>gameLogic</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>com.test.SpringServer</mainClass>
<finalName>gameLogic</finalName>
</configuration>
</execution>
添加了也是没有用
也有说 在project层 加<packaging>jar</packaging>
<project>
...
<packaging>jar</packaging>
...
</project>
试过了也没有用
或者说运行 mvn clean package
甚至于 切换 spring-boot-maven-plugin 的版本
最后 还是得在plugin 层添加 config mainClass 其实跟repackage并不冲突
<configuration>
<mainClass>com.test.SpringServer</mainClass>
</configuration>
所以我最后的结构是这样的