Home  >  Article  >  Java  >  How to solve the problem that there is no main manifest attribute in SpringBoot

How to solve the problem that there is no main manifest attribute in SpringBoot

王林
王林forward
2023-05-22 19:43:043908browse

Solution: SpringBoot has no main manifest attribute

Problem: After SpringBoot is packaged into a jar and run, it prompts that there is no main manifest attribute

Solution: Complete the maven bulid information

<plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${spring.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

Reason:

Because I used the spring-boot-dependencies BOM instead of the spring-boot-starter-parent parent POM (see 13.2 for details. 2. Using Spring Boot without the parent POM)

caused the configuration items of spring-boot-maven-plugin to be lost, causing the MANIFEST.MF file in the packaged jar to lack Main-Class.

PS: When the packaging type is jar, the packaging process of spring-boot-maven-plugin is completely different from using maven-jar-plugin directly. The generated jar directory structure is also very different...

The above is the detailed content of How to solve the problem that there is no main manifest attribute in SpringBoot. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete