Tag Archives: ClassNotFound.

[Solved] SpringBoot Project Package to jar Error: ClassNotFound…

After the springboot project is packaged as a jar, it is reported to find the main method, classnotfound

Add the following plug-in to the POM of the modules that report the error.

    <build>
       <plugins>
           <!-- If you don't add this parameter to the jar package, it will report that the main method was not found. -->
           <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>