SpringBoot项目打包为jar后报为找到main方法,ClassNotFound...

SpringBoot项目打包为jar后报为找到main方法,ClassNotFound...

在报错的modules的pom内加上下面的插件即可。

    <build>
       <plugins>
           <!-- 不加这个参数打jar包会报未找到main方法 -->
           <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
               <version>2.4.1</version>
               <configuration>
                   <includeSystemScope>true</includeSystemScope>
                   <mainClass>cn.vantee.EurekaServerStarter7001</mainClass>
               </configuration>
               <executions>
                   <execution>
                       <goals>
                           <goal>repackage</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
       </plugins>
    </build>
posted @ 2021-12-25 15:04  张瑞丰  阅读(650)  评论(0编辑  收藏  举报